/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Roboto', sans-serif;
}

body {
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #fff;
}

.container {
    background: rgba(18, 18, 18, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 1200px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* HEADER */
.header {
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2.8rem;
    color: #00d4ff;
    filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.5));
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(45deg, #00d4ff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 25px;
}

/* LIVE CLOCK */
.live-clock {
    background: rgba(0, 0, 0, 0.5);
    padding: 12px 20px;
    border-radius: 12px;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

#current-time {
    font-size: 1.3rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    color: #00ff88;
}

/* MENU BUTTON */
.menu-container {
    position: relative;
}

.menu-btn {
    width: 55px;
    height: 55px;
    border-radius: 15px;
    background: linear-gradient(135deg, #00d4ff, #0099ff);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.3);
}

.menu-btn:hover {
    transform: rotate(90deg);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.5);
}

.dropdown-menu {
    position: absolute;
    top: 65px;
    right: 0;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 10px 0;
    min-width: 200px;
    display: none;
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dropdown-menu a:last-child {
    border-bottom: none;
}

.dropdown-menu a:hover {
    background: rgba(0, 212, 255, 0.1);
    padding-left: 25px;
}

.dropdown-menu a i {
    width: 20px;
    color: #00d4ff;
}

/* DATA GRID */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    padding: 40px;
}

.data-card {
    background: linear-gradient(145deg, #1a1a1a, #2d2d2d);
    border-radius: 20px;
    padding: 35px;
    display: flex;
    align-items: center;
    gap: 25px;
    transition: all 0.4s;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.data-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(0, 212, 255, 0.2);
}

.card-icon {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
}

.temp-icon {
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    box-shadow: 0 10px 25px rgba(255, 65, 108, 0.4);
}

.hum-icon {
    background: linear-gradient(135deg, #2193b0, #6dd5ed);
    box-shadow: 0 10px 25px rgba(33, 147, 176, 0.4);
}

.card-content {
    flex: 1;
}

.card-title {
    font-size: 1.1rem;
    color: #888;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 15px;
    font-weight: 600;
}

.value-container {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.data-value {
    font-size: 4.5rem;
    font-weight: 800;
    background: linear-gradient(45deg, #fff, #e0e0e0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.data-unit {
    font-size: 2rem;
    color: #888;
    font-weight: 500;
}

/* STATUS */
.status {
    padding: 20px 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
}

#connection-status {
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#connection-status i {
    color: #ff416c;
    font-size: 0.8rem;
}

#connection-status.connected i {
    color: #00ff88;
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: rgba(25, 25, 25, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    width: 100%;
    max-width: 700px;
    max-height: 80vh;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
}

.modal-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 2.2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.close-btn:hover {
    color: #ff416c;
}

.modal-body {
    padding: 30px;
    max-height: 60vh;
    overflow-y: auto;
}

/* FILTER BOX */
.filter-box {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

#date-filter {
    flex: 1;
    min-width: 200px;
    padding: 14px 18px;
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
}

.btn {
    padding: 14px 25px;
    background: linear-gradient(135deg, #00d4ff, #0099ff);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    min-width: 60px;
    justify-content: center;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 212, 255, 0.4);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.1);
}

/* STATS BOX */
.stats-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
    background: rgba(40, 40, 40, 0.5);
    padding: 25px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

.stat-label {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #00ff88;
}

/* TABLE */
.table-container {
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    background: rgba(0, 0, 0, 0.5);
    padding: 18px 20px;
    text-align: left;
    color: #00d4ff;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid rgba(0, 212, 255, 0.3);
}

.history-table td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #ccc;
}

.history-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
}

.empty {
    text-align: center;
    padding: 50px !important;
    color: #666;
    font-style: italic;
}

/* MODAL FOOTER */
.modal-footer {
    padding: 25px 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: right;
    background: rgba(0, 0, 0, 0.3);
}

.close-modal {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    border: none;
    padding: 14px 35px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .container {
        border-radius: 15px;
    }
    
    .header {
        padding: 20px;
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .header-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .data-grid {
        grid-template-columns: 1fr;
        padding: 25px 20px;
        gap: 20px;
    }
    
    .data-card {
        padding: 25px;
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .card-icon {
        width: 80px;
        height: 80px;
        font-size: 2.5rem;
    }
    
    .data-value {
        font-size: 3.5rem;
    }
    
    .modal-content {
        max-height: 90vh;
    }
    
    .filter-box {
        flex-direction: column;
    }
    
    #date-filter {
        min-width: 100%;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .logo {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .data-value {
        font-size: 3rem;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .stats-box {
        grid-template-columns: 1fr;
    }
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00d4ff, #0099ff);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00ff88, #00d4ff);
}