@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4361ee;
    --primary-hover: #3a0ca3;
    --secondary: #3f37c9;
    --success-color: #4cc9f0;
    --warning-color: #f72585;
    --error-color: #e63946;
    
    --bg-color: #f8f9fa;
    --surface-color: #ffffff;
    --sidebar-bg: #1e293b;
    --sidebar-text: #f8fafc;
    --sidebar-hover: #334155;
    
    --text-main: #1f2937;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    
    --sidebar-width: 260px;
    --topbar-height: 70px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout Wrapper */
.app-layout {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    flex-shrink: 0;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-menu a:hover {
    background-color: var(--sidebar-hover);
    color: #fff;
    transform: translateX(4px);
}

.sidebar-menu a.active {
    background-color: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-md);
}

.sidebar-menu a.logout {
    margin-top: auto;
    color: #fca5a5;
}
.sidebar-menu a.logout:hover {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
}

/* Content Wrapper */
.content-wrapper {
    padding: 2rem;
    flex-grow: 1;
}

/* Components */
.card {
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    border: 1px solid transparent;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    color: #fff;
    background-color: var(--primary);
    box-shadow: 0 4px 6px -1px rgba(67, 97, 238, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(67, 97, 238, 0.3);
}

.btn-outline {
    color: var(--text-main);
    background-color: transparent;
    border-color: var(--border-color);
}

.btn-outline:hover {
    background-color: #f1f5f9;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    color: var(--text-main);
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    background-color: #f8fafc;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

tbody tr {
    transition: background-color 0.15s;
}

tbody tr:hover {
    background-color: #f1f5f9;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-success {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-primary { background: var(--primary); color: white; }
.badge-success { background: var(--success-color); color: #fff; }
.badge-warning { background: var(--warning-color); color: #fff; }

/* Auth Container (Login) */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.auth-wrapper::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    position: relative;
    z-index: 1;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 1.75rem;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(67, 97, 238, 0.3);
    overflow: hidden;
}

.auth-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    text-align: center;
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 2rem;
}

.input-group {
    position: relative;
    margin-bottom: 1.25rem;
}

.input-group .form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.4rem;
}

.input-group .form-control {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    background: #f8fafc;
    transition: all 0.25s ease;
}

.input-group .form-control:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

.input-group .form-control::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    bottom: 0.65rem;
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: #475569;
}

.auth-extra {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.auth-extra a {
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.auth-extra a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
    border-radius: 4px;
    cursor: pointer;
}

.btn-login {
    width: 100%;
    padding: 0.8rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, #3a0ca3 100%);
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(67, 97, 238, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(67, 97, 238, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-qr {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.btn-qr:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0;
    color: #94a3b8;
    font-size: 0.8rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.75rem 1.5rem;
        border-radius: 1rem;
    }
    
    .auth-logo {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        border-radius: 16px;
    }
    
    .auth-title {
        font-size: 1.25rem;
    }
    
    .input-group .form-control {
        padding: 0.65rem 0.85rem;
        font-size: 0.9rem;
    }
    
    .btn-login {
        padding: 0.7rem;
        font-size: 0.95rem;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-toggle {
        display: block;
    }

    .topbar {
        padding: 0 1rem;
    }

    .content-wrapper {
        padding: 1rem;
    }
}

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}