/* ==========================================
   Attendance & Payroll System Stylesheet
   ========================================== */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #3b82f6;
    --topbar-height: 60px;
    --primary: #3b82f6;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f1f5f9;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar-nav {
    flex: 1;
    padding: 15px 0;
    overflow-y: auto;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link i {
    width: 24px;
    margin-right: 10px;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
    font-weight: 600;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #fff;
}

.user-avatar { color: var(--sidebar-text); }

/* Profile Picture */
.sidebar-avatar-img{width:38px;height:38px;border-radius:50%;object-fit:cover;border:2px solid rgba(255,255,255,.3)}
.sidebar-avatar-placeholder{width:38px;height:38px;border-radius:50%;background:#3b82f6;color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:1rem;border:2px solid rgba(255,255,255,.3)}
.user-avatar-wrap{position:relative}
.avatar-edit-icon{position:absolute;bottom:-2px;right:-2px;width:18px;height:18px;background:#3b82f6;color:#fff;border-radius:50%;display:flex;align-items:center;justify-content:center;border:1.5px solid var(--sidebar-bg);opacity:1;transition:opacity .2s}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin 0.3s ease;
}

.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1050;
}

.topbar .dropdown-menu {
    z-index: 1060;
}

.sidebar-toggle {
    color: #475569;
    font-size: 1.2rem;
    display: none;
}

.server-time {
    font-size: 0.9rem;
    color: #475569;
    font-weight: 500;
}

.content-wrapper {
    max-width: 1400px;
}

/* Full width for chat pages */
.content-wrapper.full-width {
    max-width: 100%;
    padding: 0 !important;
}

/* ---- Dashboard Cards ---- */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 4px;
}

.stat-icon.bg-primary-light { background: #dbeafe; color: #3b82f6; }
.stat-icon.bg-success-light { background: #dcfce7; color: #22c55e; }
.stat-icon.bg-warning-light { background: #fef3c7; color: #f59e0b; }
.stat-icon.bg-danger-light { background: #fee2e2; color: #ef4444; }
.stat-icon.bg-info-light { background: #cffafe; color: #06b6d4; }

/* ---- Cards ---- */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    padding: 16px 20px;
    font-weight: 600;
    border-radius: 12px 12px 0 0 !important;
}

/* ---- Tables ---- */
.table-responsive { border-radius: 8px; }
.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}
.table td { vertical-align: middle; }

/* ---- Check-in Card ---- */
.checkin-card {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #fff;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
}

.checkin-card .time-display {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 2px;
}

.checkin-card .date-display {
    font-size: 1.1rem;
    opacity: 0.85;
}

.btn-checkin {
    background: #fff;
    color: #1d4ed8;
    border: none;
    padding: 12px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-checkin:hover {
    background: #f0f0f0;
    color: #1d4ed8;
    transform: scale(1.05);
}

.btn-checkout {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 2px solid #fff;
    padding: 12px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-checkout:hover {
    background: #fff;
    color: #1d4ed8;
}

/* ---- Login Page ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}

.login-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #fff;
    padding: 30px;
    text-align: center;
}

.login-body {
    padding: 30px;
}

/* ---- Badges ---- */
.badge { font-weight: 500; padding: 6px 12px; border-radius: 6px; font-size: 0.78rem; }

/* ---- Responsive ---- */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: block;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 576px) {
    .stat-card { padding: 16px; }
    .stat-card .stat-value { font-size: 1.4rem; }
    .checkin-card .time-display { font-size: 2rem; }
    .content-wrapper { padding: 15px !important; }
}

/* ---- Utility ---- */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.min-w-120 { min-width: 120px; }

/* ---- Print Styles ---- */
@media print {
    .sidebar, .topbar, .sidebar-toggle, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
    .content-wrapper { max-width: 100%; }
    body { background: #fff; }
}
