/* =============================================
   Jaanu Corp Solutions — Attendance Portal
   Custom Styles
   ============================================= */

/* ---- CSS Variables ---- */
:root {
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;
    --primary-950: #172554;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Glass Card ---- */
.glass-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-card-dark {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ---- Primary Button ---- */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ---- Secondary Button ---- */
.btn-secondary {
    background: white;
    border: 1.5px solid #e2e8f0;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

/* ---- Danger Button ---- */
.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-1px);
}

/* ---- Form Inputs ---- */
.form-input:focus {
    outline: none;
}

/* ---- Login Background Shapes ---- */
.login-bg-shapes {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.08;
    background: white;
}

.shape-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    right: -100px;
    animation: float 8s ease-in-out infinite;
}

.shape-2 {
    width: 300px;
    height: 300px;
    bottom: -80px;
    left: -80px;
    animation: float 10s ease-in-out infinite reverse;
}

.shape-3 {
    width: 200px;
    height: 200px;
    top: 40%;
    left: 10%;
    animation: float 12s ease-in-out infinite;
}

.shape-4 {
    width: 150px;
    height: 150px;
    bottom: 20%;
    right: 15%;
    animation: float 9s ease-in-out infinite reverse;
}

/* ---- Animations ---- */
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(5deg); }
    50% { transform: translateY(-10px) rotate(-3deg); }
    75% { transform: translateY(-25px) rotate(2deg); }
}

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

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

@keyframes pulse-border {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out 0.15s both;
}

.animate-fade-in {
    animation: fadeIn 0.8s ease-out 0.3s both;
}

.pulse-once {
    animation: pulse-border 0.6s ease-out;
}

/* ---- Loading Spinner ---- */
.loading-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner-sm {
    width: 20px;
    height: 20px;
    border: 2.5px solid #e2e8f0;
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

/* ---- Toast Notifications ---- */
.toast {
    pointer-events: auto;
    min-width: 320px;
    max-width: 420px;
    padding: 14px 18px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12), 0 2px 10px rgba(0, 0, 0, 0.06);
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-exit {
    animation: slideOutRight 0.3s ease-in forwards;
}

.toast-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
}

.toast-error {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
}

.toast-warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: white;
}

.toast-info {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    color: white;
}

.toast-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
}

.toast-close {
    flex-shrink: 0;
    margin-left: auto;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    background: none;
    border: none;
    color: inherit;
    padding: 4px;
}

.toast-close:hover {
    opacity: 1;
}

/* ---- Dashboard Cards ---- */
.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.stat-card.card-blue::before { background: linear-gradient(90deg, var(--primary-500), var(--primary-400)); }
.stat-card.card-green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card.card-red::before { background: linear-gradient(90deg, #ef4444, #f87171); }
.stat-card.card-purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.stat-card.card-amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.stat-card.card-blue .stat-icon { background: var(--primary-50); color: var(--primary-600); }
.stat-card.card-green .stat-icon { background: #ecfdf5; color: #059669; }
.stat-card.card-red .stat-icon { background: #fef2f2; color: #dc2626; }
.stat-card.card-purple .stat-icon { background: #f5f3ff; color: #7c3aed; }
.stat-card.card-amber .stat-icon { background: #fffbeb; color: #d97706; }

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---- Sidebar ---- */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary-900), var(--primary-950));
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 35;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    margin: 2px 12px;
    transition: all 0.2s;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar .nav-link.active i {
    color: var(--primary-300);
}

.sidebar .nav-section {
    padding: 0 20px;
    margin-top: 24px;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.35);
}

/* ---- Top Header ---- */
.top-header {
    height: 64px;
    background: white;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

/* ---- Main Content ---- */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    background: #f8fafc;
}

/* ---- Data Tables ---- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 14px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination button {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary-50);
    border-color: var(--primary-300);
    color: var(--primary-700);
}

.pagination button.active {
    background: var(--primary-600);
    border-color: var(--primary-600);
    color: white;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---- Badge ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-success { background: #ecfdf5; color: #059669; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-info { background: #f0f9ff; color: #0284c7; }
.badge-purple { background: #f5f3ff; color: #7c3aed; }

/* ---- Modal ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
    animation: fadeInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #94a3b8;
}

.empty-state i {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ---- Check In/Out Buttons ---- */
.checkin-btn {
    background: linear-gradient(135deg, #059669, #10b981);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkin-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
}

.checkin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.checkout-btn {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkout-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.5);
}

.checkout-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ---- Responsive ---- */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 767px) {
    .stat-card .stat-value {
        font-size: 24px;
    }

    .top-header {
        padding: 0 16px;
    }

    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-content {
        border-radius: 16px;
        margin: 8px;
    }
}

/* ---- Print Styles ---- */
@media print {
    .sidebar, .top-header, .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .stat-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }
}

/* ---- Confirmation Dialog ---- */
.confirm-dialog {
    text-align: center;
    padding: 32px 24px;
}

.confirm-dialog .confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.confirm-dialog .confirm-icon.danger {
    background: #fef2f2;
    color: #dc2626;
}

.confirm-dialog .confirm-icon.warning {
    background: #fffbeb;
    color: #d97706;
}

/* ---- Tab Styles ---- */
.tab-nav {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    width: fit-content;
}

.tab-nav button {
    padding: 8px 20px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-nav button.active {
    background: white;
    color: var(--primary-700);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tab-nav button:hover:not(.active) {
    color: #334155;
}

/* ---- Live Clock ---- */
.live-clock {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--primary-700);
}
