:root {
    --primary: #00d2ff;
    --secondary: #3a7bd5;
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --glass: rgba(255, 255, 255, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg);
    background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, #0f172a 100%);
    color: var(--text);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 1200px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.logo-area {
    display: flex;
    flex-direction: column;
}

#device-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    margin-top: 5px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 10px;
    border-radius: 20px;
    width: fit-content;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-online .dot {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: blink 1.5s infinite;
}

.status-offline .dot {
    background-color: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}

.status-online .status-text { color: var(--success); font-weight: 600; }
.status-offline .status-text { color: var(--danger); font-weight: 600; }

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

h1 {
    font-size: 1.8rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    transition: 0.3s;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-links a:hover, .nav-links a.active {
    background: var(--glass);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.stat-card h3 {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 1.25rem;
    font-weight: 700;
}

.main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

.panel {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 24px;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.panel h2 {
    margin-bottom: 20px;
    font-size: 1.25rem;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 10px;
}

.table-container::-webkit-scrollbar {
    height: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--glass);
    border-radius: 10px;
}

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

th {
    text-align: left;
    padding: 12px;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

td {
    padding: 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-entry { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-exit { background: rgba(239, 68, 68, 0.2); color: #f87171; }

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

input, select {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    outline: none;
    transition: 0.3s;
}

input:focus {
    border-color: var(--primary);
}

button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    touch-action: manipulation;
}

button:active {
    transform: scale(0.98);
}

.btn-danger {
    background: var(--danger);
    padding: 6px 12px;
    font-size: 0.75rem;
    width: auto;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 20px;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
    }

    h1 {
        font-size: 1.5rem;
    }

    .panel {
        padding: 15px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card .value {
        font-size: 1.1rem;
    }

    th, td {
        padding: 10px 8px;
        font-size: 0.8rem;
    }

    .badge {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
}
