:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #10b981;
    --danger: #ef4444;
    --nav-bg: rgba(15, 23, 42, 0.8);
    --border-color: rgba(255, 255, 255, 0.1);
    --header-bg: rgba(0, 0, 0, 0.2);
    --input-bg: rgba(0, 0, 0, 0.3);
}

:root.light-theme {
    --bg-color: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.9);
    --primary: #2563eb;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --accent: #059669;
    --danger: #dc2626;
    --nav-bg: rgba(255, 255, 255, 0.8);
    --border-color: rgba(0, 0, 0, 0.1);
    --header-bg: rgba(0, 0, 0, 0.05);
    --input-bg: rgba(255, 255, 255, 0.8);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    padding-bottom: 4rem;
}

/* Navbar */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Dashboard Container */
.dashboard-container {
    max-width: 100%;
    margin: 2rem auto;
    width: 100%;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
}

.dashboard-header {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Columns Grid */
.dashboard-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
}

.device-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.device-column-header {
    padding: 1rem;
    text-align: center;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.device-column-header span {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 700;
}

/* Clock-ins Feed */
.clockins-feed {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.clockins-feed::-webkit-scrollbar {
    width: 6px;
}
.clockins-feed::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}
.clockins-feed::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
.clockins-feed::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.clockin-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--header-bg);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    transition: transform 0.3s ease, background 0.3s ease;
    animation: slideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.clockin-card:hover {
    background: var(--input-bg);
    transform: translateY(-2px);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.clockin-photo {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    position: relative;
    z-index: 1;
    cursor: zoom-in;
}

.clockin-photo:hover {
    transform: scale(2.5);
    z-index: 100;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8), 0 0 15px rgba(59, 130, 246, 0.6);
}

.violation-photo {
    border-color: var(--danger) !important;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6) !important;
}

.clockin-info {
    flex: 1;
    min-width: 0;
}

.clockin-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clockin-time {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.clockin-time i {
    color: var(--primary);
}

.device-badge {
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    color: var(--text-muted);
}

/* Test Tool */
.test-controls {
    text-align: center;
    margin-top: 1rem;
}

.btn {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

/* Devices Page */
.devices-container {
    max-width: 1000px;
    margin: 3rem auto;
    width: 100%;
    padding: 0 1rem;
}

.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.device-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 12px;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.8rem;
    border-radius: 8px;
    color: white;
}
.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}
