/* ============================================
   MODERN FACE RECOGNITION ATTENDANCE SYSTEM - CSS
   ============================================ */

:root {
    --primary: #667eea;
    --primary-light: #7c8ee8;
    --primary-dark: #5568d3;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark: #1f2937;
    --light: #f3f4f6;
    --bs-body-bg: #f9fafb;
    --bs-text-muted: #6b7280;
}

/* ============================================
   BASE STYLING
   ============================================ */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
    background-color: #f9fafb;
    color: #1f2937;
    font-size: 0.95rem;
    line-height: 1.6;
}

body.sidebar-open {
    overflow: hidden;
}

/* ============================================
   SIDEBAR STYLING
   ============================================ */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    min-height: 100vh;
    transition: all 0.3s ease;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.main-shell {
    min-width: 0;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 1035;
}

.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.sidebar-brand {
    background: rgba(255, 255, 255, 0.05);
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

.sidebar-brand h5 {
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

.sidebar .nav-link {
    color: #d1d5db;
    padding: 0.875rem 1rem;
    margin: 0.25rem 0;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.sidebar .nav-link:hover {
    background: rgba(102, 126, 234, 0.15);
    color: #ffffff;
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, #667eea 0%, #7c8ee8 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.sidebar .nav-link i {
    width: 20px;
    margin-right: 0.75rem;
}

/* ============================================
   NAVBAR STYLING
   ============================================ */
.navbar {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 1.5rem;
}

.navbar h6 {
    color: #374151;
    font-size: 1.05rem;
}

#currentTime {
    font-size: 0.95rem;
    color: #1f2937;
}

#currentDate {
    color: #9ca3af;
    font-size: 0.8rem;
}

.navbar-dropdown {
    width: 40px;
    height: 40px;
}

/* ============================================
   CARDS & MAIN CONTENT
   ============================================ */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-stat {
    border-radius: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    position: relative;
    overflow: hidden;
}

.card-stat::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.stat-icon-box {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    font-weight: 500;
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
    color: white;
}

.btn-outline-secondary {
    border: 2px solid #e5e7eb;
    color: #6b7280;
}

.btn-outline-secondary:hover {
    border-color: #667eea;
    color: #667eea;
    background: transparent;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   FORMS
   ============================================ */
.form-control {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: #ffffff;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.form-label {
    color: #1f2937;
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
}

.input-group-text {
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #6b7280;
    font-size: 1rem;
}

.input-group .form-control {
    border-left: 0;
}

/* ============================================
   CAMERA CONTAINER
   ============================================ */
.camera-container {
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    margin-bottom: 1.5rem;
}

.camera-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-frame {
    pointer-events: none;
    animation: pulse-frame 1.5s ease-in-out infinite;
}

@keyframes pulse-frame {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

/* ============================================
   TABLES
   ============================================ */
.table {
    font-size: 0.95rem;
}

.table thead th {
    border-top: none;
    border-bottom: 2px solid #e5e7eb;
    color: #374151;
    font-weight: 600;
    background-color: #f9fafb;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table-hover tbody tr:hover {
    background-color: #f3f4f6;
}

.table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.table tbody td {
    vertical-align: middle;
    color: #374151;
}

/* ============================================
   ALERTS & TOAST
   ============================================ */
.alert {
    border: none;
    border-radius: 8px;
    padding: 1rem;
}

.alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    color: #0c4a6e;
    border-left: 4px solid #0ea5e9;
}

.alert-success {
    background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
    color: #15803d;
    border-left: 4px solid #10b981;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #b91c1c;
    border-left: 4px solid #ef4444;
}

/* Toast Notifications */
.toast {
    border: none;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-left: 4px solid #667eea;
}

.toast-header {
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 8px 8px 0 0;
}

.toast-body {
    padding: 1rem;
}

.toast.success {
    border-left-color: #10b981;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.warning {
    border-left-color: #f59e0b;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    gap: 0.25rem;
}

.page-link {
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    color: #667eea;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.page-link:hover {
    background: #f3f4f6;
    border-color: #667eea;
    color: #667eea;
}

.page-item.active .page-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

/* ============================================
   SPINNER & LOADING
   ============================================ */
.spinner-border {
    color: #667eea;
    border-width: 0.25em;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.2em;
}

/* ============================================
   DROPDOWN
   ============================================ */
.dropdown-menu {
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dropdown-item {
    padding: 0.75rem 1rem;
    color: #374151;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
    color: #667eea;
}

.dropdown-header {
    color: #1f2937;
    font-weight: 600;
    padding: 0.75rem 1rem;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    background: #ffffff;
    color: #6b7280;
    font-size: 0.9rem;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        height: 100vh;
        top: 0;
        z-index: 1040;
        transition: left 0.3s ease;
    }

    .sidebar.show {
        left: 0;
    }

    .card-stat {
        margin-bottom: 1rem;
    }

    .navbar h6 {
        font-size: 0.9rem;
    }

    .container-fluid.py-4 {
        padding: 1rem !important;
    }

    #currentTime {
        font-size: 0.85rem;
    }

    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }

    .table {
        font-size: 0.85rem;
    }

    .page-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }

    .toast-container {
        left: 0;
        right: 0;
        padding: 1rem !important;
    }

    .toast {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .navbar {
        padding: 0.625rem 0.875rem;
    }

    .card {
        border-radius: 8px;
    }

    .camera-container {
        border-radius: 8px;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .btn-lg {
        width: 100%;
        justify-content: center;
    }

    .navbar-time {
        display: none;
    }

    .sidebar {
        width: min(84vw, 300px);
        left: calc(-1 * min(84vw, 300px));
    }

    .sidebar.show {
        left: 0;
    }

    .sidebar-brand h5 {
        font-size: 1.1rem;
    }

    .camera-frame img {
        width: 140px !important;
        height: 140px !important;
    }

    footer .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .table-responsive {
        font-size: 0.85rem;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-muted {
    color: #6b7280 !important;
}

.bg-light {
    background-color: #f9fafb !important;
}

.border-light {
    border-color: #e5e7eb !important;
}

.shadow-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}

.shadow-lg {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

.rounded {
    border-radius: 8px;
}

/* Transition utilities */
.transition-all {
    transition: all 0.3s ease;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
