@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-color: #fcfcfd;
    --sidebar-bg: #ffffff;
    --panel-bg: #ffffff;
    
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    
    --border-color: #f3f4f6;
    --border-strong: #e5e7eb;
    
    --accent: #0f172a;
    --accent-hover: #1e293b;
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Stunning Glassmorphic Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 2rem;
    position: relative;
    background-color: #f8fafc;
    overflow: hidden;
}

.login-container::before,
.login-container::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    animation: float 10s infinite ease-in-out alternate;
}

.login-container::before {
    width: 500px;
    height: 500px;
    background: rgba(59, 130, 246, 0.4); /* Blue */
    top: -150px;
    left: -150px;
}

.login-container::after {
    width: 600px;
    height: 600px;
    background: rgba(139, 92, 246, 0.3); /* Purple */
    bottom: -200px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 30px) scale(1.1); }
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 24px;
    padding: 3.5rem 3rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255,255,255,0.3) inset;
    position: relative;
    z-index: 1;
}

.login-header {
    margin-bottom: 2.5rem;
    text-align: center;
}

.login-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1.2;
    background: linear-gradient(135deg, #111827, #374151);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.login-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.form-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 0.9rem 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.form-group input:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.btn {
    display: inline-block;
    width: 100%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.95rem 1rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.2), 0 2px 4px -1px rgba(37, 99, 235, 0.1);
}

.btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.25), 0 4px 6px -2px rgba(37, 99, 235, 0.15);
}

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

.alert {
    padding: 0.85rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    display: none;
    font-weight: 500;
}

.alert.error {
    display: block;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--error);
}

/* Dashboard Styles */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.sidebar-header {
    margin-bottom: 2.5rem;
    padding: 0 0.5rem;
}

.sidebar-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    letter-spacing: -0.05em;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.sidebar-nav a:hover {
    background: #f3f4f6;
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: #f8fafc;
    color: var(--primary);
    font-weight: 600;
}

.clock-container {
    font-size: 1.1rem;
    padding: 1.5rem 0.5rem 0;
    border-top: 1px solid var(--border-color);
    line-height: 1.5;
    color: var(--text-primary);
    font-weight: 500;
}

.sidebar-nav-logout {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
}

.sidebar-nav-logout:hover {
    background: #fef2f2;
    color: var(--error);
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2.5rem 3.5rem;
    max-width: 1400px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.topbar h1 {
    font-size: 1.75rem;
    font-weight: 600;
}

.topbar-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    background: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s ease;
}

.panel:hover {
    box-shadow: var(--shadow-md);
}

.panel-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
}

/* Tables */
.table-scroll {
    overflow-x: auto;
    margin-top: 0.5rem;
}

table {
    width: 100%;
    min-width: max-content;
    border-collapse: separate;
    border-spacing: 0;
}

th, td {
    text-align: left;
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    font-size: 0.9rem;
    color: var(--text-primary);
}

tbody tr {
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: #f8fafc;
}

/* Badge */
.badge {
    padding: 0.35rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    background: #f3f4f6;
    color: var(--text-secondary);
    display: inline-block;
}

.badge.active {
    background: #ecfdf5;
    color: #059669;
}

/* Forms in Dashboard */
.inline-form {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.inline-form input,
.inline-form select {
    flex: 1;
    background: #ffffff;
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.inline-form input:focus,
.inline-form select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Grid Form */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem 1.5rem;
}

.form-grid input,
.form-grid select {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-strong);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
    -webkit-appearance: none;
}

.form-grid input:focus,
.form-grid select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.span-full {
    grid-column: 1 / -1;
}

.span-full .btn {
    margin-top: 0.5rem;
}

/* Chart container */
.chart-wrap {
    position: relative;
    padding: 1rem 0;
    width: 100%;
    height: 300px;
}

.grid-2 .span-2 {
    grid-column: 1 / -1;
}

/* Stat box */
.stat-number {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-small {
    padding: 0.5rem 0.85rem;
    background: #ffffff;
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-small:hover:not([disabled]) {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.btn-small[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.message-item {
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    transition: all 0.2s;
    background: #ffffff;
}

.message-item:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.message-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
}

.message-content {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
}

/* QR Box */
.qr-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem;
    text-align: center;
    gap: 1.5rem;
}

.qr-frame {
    width: 220px;
    height: 220px;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.qr-frame img {
    width: 190px;
    height: 190px;
    display: block;
    border-radius: var(--radius-md);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    margin-right: 0.5rem;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
