:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #0f172a;
    --background-color: #f1f5f9;
    --card-background: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --green-color: #16a34a;
    --yellow-color: #eab308;
    --red-color: #dc2626;
    --blue-color: #2563eb;
    --shadow: 0 8px 25px rgba(15, 23, 42, 0.08);
    --border-radius: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.main-header {
    padding: 42px 20px;
    color: #ffffff;
    text-align: center;
    background: linear-gradient(
        135deg,
        #0f172a 0%,
        #1e3a8a 55%,
        #2563eb 100%
    );
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.25);
}

.header-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.main-header h1 {
    margin-bottom: 10px;
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 800;
    letter-spacing: -0.5px;
}

.main-header p {
    margin-bottom: 20px;
    color: #dbeafe;
    font-size: 16px;
}

.technology-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.technology-list span {
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

.container {
    width: min(94%, 1280px);
    margin: 30px auto;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 20px;
}

.section-header h2 {
    margin-bottom: 4px;
    color: var(--secondary-color);
    font-size: 22px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--card-background);
    box-shadow: var(--shadow);
}

.monitoring-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.monitoring-card {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 145px;
    padding: 24px;
    overflow: hidden;
    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
}

.monitoring-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.13);
}

.monitoring-card::before {
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    content: "";
}

.temperature-card::before {
    background: var(--red-color);
}

.humidity-card::before {
    background: #0ea5e9;
}

.mode-card::before {
    background: #7c3aed;
}

.fan-card::before {
    background: var(--blue-color);
}

.status-card::before {
    background: var(--yellow-color);
}

.led-card::before {
    background: var(--green-color);
}

.card-icon {
    display: grid;
    flex-shrink: 0;
    width: 58px;
    height: 58px;
    margin-right: 18px;
    place-items: center;
    border-radius: 14px;
    background: #f8fafc;
    font-size: 30px;
}

.card-content {
    min-width: 0;
}

.card-label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--text-primary);
    font-size: 32px;
    font-weight: 800;
}

.text-value {
    font-size: 22px;
    word-break: break-word;
}

.unit {
    color: var(--text-secondary);
    font-size: 18px;
    font-weight: 600;
}

.control-panel {
    margin-bottom: 28px;
    padding: 26px;
}

.mode-control {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
}

.control-button {
    min-width: 150px;
    padding: 12px 22px;
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.4px;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        opacity 0.2s ease,
        box-shadow 0.2s ease;
}

.control-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.control-button:active {
    transform: translateY(0);
}

.automatic-button {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.manual-button {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.fan-control {
    padding: 22px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: #f8fafc;
}

.fan-control-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 18px;
}

.fan-control-header label {
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 700;
}

.slider-value {
    min-width: 70px;
    padding: 7px 12px;
    border-radius: 8px;
    background: var(--primary-color);
    color: #ffffff;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
}

.fan-slider {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    outline: none;
    background: linear-gradient(
        to right,
        #16a34a 0%,
        #eab308 50%,
        #dc2626 100%
    );
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.fan-slider::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.3);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.fan-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.3);
    cursor: pointer;
}

.fan-slider:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    filter: grayscale(0.6);
}

.slider-scale {
    display: flex;
    justify-content: space-between;
    margin-top: 9px;
    color: var(--text-secondary);
    font-size: 12px;
}

.control-information {
    margin-top: 16px;
    padding: 10px 13px;
    border-left: 4px solid var(--primary-color);
    border-radius: 6px;
    background: #eff6ff;
    color: #1e40af;
    font-size: 13px;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.chart-card {
    min-width: 0;
    padding: 24px;
}

.chart-container {
    position: relative;
    width: 100%;
    min-height: 320px;
}

.chart-container canvas {
    width: 100% !important;
    max-width: 100%;
}

.log-card {
    margin-bottom: 30px;
    padding: 24px;
}

.activity-log {
    min-height: 180px;
    max-height: 300px;
    padding: 16px;
    overflow-y: auto;
    border: 1px solid #1e293b;
    border-radius: 12px;
    background: #0f172a;
    color: #d1fae5;
    font-family: Consolas, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.8;
}

.activity-log div {
    padding: 4px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.log-placeholder {
    color: #94a3b8;
    font-style: italic;
}

.main-footer {
    padding: 24px 20px;
    background: var(--secondary-color);
    color: #cbd5e1;
    text-align: center;
}

.main-footer p:first-child {
    margin-bottom: 5px;
    color: #ffffff;
    font-weight: 700;
}

.main-footer p:last-child {
    font-size: 13px;
}

.activity-log::-webkit-scrollbar {
    width: 8px;
}

.activity-log::-webkit-scrollbar-track {
    border-radius: 999px;
    background: #1e293b;
}

.activity-log::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #475569;
}

.activity-log::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

@media (max-width: 1000px) {
    .monitoring-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .main-header {
        padding: 30px 16px;
    }

    .container {
        width: min(94%, 100%);
        margin: 22px auto;
    }

    .monitoring-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .monitoring-card {
        min-height: 125px;
        padding: 20px;
    }

    .card-value {
        font-size: 28px;
    }

    .text-value {
        font-size: 20px;
    }

    .control-panel,
    .chart-card,
    .log-card {
        padding: 18px;
    }

    .mode-control {
        display: grid;
        grid-template-columns: 1fr;
    }

    .control-button {
        width: 100%;
    }

    .fan-control-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .chart-container {
        min-height: 250px;
    }

    .slider-scale span:nth-child(2),
    .slider-scale span:nth-child(4) {
        display: none;
    }
}