/* Kuvoz Incubator Control System - Web Interface Styles */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-bg: #ecf0f1;
    --dark-bg: #34495e;
    --text-light: #ffffff;
    --text-dark: #2c3e50;
    --border-color: #bdc3c7;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--light-bg) 0%, #d5dbdb 100%);
    color: var(--text-dark);
    line-height: 1.4;
    min-height: 100vh;
    min-height: 100vh;
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: splashFadeIn 0.3s ease-in;
}

.splash-screen.fade-out {
    animation: splashFadeOut 0.5s ease-out forwards;
}

.splash-content {
    text-align: center;
    animation: splashContentSlide 0.6s ease-out;
}

.splash-logo {
    max-width: 400px;
    width: 80%;
    height: auto;
    margin-bottom: 30px;
    animation: splashLogoFloat 2s ease-in-out infinite;
}

.splash-loader {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #e74c3c;
    border-radius: 50%;
    margin: 20px auto;
    animation: spin 1s linear infinite;
}

.splash-text {
    color: var(--text-light);
    font-size: 1.2rem;
    margin-top: 20px;
    font-weight: 300;
    letter-spacing: 1px;
}

@keyframes splashFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes splashFadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes splashContentSlide {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes splashLogoFloat {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 8px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header - Compact for Raspberry Pi */
.header {
    background: #2c3e50;
    background: var(--primary-color);
    color: #ffffff;
    color: var(--text-light);
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    box-shadow: var(--shadow);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.header h1 i {
    color: var(--success-color);
    margin-right: 8px;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-light);
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.lang-btn.active {
    background: rgba(255, 255, 255, 0.25);
    font-weight: 600;
}

.lang-btn i {
    font-size: 0.7rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 5px;
}

.connection-status.connected {
    color: var(--success-color);
}

.connection-status.disconnected {
    color: var(--danger-color);
}

/* Navigation Links */
.nav-link {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-light);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.nav-link i {
    color: var(--warning-color);
    font-size: 1.1rem;
}

.nav-text {
    display: inline;
}

/* VetMarketi Link */
.vetmarketi-link {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-light);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    font-weight: 500;
}

.vetmarketi-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.vetmarketi-link i {
    color: var(--warning-color);
}

/* IP Address Display */
.ip-address {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 4px;
}

.ip-address i {
    color: var(--secondary-color);
}

/* Main Content - Modern Grid Layout */
.main-content {
    flex: 1;
    display: grid;
    grid-template-areas:
        "control sidebar"
        "system system";
    grid-template-columns: 1.2fr 1fr;
    grid-template-rows: auto auto;
    gap: 8px;
    margin-bottom: 8px;
    width: 100%;
    box-sizing: border-box;
    width: 100%;
    box-sizing: border-box;
    padding: 0 6px;
}

/* Sidebar - Sensors + Timer */
.sidebar {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.sensor-panel {
    background: white;
    padding: 8px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    flex: 0 0 auto;
}

.sensor-panel h2 {
    display: none;
    /* Hide title in new design */
}

/* Sensor Grid - 2x2 Grid Layout */
.sensor-grid-large {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

/* Compact AI Panel */
.compact-ai-panel {
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.1) 0%, rgba(58, 123, 213, 0.1) 100%);
    border-radius: 10px;
    padding: 10px;
    margin-top: 8px;
    border: 2px solid rgba(0, 210, 255, 0.3);
}

.compact-ai-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #2c3e50;
}

.compact-ai-header i {
    font-size: 1rem;
    color: #00d2ff;
}

.compact-ai-header h3 {
    font-size: 0.85rem;
    margin: 0;
    flex: 1;
}

.ai-badge-mini {
    background: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 0.6rem;
    font-weight: bold;
}

.compact-ai-content {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.compact-camera {
    flex: 1;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    min-height: 120px;
}

.compact-camera img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.compact-camera-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 6px 8px;
    font-size: 0.7rem;
    color: white;
    text-align: center;
}

.compact-vitals {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.compact-vital-item {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

.compact-vital-item i {
    color: #00d2ff;
    font-size: 0.9rem;
}

.compact-vital-item .vital-label {
    flex: 1;
    color: #7f8c8d;
    font-size: 0.7rem;
}

.compact-vital-item .vital-value {
    font-weight: bold;
    color: #2c3e50;
    font-size: 0.8rem;
}

.sensor-card-large {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 8px;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 65px;
}

.sensor-card-large:hover {
    transform: translateY(-3px);
}

.sensor-card-large.temperature {
    border-left-color: var(--danger-color);
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
}

.sensor-card-large.humidity {
    border-left-color: var(--secondary-color);
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
}

.sensor-card-large.oxygen {
    border-left-color: var(--success-color);
    background: linear-gradient(135deg, #55efc4 0%, #00b894 100%);
    color: white;
}

.sensor-card-large.co2 {
    border-left-color: #ff9800;
    background: linear-gradient(135deg, #fab1a0 0%, #e17055 100%);
    color: white;
}

.co2-comment {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 3px;
    padding: 3px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.3);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sensor-card-large i {
    font-size: 2rem;
    opacity: 0.9;
}

.sensor-card-large.temperature i {
    color: var(--danger-color);
}

.sensor-card-large.humidity i {
    color: white;
}

.sensor-card-large.oxygen i {
    color: white;
}

.sensor-card-large.co2 i {
    color: white;
}

.sensor-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.sensor-card-large h3 {
    margin: 0;
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0.9;
}

.sensor-value-large {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 2px;
}

.control-panel {
    grid-area: control;
    background: white;
    padding: 12px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.system-panel {
    grid-area: system;
    background: white;
    padding: 8px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    box-sizing: border-box;
}

section h2 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.system-panel h2 {
    margin-bottom: 4px;
    font-size: 0.8rem;
}

.sensor-panel h2 {
    display: none;
}

/* Timer Section - Bottom Right */
.timer-section {
    grid-area: timer;
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    box-sizing: border-box;
}

.timer-section h2 {
    color: var(--primary-color);
    margin-bottom: 6px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timer-card-large {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 4px solid var(--secondary-color);
    border-radius: 10px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    gap: 8px;
    align-items: start;
    min-height: 80px;
}

.timer-icon {
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timer-icon i {
    font-size: 1.1rem;
    color: var(--secondary-color);
}

.timer-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.timer-content h3 {
    margin: 0;
    font-size: 0.7rem;
    color: var(--primary-color);
    font-weight: 600;
}

.timer-stats {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    font-size: 0.65rem;
    color: #555;
    line-height: 1.2;
    grid-column: 1 / -1;
}

.timer-label {
    font-weight: 500;
    font-size: 0.6rem;
}

.timer-time {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.7rem;
}

.timer-unit {
    opacity: 0.7;
}

.timer-separator {
    width: 1px;
    height: 16px;
    background: #ccc;
    margin: 0 4px;
}

.timer-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 2px 0;
    min-height: 50px;
}

body.cleaning-page .control-grid {
    gap: 8px;
}

body.cleaning-page .control-btn {
    min-height: 64px;
    padding: 10px;
    font-size: 0.75rem;
}

body.cleaning-page .control-btn i {
    font-size: 1.3rem;
}

body.cleaning-page .timer-card-large.ozone {
    grid-template-columns: 1fr;
    text-align: center;
}

body.cleaning-page .timer-card-large.ozone .timer-display {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

body.cleaning-page .timer-card-large.ozone .timer-info {
    justify-content: center;
}

body.cleaning-page .timer-card-large.ozone .timer-info span {
    font-size: 0.75rem;
}

body.cleaning-page .timer-display {
    display: flex !important;
}

body.cleaning-page .timer-stats {
    display: none !important;
}

.phase-badge {
    background: var(--warning-color);
    color: white;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
}

.phase-badge.duty {
    background: var(--success-color);
}

.phase-badge.free {
    background: var(--warning-color);
}

.countdown-large {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.progress-bar-large {
    width: 70px;
    height: 4px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-large .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--secondary-color));
    transition: width 1s ease;
}

.system-panel {
    grid-area: system;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Timer Section - In Sidebar Below Sensors OR in Control Panel */
.timer-section {
    background: white;
    padding: 12px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    box-sizing: border-box;
    flex: 0 0 auto;
    margin-top: 12px;
    /* Add spacing when in control panel */
}

/* Timer section inside control panel - remove extra styling */
.control-panel .timer-section {
    background: transparent;
    padding: 0;
    box-shadow: none;
    margin-top: 16px;
}

/* Sensor Grid - Vertical Sidebar Layout */
.sensor-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

/* Sensor Row - for gas sensors (O2 and CO2) */
.sensor-row {
    display: contents;
}

.sensor-card {
    background: var(--light-bg);
    padding: 8px 10px;
    border-radius: 6px;
    text-align: center;
    border-left: 3px solid;
    transition: transform 0.2s ease;
}

.sensor-card:hover {
    transform: translateY(-2px);
}

.sensor-card.temperature {
    border-left-color: var(--danger-color);
}

.sensor-card.humidity {
    border-left-color: var(--secondary-color);
}

.sensor-card.oxygen {
    border-left-color: var(--success-color);
}

.sensor-card.co2 {
    border-left-color: #ff9800;
}

.sensor-card i {
    font-size: 1rem;
    margin-bottom: 3px;
}

.sensor-card.temperature i {
    color: var(--danger-color);
}

.sensor-card.humidity i {
    color: var(--secondary-color);
}

.sensor-card.oxygen i {
    color: var(--success-color);
}

.sensor-card.co2 i {
    color: #ff9800;
}

.sensor-card h3 {
    margin-bottom: 3px;
    color: var(--text-dark);
    font-size: 0.7rem;
    font-weight: 600;
}

.sensor-value {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 2px;
}

.sensor-status {
    font-size: 0.55rem;
    color: #7f8c8d;
    display: none;
}

/* Timer Panel */
.timer-panel h2 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.timer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.timer-card {
    background: var(--light-bg);
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid var(--secondary-color);
    transition: all 0.3s ease;
}

.timer-card.nebulizer {
    border-left-color: var(--secondary-color);
}

.timer-card.ozone {
    border-left-color: var(--warning-color);
}

.timer-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.timer-header i {
    font-size: 0.9rem;
}

.timer-header h3 {
    margin: 0;
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 600;
}

.timer-status {
    text-align: center;
    margin-bottom: 6px;
}

.phase-indicator {
    font-size: 0.65rem;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 10px;
    margin-bottom: 4px;
    display: inline-block;
}

.phase-indicator.duty {
    background: var(--success-color);
    color: white;
}

.phase-indicator.free {
    background: var(--warning-color);
    color: white;
}

.phase-indicator.ready {
    background: var(--border-color);
    color: var(--text-dark);
}

.countdown {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 4px;
    line-height: 1;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--secondary-color));
    width: 0%;
    transition: width 1s ease;
}

.timer-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: #666;
    font-weight: 500;
}

.duty-info,
.free-info {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Control Grid - 2x3 Button Layout */
.control-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
    width: 100%;
}

/* Target Values Display - Instead of Sliders */
.target-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.target-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
    border-radius: 8px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-left: 4px solid;
    box-sizing: border-box;
    min-height: 80px;
}

.target-item.temperature-target {
    border-left-color: var(--danger-color);
}

.target-item.humidity-target {
    border-left-color: var(--secondary-color);
}

.target-item.cooling-target {
    border-left-color: #3498db;
}

.target-item i {
    font-size: 1.1rem;
    opacity: 0.8;
    flex-shrink: 0;
}

.target-item.temperature-target i {
    color: var(--danger-color);
}

.target-item.humidity-target i {
    color: var(--secondary-color);
}

.target-item.cooling-target i {
    color: #3498db;
}

.target-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
}

.target-label {
    font-size: 0.6rem;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.target-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.target-controls {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

.target-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--secondary-color);
    color: white;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.target-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.target-btn:active {
    transform: scale(0.95);
}

.target-btn.minus {
    background: var(--danger-color);
}

.target-btn.minus:hover {
    background: #c0392b;
}

.target-btn.plus {
    background: var(--success-color);
}

.target-btn.plus:hover {
    background: #229954;
}

/* Mode Selector Section */
.mode-selector-section {
    margin-top: 16px;
    background: var(--light-bg);
    padding: 12px;
    border-radius: 8px;
}

.mode-selector-section .mode-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* Mode Selector */
.mode-selector {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: var(--light-bg);
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.mode-label {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.8rem;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.mode-btn {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.7rem;
    color: var(--text-dark);
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mode-btn i {
    font-size: 1rem;
    margin-bottom: 2px;
}

.mode-btn span {
    font-weight: 600;
}

.mode-btn small {
    font-size: 0.65rem;
    color: #7f8c8d;
}

.mode-btn:hover {
    border-color: var(--secondary-color);
    background: #f8f9fa;
    transform: translateY(-1px);
}

.mode-btn.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.mode-btn.active i,
.mode-btn.active small {
    color: white;
}

.mode-info {
    display: flex;
    justify-content: space-around;
    padding: 6px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.mode-detail {
    font-size: 0.7rem;
    color: var(--text-dark);
}

.mode-detail strong {
    color: var(--primary-color);
    margin-right: 4px;
}

.control-btn {
    background: #ffffff;
    border: 3px solid #d0d0d0;
    border-radius: 12px;
    padding: 12px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #5f6368;
    min-height: 80px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.control-btn:not(.state-disabled):hover {
    background: #eeeeee;
    color: #616161;
    border-color: #9e9e9e;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Hover effects for colored states */
.control-btn.state-on:hover {
    background: #229954;
    /* Darker green */
    border-color: #1e8449;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(39, 174, 96, 0.6);
}

.control-btn.state-off:hover {
    background: #c0392b;
    /* Darker red */
    border-color: #a93226;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(231, 76, 60, 0.6);
}

.control-btn.state-unknown:hover {
    background: #ecf0f1;
    /* Light gray */
    border-color: #95a5a6;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Active (press down) effects - all states */
.control-btn:not(.state-disabled):active {
    transform: translateY(0px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-btn.state-on:active {
    background: #1e8449;
    /* Very dark green when pressed */
    border-color: #145a32;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-btn.state-off:active {
    background: #a93226;
    /* Very dark red when pressed */
    border-color: #922b21;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-btn.state-unknown:active {
    background: #d5dbdb;
    /* Darker gray when pressed */
    border-color: #7f8c8d;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Buton çıkış VERİYOR (GPIO LOW = ON) - YEŞİL */
.control-btn.state-on,
.control-btn.active-on,
.control-btn.active {
    background: #27ae60 !important;
    /* Yeşil */
    color: #ffffff !important;
    border: 3px solid #229954 !important;
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.4) !important;
}

/* Buton çıkış VERMİYOR (GPIO HIGH = OFF) - KIRMIZI */
.control-btn.state-off,
.control-btn.active-off {
    background: #e74c3c !important;
    /* Kırmızı */
    color: #ffffff !important;
    border: 3px solid #c0392b !important;
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.4) !important;
}

/* Buton DISABLED (GPIO kullanılamıyor) - GRİ */
.control-btn.state-disabled {
    background: #ffffff;
    color: #9e9e9e;
    border: 3px solid #d6d6d6;
    box-shadow: none;
    cursor: not-allowed;
}

.control-btn.state-disabled:hover {
    background: #ffffff;
    color: #9e9e9e;
    border-color: #d6d6d6;
    transform: none;
    box-shadow: none;
}

/* Buton PASİF veya GPIO yanıtı bekleniyor - BEYAZ */
.control-btn.state-unknown {
    background: #ffffff;
    color: #7f8c8d;
    border: 3px solid #bdc3c7;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    /* Tıklanabilir */
}

.control-btn i {
    font-size: 1.5rem;
}

.control-btn span {
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
    font-size: 0.85rem;
}

/* Slider Grid - Auto placed */
.slider-grid {
    display: contents;
}

.slider-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px 8px;
    background: var(--light-bg);
    border-radius: 8px;
    min-height: 55px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    /* Compact vertical layout */
}

.slider-item label {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.75rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Slider controls with +/- buttons */
.slider-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.slider-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--secondary-color);
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* Compact buttons */
}

.slider-btn:hover {
    background: #2980b9;
    transform: scale(1.05);
}

.slider-btn:active {
    transform: scale(0.95);
}

.slider-btn.minus {
    background: var(--danger-color);
}

.slider-btn.minus:hover {
    background: #c0392b;
}

.slider-btn.plus {
    background: var(--success-color);
}

.slider-btn.plus:hover {
    background: #229954;
}

.slider {
    flex: 1;
    height: 14px;
    background: var(--border-color);
    border-radius: 7px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
    /* Thicker track for touch */
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 36px;
    height: 36px;
    background: var(--secondary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    /* Larger thumb for touch */
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.slider::-webkit-slider-thumb:active {
    transform: scale(1.3);
    background: var(--success-color);
}

.slider::-moz-range-thumb {
    width: 36px;
    height: 36px;
    background: var(--secondary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    /* Larger thumb for touch */
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.slider::-moz-range-thumb:active {
    transform: scale(1.3);
    background: var(--success-color);
}

.slider-value {
    min-width: 40px;
    text-align: center;
    font-weight: bold;
    color: var(--primary-color);
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    border: 2px solid var(--border-color);
    font-size: 0.85rem;
    /* Compact value display */
}

/* Duty/Free Time Slider Styling */
.slider-item.duty-time {
    border-left: 4px solid var(--success-color);
    background: rgba(39, 174, 96, 0.05);
}

.slider-item.free-time {
    border-left: 4px solid var(--warning-color);
    background: rgba(243, 156, 18, 0.05);
}

.slider-item.duty-time label::before {
    content: "⚡ ";
    color: var(--success-color);
    font-weight: bold;
}

.slider-item.free-time label::before {
    content: "⏸️ ";
    color: var(--warning-color);
    font-weight: bold;
}

/* System Controls - Modern Button Layout */
.system-controls {
    display: flex;
    flex-direction: row;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

/* New Categorized Grid Layout */
.system-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    width: 100%;
}

.system-group {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecef 100%);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.system-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-color: rgba(102, 126, 234, 0.3);
}

.group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.group-header i {
    font-size: 1rem;
}

.group-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.system-group .system-btn {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 14px;
    font-size: 0.85rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.system-group .system-btn:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Güç Grubuna Özel Stil */
.system-group.power-group {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    border-color: #f39c12;
}

.system-group.power-group .group-header {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.system-group.power-group .system-btn.shutdown {
    border-color: var(--danger-color);
    color: var(--danger-color);
    font-weight: 600;
}

.system-group.power-group .system-btn.shutdown:hover {
    background: var(--danger-color);
    color: white;
}

.system-group.power-group .system-btn.restart {
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.system-group.power-group .system-btn.restart:hover {
    background: var(--warning-color);
    color: white;
}

/* Responsive Grid */
@media (max-width: 1200px) {
    .system-controls-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .system-controls-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .system-group {
        padding: 10px;
    }

    .group-header {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
}

.system-btn {
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-dark);
    font-weight: 500;
}

.system-btn i {
    font-size: 0.9rem;
}

.system-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.system-btn.settings {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.system-btn.settings:hover {
    background: var(--secondary-color);
    color: white;
}

.system-btn.settings {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.system-btn.settings:hover {
    background: var(--secondary-color);
    color: white;
}

.system-btn.shutdown {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.system-btn.shutdown:hover {
    background: var(--danger-color);
    color: var(--text-light);
}

.system-btn.restart {
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.system-btn.restart:hover {
    background: var(--warning-color);
    color: var(--text-light);
}

.system-btn.save {
    border-color: var(--success-color);
    color: var(--success-color);
}

.system-btn.save:hover {
    background: var(--success-color);
    color: var(--text-light);
}

.system-btn.logs {
    border-color: #6c757d;
    color: #6c757d;
}

.system-btn.logs:hover {
    background: #6c757d;
    color: var(--text-light);
}

.system-btn.ai-alerts {
    border-color: #667eea;
    color: #667eea;
}

.system-btn.ai-alerts:hover {
    background: #667eea;
    color: var(--text-light);
}

.system-btn.remote-access {
    border-color: #667eea;
    color: #667eea;
}

.system-btn.remote-access:hover {
    background: #667eea;
    color: var(--text-light);
}

.system-btn.patient-info {
    border-color: #e91e63;
    color: #e91e63;
}

.system-btn.patient-info:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-light);
    border-color: #667eea;
}

.system-btn.user-profile {
    border-color: #00bcd4;
    color: #00bcd4;
}

.system-btn.user-profile:hover {
    background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
    color: var(--text-light);
    border-color: #00bcd4;
}

/* AI Detail Button */
.ai-detail-btn {
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    background: var(--light-bg);
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.ai-detail-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

/* Warning Message */
.warning-message {
    background: #fff3cd;
    border: 2px solid var(--warning-color);
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 10px;
}

.warning-message i {
    color: var(--warning-color);
    font-size: 2.5rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.warning-message strong {
    color: var(--warning-color);
    display: block;
    margin-bottom: 6px;
    font-size: 1.2rem;
}

.warning-message p {
    margin: 4px 0;
    font-size: 1rem;
    color: #856404;
    line-height: 1.5;
}

/* Simulation Warning Banner */
.simulation-warning {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    padding: 15px 20px;
    margin: 8px 0;
    border-radius: 8px;
    border-left: 6px solid #c92a2a;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
    display: flex;
    gap: 15px;
    align-items: center;
    animation: pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
    }

    50% {
        opacity: 0.9;
        box-shadow: 0 4px 20px rgba(255, 107, 107, 0.6);
    }
}

.simulation-warning i {
    font-size: 2rem;
    flex-shrink: 0;
    animation: shake-warning 0.5s ease-in-out infinite alternate;
}

@keyframes shake-warning {
    0% {
        transform: rotate(-5deg);
    }

    100% {
        transform: rotate(5deg);
    }
}

.simulation-warning strong {
    display: block;
    margin-bottom: 5px;
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.simulation-warning p {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.4;
    opacity: 0.95;
}

/* Footer - Compact */
.footer {
    background: var(--dark-bg);
    color: var(--text-light);
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    margin-top: auto;
    font-size: 0.75rem;
}

/* Responsive Design - Raspberry Pi Optimized */

/* Large Raspberry Pi screens: 1280x720, 1024x600 */
@media (max-width: 1280px) {
    .main-content {
        gap: 8px;
    }

    /* Timer display görünür olsun (1280 genişlikte) */
    .timer-display {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
    }
}

/* Medium screens: 1024x600 */
@media (max-width: 1024px) {
    .container {
        padding: 6px;
    }

    .main-content {
        grid-template-areas:
            "control sidebar"
            "system system";
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 8px;
    }

    .sensor-grid-large {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .control-grid {
        gap: 8px;
    }

    .control-btn {
        min-height: 70px;
        padding: 12px 8px;
    }

    .control-btn i {
        font-size: 1.5rem;
    }

    .control-btn span {
        font-size: 0.75rem;
    }

    .sensor-value-large {
        font-size: 2rem;
    }

    .timer-card-large {
        grid-template-columns: auto 1fr;
        gap: 12px;
    }

    .timer-icon {
        width: 50px;
        height: 50px;
    }

    .timer-icon i {
        font-size: 1.5rem;
    }
}

/* Enhanced support for 1024-1280px range */
@media (min-width: 1025px) and (max-width: 1280px) {
    .button-row {
        grid-template-columns: 1fr 1fr 1.8fr;
    }
}

/* 720x480 Screen - Ultra-compact for smaller displays */
@media (max-width: 720px) and (max-height: 520px) {
    html {
        height: 100vh;
        max-height: 100vh;
        overflow: hidden;
    }

    body {
        font-size: 10px;
        line-height: 1.0;
        height: 100vh;
        max-height: 100vh;
        overflow: hidden;
        margin: 0;
        padding: 0;
        /* Prevent layout shift when scrollbars toggle */
        scrollbar-gutter: stable both-edges;
        /* Avoid overscroll/bounce on kiosks */
        overscroll-behavior: none;
    }

    .container {
        padding: 0px;
        height: 100vh;
        max-height: 100vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    /* Hide non-critical header items to avoid wrapping */
    .header .language-selector,
    .header .vetmarketi-link,
    .header .ip-address,
    .header .datetime {
        display: none !important;
    }

    /* Ultra-compact header for 720x480 */
    .header {
        padding: 1px 2px;
        margin-bottom: 0px;
        flex-shrink: 0;
        border-radius: 3px;
    }

    .header h1 {
        font-size: 0.6rem;
        font-weight: 600;
    }

    .header h1 i {
        margin-right: 1px;
        font-size: 0.6rem;
    }

    .status-bar {
        gap: 2px;
        font-size: 0.48rem;
    }

    .lang-btn {
        padding: 1px 3px;
        font-size: 0.48rem;
    }

    .vetmarketi-link {
        padding: 1px 3px;
        font-size: 0.48rem;
        gap: 2px;
    }

    .vetmarketi-link i {
        font-size: 0.48rem;
    }

    .ip-address {
        padding: 1px 3px;
        font-size: 0.42rem;
        gap: 2px;
    }

    .ip-address i {
        font-size: 0.48rem;
    }

    /* Compact main layout for 720x480 */
    .main-content {
        grid-template-areas:
            "control sidebar"
            "system system";
        grid-template-columns: 1fr 110px;
        grid-template-rows: auto auto;
        gap: 1px;
        margin-bottom: 0px;
        flex: 1 1 auto;
        min-height: 0;
        overflow: clip;
        /* Ensure implicit rows don't stretch and content starts at top */
        grid-auto-rows: auto;
        align-content: start;
    }

    .sidebar {
        gap: 1px;
        min-height: 0;
        overflow: clip;
    }

    .sensor-panel,
    .timer-panel,
    .control-panel,
    .system-panel {
        padding: 1px;
        border-radius: 2px;
        min-height: 0;
        overflow: clip;
    }

    .control-panel {
        overflow: hidden;
        /* Override 1024px rule that forces this into row 3 */
        grid-row: auto !important;
        grid-column: auto;
        grid-area: control;
    }

    section h2 {
        font-size: 0.52rem;
        margin-bottom: 0px;
        gap: 1px;
    }

    section h2 i {
        font-size: 0.5rem;
    }

    /* Compact sensors for 720x480 */
    .sensor-grid {
        gap: 1px;
    }

    .sensor-card {
        padding: 1px 2px;
        border-radius: 2px;
        border-left-width: 2px;
    }

    .sensor-card i {
        font-size: 0.7rem;
        margin-bottom: 0px;
    }

    .sensor-card h3 {
        font-size: 0.48rem;
        margin-bottom: 0px;
    }

    .sensor-value {
        font-size: 1.0rem;
        margin-bottom: 0px;
    }

    /* Compact timers for 720x480 */
    .timer-grid {
        gap: 1px;
    }

    .timer-card {
        padding: 2px;
        border-left-width: 2px;
    }

    .timer-header {
        gap: 1px;
        margin-bottom: 1px;
    }

    .timer-header i {
        font-size: 0.55rem;
    }

    .timer-header h3 {
        font-size: 0.48rem;
    }

    .countdown {
        font-size: 0.85rem;
        margin-bottom: 0px;
    }

    .phase-indicator {
        font-size: 0.42rem;
        padding: 1px 2px;
        margin-bottom: 0px;
    }

    .progress-bar {
        height: 2px;
    }

    /* Hide extra timer details to reduce height */
    .timer-info {
        display: none;
        font-size: 0.38rem;
    }

    /* Ultra-compact control buttons for 720x480 */
    .control-grid {
        gap: 1px;
    }

    .button-row {
        gap: 1px;
        grid-template-columns: 1fr 1fr 1.8fr;
    }

    .button-row.two-buttons-slider {
        grid-template-columns: 1fr 1fr 1.8fr;
    }

    .button-row.no-sliders {
        grid-template-columns: repeat(2, 1fr);
    }

    .button-row.single-slider {
        grid-template-columns: 0.6fr 1.4fr;
    }

    .button-row.single-slider-only {
        grid-template-columns: 1fr;
    }

    .button-row.multi-slider {
        grid-template-columns: 0.6fr 1.4fr;
    }

    .button-row.preset-mode {
        grid-template-columns: 0.6fr 1.4fr;
    }

    .control-vertical {
        gap: 8px;
    }

    .control-column {
        gap: 1px;
    }

    .control-btn {
        padding: 1px;
        font-size: 0.4rem;
        gap: 0px;
        max-height: 30px;
        border-width: 1px;
    }

    .control-btn i {
        font-size: 0.75rem;
    }

    .control-btn span {
        line-height: 1;
        font-size: 0.42rem;
    }

    /* Compact mode selector for 720x480 */
    .mode-selector {
        gap: 1px;
        padding: 1px 2px;
    }

    .mode-selector.compact {
        padding: 1px 2px;
        gap: 1px;
    }

    .mode-label {
        font-size: 0.48rem;
        margin-bottom: 0px;
    }

    .mode-buttons {
        gap: 1px;
    }

    .mode-btn {
        padding: 1px;
        border-width: 1px;
        font-size: 0.42rem;
    }

    .mode-btn i {
        font-size: 0.6rem;
        margin-bottom: 0px;
    }

    .mode-btn small {
        font-size: 0.36rem;
    }

    /* Hide mode info row to save space */
    .mode-info,
    .mode-info.compact {
        display: none;
    }

    .mode-detail {
        font-size: 0.38rem;
    }

    /* Compact sliders for 720x480 */
    .slider-item {
        padding: 1px;
        gap: 0px;
        min-height: 22px;
    }

    .slider-item label {
        font-size: 0.4rem;
        line-height: 1;
    }

    .slider-controls {
        gap: 1px;
    }

    .slider-btn {
        width: 12px;
        height: 12px;
        font-size: 0.6rem;
        border-radius: 2px;
    }

    .slider {
        height: 3px;
    }

    .slider::-webkit-slider-thumb {
        width: 12px;
        height: 12px;
    }

    .slider::-moz-range-thumb {
        width: 12px;
        height: 12px;
    }

    .slider-value {
        min-width: 20px;
        padding: 0px 1px;
        font-size: 0.45rem;
        border-width: 1px;
    }

    /* Compact system controls for 720x480 */
    .system-controls {
        gap: 1px;
    }

    .system-btn {
        padding: 2px 3px;
        font-size: 0.48rem;
        gap: 1px;
        border-radius: 2px;
        border-width: 1px;
    }

    .system-btn i {
        font-size: 0.52rem;
    }

    /* Ultra-compact footer for 720x480 */
    .footer {
        padding: 1px;
        font-size: 0.4rem;
        margin-top: 0px;
        flex-shrink: 0;
        line-height: 1;
    }

    /* Compact warnings for 720x480 */
    .warning-message {
        padding: 4px 6px;
        gap: 4px;
        border-width: 1px;
        border-radius: 3px;
        margin-top: 3px;
    }

    .warning-message i {
        font-size: 0.8rem;
        margin-top: 1px;
    }

    .warning-message strong {
        font-size: 0.6rem;
        margin-bottom: 2px;
    }

    .warning-message p {
        font-size: 0.5rem;
        margin: 1px 0;
        line-height: 1.1;
    }

    /* Further shrink or hide simulation banner if shown */
    .simulation-warning {
        padding: 6px 8px;
        margin: 2px 0;
        gap: 6px;
        border-left-width: 3px;
    }

    .simulation-warning i {
        font-size: 1.0rem;
    }

    .simulation-warning strong {
        font-size: 0.65rem;
        margin-bottom: 2px;
    }

    .simulation-warning p {
        font-size: 0.5rem;
        line-height: 1.1;
    }

    /* Compact modal for 720x480 */
    .modal-content {
        padding: 12px;
        max-width: 350px;
    }

    .modal-icon {
        font-size: 35px;
        margin-bottom: 8px;
    }

    .modal-title {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .modal-message {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .modal-buttons {
        gap: 6px;
    }

    .modal-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 40px;
        max-width: 130px;
    }

    .modal-btn i {
        font-size: 14px;
    }

    .ozone-mode {
        font-size: 7px;
        padding: 1px 3px;
    }

    /* Hide scrollbars if any inner element overflows */
    *::-webkit-scrollbar {
        width: 0px;
        height: 0px;
    }
}

/* Waveshare 7" 800x480 Screen - Optimized for touchscreen */
/* Waveshare 800x480 LCD - Tam Ekran Optimizasyonu */
@media (min-width: 750px) and (max-width: 850px) and (min-height: 450px) and (max-height: 520px) {
    body {
        font-size: 11px;
        line-height: 1.1;
        height: 100vh;
        overflow: hidden;
    }

    .container {
        padding: 2px 4px;
        height: 100vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .header {
        padding: 3px 6px;
        margin-bottom: 3px;
        flex-shrink: 0;
    }

    .header h1 {
        font-size: 0.85rem;
    }

    .header h1 i {
        font-size: 0.8rem;
    }

    .status-bar {
        gap: 4px;
        font-size: 0.6rem;
    }

    /* Dil butonları küçük ve kompakt */
    .lang-btn {
        padding: 3px 8px;
        font-size: 0.65rem;
        min-width: 40px;
        min-height: 24px;
        background: rgba(255, 255, 255, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }

    .lang-btn.active {
        background: rgba(255, 255, 255, 0.35);
        border-color: rgba(255, 255, 255, 0.5);
        font-weight: 700;
    }

    .main-content {
        grid-template-areas:
            "control sidebar"
            "system system";
        grid-template-columns: 1fr 0.9fr;
        grid-template-rows: auto auto;
        gap: 4px;
        margin-bottom: 2px;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .control-panel,
    .sensor-panel,
    .system-panel,
    .timer-section {
        padding: 6px 8px;
        border-radius: 6px;
    }

    section h2 {
        font-size: 0.75rem;
        margin-bottom: 4px;
        gap: 3px;
    }

    /* Slider'ları kompakt yap */
    .slider-row {
        margin-bottom: 4px;
    }

    .slider-row .slider-item {
        padding: 6px 8px;
    }

    .slider-row .slider-item label {
        font-size: 0.65rem;
        margin-bottom: 4px;
    }

    .slider-controls {
        gap: 4px;
    }

    .slider-btn {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
        border-radius: 4px;
    }

    .slider {
        height: 8px;
    }

    .slider::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }

    .slider::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }

    .slider-value {
        min-width: 35px;
        padding: 2px 6px;
        font-size: 0.7rem;
        border-width: 1px;
    }

    /* Butonları küçült */
    .control-grid {
        gap: 4px;
        margin-top: 6px;
    }

    .control-btn {
        min-height: 50px;
        padding: 6px 4px;
        border-width: 2px;
        gap: 3px;
    }

    .control-btn i {
        font-size: 1.2rem;
    }

    .control-btn span {
        font-size: 0.65rem;
        line-height: 1.1;
    }

    /* Mode selector küçült */
    .mode-selector-section {
        margin-top: 6px;
        padding: 6px 8px;
    }

    .mode-buttons {
        gap: 4px;
    }

    .mode-btn {
        padding: 4px 3px;
        font-size: 0.55rem;
        border-width: 1px;
    }

    .mode-btn i {
        font-size: 0.8rem;
        margin-bottom: 1px;
    }

    .mode-btn small {
        font-size: 0.5rem;
    }

    /* Sensör kartları */
    .sensor-grid-large {
        gap: 4px;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .sensor-card-large {
        padding: 8px 10px;
        gap: 4px;
    }

    .sensor-card-large i {
        font-size: 1.5rem;
    }

    .sensor-card-large h3 {
        font-size: 0.7rem;
    }

    .sensor-value-large {
        font-size: 1.6rem;
        margin-top: 2px;
    }

    /* Timer kartı */
    .timer-section h2 {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }

    .timer-card-large {
        padding: 4px 6px;
        gap: 4px;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        border-left-width: 2px;
        border-radius: 8px;
    }

    .timer-icon {
        width: 28px;
        height: 28px;
    }

    .timer-icon i {
        font-size: 1rem;
    }

    .timer-content h3 {
        font-size: 0.65rem;
    }

    /* Timer display alt satıra tam genişlik */
    .timer-display {
        grid-column: 1 / -1;
        margin-top: 2px;
        gap: 2px;
    }

    .phase-badge {
        padding: 2px 6px;
        font-size: 0.55rem;
        border-radius: 6px;
    }

    .countdown-large {
        font-size: 0.9rem;
    }

    .progress-bar-large {
        width: 70px;
        height: 4px;
    }

    .timer-stats {
        display: none;
        font-size: 0.6rem;
        gap: 4px;
    }

    .timer-time {
        font-size: 0.75rem;
    }

    /* Timer display artık tüm ekranlarda görünür */

    /* Sistem butonları */
    .system-controls {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }

    .system-btn {
        padding: 6px 8px;
        font-size: 0.65rem;
        gap: 3px;
        border-width: 1px;
    }

    .system-btn i {
        font-size: 0.8rem;
    }


    /* Footer gizle veya küçült */
    .footer {
        padding: 2px;
        font-size: 0.5rem;
        margin-top: 2px;
    }
}

/* Slider controls - Standalone rules */
.slider-controls {
    gap: 2px;
}

.slider-btn {
    width: 20px;
    height: 20px;
    font-size: 0.85rem;
    border-radius: 3px;
}

.slider {
    height: 6px;
}

.slider::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
}

.slider-value {
    min-width: 32px;
    padding: 2px 4px;
    font-size: 0.65rem;
    border-width: 1px;
}

/* Optimized system controls for 800x480 */
.system-controls {
    gap: 3px;
}

.system-btn {
    padding: 5px 8px;
    font-size: 0.65rem;
    gap: 3px;
    border-radius: 4px;
    border-width: 2px;
}

.system-btn i {
    font-size: 0.75rem;
}

/* Compact warnings */
.warning-message {
    padding: 6px 8px;
    gap: 6px;
    border-width: 1px;
    border-radius: 4px;
    margin-top: 4px;
}

.warning-message i {
    font-size: 1rem;
    margin-top: 1px;
}

.warning-message strong {
    font-size: 0.7rem;
    margin-bottom: 3px;
}

.warning-message p {
    font-size: 0.6rem;
    margin: 2px 0;
    line-height: 1.2;
}

.simulation-warning {
    padding: 8px 10px;
    margin: 3px 0;
    gap: 8px;
    border-left-width: 4px;
}

.simulation-warning i {
    font-size: 1.2rem;
}

.simulation-warning strong {
    font-size: 0.75rem;
    margin-bottom: 3px;
}

.simulation-warning p {
    font-size: 0.6rem;
    line-height: 1.2;
}

/* Optimized footer for 800x480 */
.footer {
    padding: 3px 6px;
    font-size: 0.55rem;
    margin-top: 2px;
    flex-shrink: 0;
    line-height: 1.2;
}

/* Optimized modal for 800x480 */
.modal-content {
    padding: 20px;
    max-width: 500px;
}

.modal-icon {
    font-size: 50px;
    margin-bottom: 12px;
}

.modal-title {
    font-size: 22px;
    margin-bottom: 10px;
}

.modal-message {
    font-size: 16px;
    margin-bottom: 18px;
    line-height: 1.4;
}

.modal-buttons {
    gap: 10px;
}

.modal-btn {
    padding: 12px 20px;
    font-size: 16px;
    min-height: 50px;
    max-width: 180px;
}

.modal-btn i {
    font-size: 18px;
}

/* Ozone mode indicator */
.ozone-mode {
    font-size: 0.5rem;
    padding: 2px 5px;
}

/* Fallback for standard 800px width screens (not 480px height) */
@media (max-width: 800px) and (min-height: 520px) {
    .container {
        padding: 4px;
    }

    .header {
        padding: 8px 10px;
        margin-bottom: 6px;
    }

    .header h1 {
        font-size: 1rem;
    }

    .header h1 i {
        margin-right: 5px;
        font-size: 0.9rem;
    }

    .status-bar {
        gap: 8px;
        font-size: 0.7rem;
    }

    section h2 {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    section h2 i {
        font-size: 0.85rem;
    }

    .sensor-grid {
        gap: 6px;
        grid-template-columns: 1fr;
    }

    .sensor-card {
        padding: 8px;
    }

    .sensor-card i {
        font-size: 1.2rem;
        margin-bottom: 4px;
    }

    .sensor-card h3 {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }

    .sensor-value {
        font-size: 1.2rem;
        margin-bottom: 2px;
    }

    .sensor-status {
        font-size: 0.65rem;
    }

    .timer-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .timer-card {
        padding: 8px;
    }

    .timer-header h3 {
        font-size: 0.85rem;
    }

    .countdown {
        font-size: 1.1rem;
        margin-bottom: 6px;
    }

    .phase-indicator {
        font-size: 0.7rem;
        padding: 2px 8px;
    }

    .button-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
    }

    .control-btn {
        padding: 8px;
        font-size: 0.75rem;
    }

    .control-btn i {
        font-size: 1.2rem;
    }

    .slider-item {
        padding: 8px 10px;
        gap: 10px;
        min-height: 45px;
    }

    .slider-item label {
        min-width: 110px;
        font-size: 0.75rem;
    }

    .slider-value {
        min-width: 45px;
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .slider {
        height: 6px;
    }

    .slider::-webkit-slider-thumb {
        width: 20px;
        height: 20px;
    }

    .slider::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }

    .system-controls {
        gap: 6px;
    }

    .system-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
        gap: 6px;
    }

    .system-btn i {
        font-size: 0.85rem;
    }

    .footer {
        padding: 6px;
        font-size: 0.65rem;
    }
}

/* Very small screens: Below 480px (fallback) */
@media (max-width: 480px) {
    .button-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .slider-item {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .slider-item label {
        min-width: auto;
        text-align: center;
    }

    .system-controls {
        flex-direction: column;
    }
}

/* Animation Keyframes */
@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.sensor-status.reading {
    animation: pulse 2s infinite;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: var(--text-light);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    background: var(--danger-color);
}

.toast.warning {
    background: var(--warning-color);
}

/* Sensor visibility control */
.sensor-card.sensor-hidden,
.sensor-card-large.sensor-hidden {
    display: none !important;
}

/* Ozone Mode Indicator */
.ozone-mode {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--warning-color);
    color: var(--text-light);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
    opacity: 0.9;
}

.control-btn[data-name="b8"] {
    position: relative;
}

.ozone-mode.oxygen-based {
    background: var(--success-color);
}

.ozone-mode.timed {
    background: var(--secondary-color);
}

.ozone-mode.disabled {
    background: var(--danger-color);
}

/* ===========================
   Confirmation Modal (Touchscreen-friendly)
   =========================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(3px);
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-icon {
    font-size: 60px;
    color: var(--warning-color);
    margin-bottom: 20px;
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.modal-message {
    font-size: 18px;
    color: #555;
    margin-bottom: 30px;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    flex: 1;
    padding: 15px 25px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
    min-height: 60px;
    max-width: 200px;
}

.modal-btn i {
    font-size: 20px;
}

.modal-btn-cancel {
    background: #95a5a6;
    color: white;
}

.modal-btn-cancel:hover,
.modal-btn-cancel:active {
    background: #7f8c8d;
    transform: scale(1.05);
}

.modal-btn-confirm {
    background: var(--danger-color);
    color: white;
}

.modal-btn-confirm:hover,
.modal-btn-confirm:active {
    background: #c0392b;
    transform: scale(1.05);
}

/* Touch feedback */
.modal-btn:active {
    transform: scale(0.95);
}

/* AI Panel Styles */
.ai-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-visual-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.ai-vitals-panel {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 10px;
    padding: 10px;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
}

.ai-vitals-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
}

.ai-vitals-header i {
    color: #00d2ff;
}

.ai-vital-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
}

.ai-vital-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.ai-vital-value {
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
}

.ai-camera-panel {
    width: 100%;
}

.ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    color: #fff;
}

.ai-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-header-left i {
    font-size: 1rem;
    color: #00d2ff;
}

.ai-header-left h3 {
    font-size: 0.9rem;
    margin: 0;
}

.ai-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-badge {
    background: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: bold;
}

.ai-toggle-btn {
    position: relative;
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 0.75rem;
    font-weight: 600;
}

.ai-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ai-toggle-btn:active {
    transform: translateY(0);
}

.ai-toggle-btn.active {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    border-color: rgba(0, 210, 255, 0.5);
}

.ai-toggle-btn.active:hover {
    box-shadow: 0 4px 12px rgba(0, 210, 255, 0.5);
}

.ai-toggle-btn.inactive {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    border-color: rgba(255, 255, 255, 0.2);
}

.ai-toggle-btn i {
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

@keyframes ai-pulse {

    0%,
    100% {
        box-shadow: 0 4px 15px rgba(0, 210, 255, 0.4);
    }

    50% {
        box-shadow: 0 4px 25px rgba(0, 210, 255, 0.8),
            0 0 30px rgba(0, 210, 255, 0.5);
    }
}
}


.camera-container {
    position: relative;
    width: 100%;
    height: 200px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0;
}

#aiCameraFeed {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 900px) {
    .ai-visual-layout {
        flex-direction: column;
    }

    .ai-vitals-panel {
        flex: 0 0 auto;
        height: auto;
    }

    .camera-container {
        height: 200px;
    }
}

.ai-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    padding: 5px 10px;
    color: #fff;
    font-size: 0.9rem;
}

.ai-alerts-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 100px;
    overflow-y: auto;
}

.ai-alert-item {
    background: rgba(255, 59, 48, 0.2);
    border-left: 3px solid #ff3b30;
    padding: 5px 10px;
    margin-bottom: 5px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #fff;
}

/* 7-inch Screen Optimization */
@media screen and (max-height: 600px) {

    body,
    .container,
    .main-content {
        overflow: auto !important;
        height: auto !important;
        min-height: 100vh;
    }

    /* Ensure content stacks if needed */
    .timer-section {
        margin-bottom: 20px;
    }
}

/* =============================================================================
   MOBILE & TABLET OPTIMIZATION - Tailscale Remote Access
   ============================================================================= */

/* Mobile Phones (Portrait) - 320px to 480px */
@media (max-width: 480px) {

    /* Reset container for mobile */
    .container {
        padding: 8px;
        max-width: 100%;
    }

    /* Header optimization */
    .header {
        padding: 12px;
        margin-bottom: 12px;
    }

    .header h1 {
        font-size: 1.1rem;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .header h1 i {
        font-size: 1.1rem;
    }

    /* Status bar - stack everything */
    .status-bar {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 0.75rem;
        justify-content: center;
    }

    .status-bar>* {
        flex: 0 0 auto;
        min-width: fit-content;
    }

    /* Hide nav text on mobile, show only icons */
    .nav-link .nav-text {
        display: none;
    }

    .nav-link {
        padding: 6px 10px;
        min-width: auto;
    }

    .language-selector {
        order: -1;
        width: 100%;
        display: flex;
        justify-content: center;
        gap: 8px;
    }

    .lang-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .vetmarketi-link {
        font-size: 0.7rem;
        padding: 6px 10px;
    }

    /* Main content - single column */
    .main-content {
        display: flex;
        flex-direction: column;
        gap: 12px;
        overflow: visible;
        height: auto;
    }

    /* Control panel - full width */
    .control-panel {
        width: 100%;
        max-width: 100%;
        padding: 12px;
    }

    /* Target values - stack vertically on very small screens */
    .target-values {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 15px;
    }

    .target-item {
        padding: 12px;
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .target-item i {
        font-size: 2rem;
    }

    .target-info {
        flex: 1;
    }

    .target-label {
        font-size: 0.85rem;
        display: block;
        margin-bottom: 4px;
    }

    .target-value {
        font-size: 1.4rem;
        font-weight: 700;
    }

    .target-controls {
        display: flex;
        gap: 8px;
    }

    .target-btn {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
        border-radius: 8px;
    }

    /* Button grid - 2 columns for phones */
    .control-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .control-btn {
        padding: 16px 12px;
        font-size: 0.85rem;
        min-height: 80px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .control-btn i {
        font-size: 2rem;
    }

    .control-btn span {
        font-size: 0.85rem;
        text-align: center;
    }

    /* Mode selector */
    .mode-buttons {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        margin-bottom: 12px;
    }

    .mode-btn {
        flex: 1;
        min-width: calc(33.33% - 6px);
        padding: 10px 8px;
        font-size: 0.75rem;
    }

    .mode-btn small {
        font-size: 0.65rem;
    }

    /* Timer section */
    .timer-section {
        margin-top: 12px;
    }

    .timer-card-large {
        padding: 12px;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .timer-icon {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .timer-icon i {
        font-size: 1.5rem;
    }

    .timer-content h3 {
        font-size: 1rem;
        margin: 0;
    }

    .countdown-large {
        font-size: 1.8rem;
        font-weight: 700;
    }

    .phase-badge {
        font-size: 0.75rem;
        padding: 4px 10px;
    }

    .timer-stats {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
        font-size: 0.75rem;
    }

    /* Sidebar - full width below controls */
    .sidebar {
        width: 100%;
        max-width: 100%;
    }

    /* Sensor panel */
    .sensor-panel {
        padding: 12px;
    }

    .sensor-grid-large {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .sensor-card-large {
        padding: 16px;
        display: flex;
        align-items: center;
        gap: 15px;
        min-height: 80px;
    }

    .sensor-card-large i {
        font-size: 2.5rem;
    }

    .sensor-info h3 {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }

    .sensor-value-large {
        font-size: 2rem;
        font-weight: 700;
        margin: 0;
    }

    /* System controls - 2 columns on mobile */
    .system-controls {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .system-btn {
        padding: 12px 10px;
        font-size: 0.8rem;
        min-height: 60px;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .system-btn i {
        font-size: 1.3rem;
    }

    /* Footer */
    .footer {
        padding: 12px;
        font-size: 0.7rem;
        text-align: center;
    }

    /* Modal - mobile optimized */
    .modal-content {
        width: 95%;
        padding: 24px 16px;
        max-width: 100%;
    }

    .modal-title {
        font-size: 1.3rem;
    }

    .modal-message {
        font-size: 0.95rem;
    }

    .modal-buttons {
        flex-direction: column;
        gap: 12px;
    }

    .modal-btn {
        max-width: 100%;
        padding: 16px;
        font-size: 1rem;
    }
}

/* Tablets (Portrait) - 481px to 768px */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        padding: 16px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .status-bar {
        font-size: 0.85rem;
        gap: 12px;
    }

    /* Main content - still single column but with more space */
    .main-content {
        display: flex;
        flex-direction: column;
        gap: 16px;
        overflow: visible;
        height: auto;
    }

    .control-panel,
    .sidebar {
        width: 100%;
        max-width: 100%;
    }

    /* Target values - horizontal layout */
    .target-values {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* Button grid - 3 columns for tablets */
    .control-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .control-btn {
        padding: 18px;
        min-height: 90px;
    }

    .control-btn i {
        font-size: 2.2rem;
    }

    .control-btn span {
        font-size: 0.9rem;
    }

    /* Sensor grid - 2 columns */
    .sensor-grid-large {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* System controls - 3 columns */
    .system-controls {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .system-btn {
        padding: 14px 12px;
        font-size: 0.9rem;
    }
}

/* Tablets (Landscape) - 769px to 1024px */
@media (min-width: 769px) and (max-width: 1024px) {

    /* Two column layout */
    .main-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 16px;
    }

    .control-panel {
        grid-column: 1;
        grid-row: 1 / 3;
    }

    .sidebar {
        grid-column: 2;
        grid-row: 1;
    }

    .system-panel {
        grid-column: 1 / 3;
        grid-row: 3;
    }

    /* Button grid - 3 columns */
    .control-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* System controls - all in one row */
    .system-controls {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Touch improvements for all mobile devices */
@media (hover: none) and (pointer: coarse) {

    /* Increase touch targets */
    button,
    .control-btn,
    .system-btn,
    .target-btn,
    .mode-btn,
    .lang-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Larger tap area for buttons */
    .control-btn {
        padding: 16px;
    }

    /* Better visual feedback on tap */
    button:active,
    .control-btn:active,
    .system-btn:active {
        transform: scale(0.95);
        opacity: 0.9;
    }

    /* Disable hover effects on touch devices */
    .control-btn:hover,
    .system-btn:hover {
        transform: none;
    }

    .control-btn:active,
    .system-btn:active {
        transform: scale(0.95);
    }
}

/* Prevent zoom on double-tap for iOS */
@media (max-width: 768px) {

    input,
    select,
    textarea,
    button {
        font-size: 16px !important;
    }
}

/* Landscape mode adjustments for phones */
@media (max-width: 900px) and (orientation: landscape) {
    .header h1 {
        font-size: 1rem;
    }

    .status-bar {
        font-size: 0.7rem;
    }

    .main-content {
        display: grid;
        grid-template-columns: 1.2fr 1fr;
        gap: 12px;
    }

    .control-panel {
        grid-column: 1;
    }

    .sidebar {
        grid-column: 2;
        grid-row: 1 / 3;
    }

    .system-panel {
        grid-column: 1 / 3;
    }

    .control-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .control-btn {
        padding: 12px 8px;
        min-height: 70px;
    }

    .sensor-grid-large {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .sensor-card-large {
        padding: 12px;
        min-height: 60px;
    }

    .footer {
        padding: 6px;
        font-size: 0.65rem;
    }
}

/* Very small devices (old phones) */
@media (max-width: 360px) {
    .header h1 {
        font-size: 0.95rem;
    }

    .status-bar {
        font-size: 0.7rem;
    }

    .control-btn {
        padding: 12px 8px;
        min-height: 70px;
        font-size: 0.75rem;
    }

    .control-btn i {
        font-size: 1.6rem;
    }

    .sensor-value-large {
        font-size: 1.6rem;
    }

    .target-value {
        font-size: 1.2rem;
    }

    .system-btn {
        font-size: 0.7rem;
        padding: 10px 6px;
    }
}

/* Print styles */
@media print {

    .header,
    .footer,
    .system-panel,
    .modal-overlay {
        display: none;
    }

    .main-content {
        display: block;
    }

    .sensor-panel,
    .control-panel {
        page-break-inside: avoid;
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    /* Sharper borders and shadows on retina */
    .control-btn,
    .sensor-card-large,
    .system-btn {
        border-width: 0.5px;
    }
}

/* Safe area for notched phones (iPhone X+) */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Already dark by default, but can add specific overrides if needed */
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}