/* ============================================================
   Employee Attendance Portal — Premium Shared Stylesheet v2
   Theme: Navy / White (Admin: blue accents, Employee: green)
   Fully responsive: 320px -> 4K | Off-canvas sidebar on mobile
   ============================================================ */

:root {
    --primary: #0d6efd;
    --primary-dark: #0a4fb5;
    --success: #1a8a3e;
    --success-dark: #0f5f28;
    --danger: #c0392b;
    --warning: #b5760a;
    --purple: #7f3fbf;
    --navy: #0d1b2a;
    --navy-2: #1e3a5f;
    --bg: #f4f6f9;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-muted: #6b7280;
    --border: #e8ecf1;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 6px 18px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 20px 60px rgba(13, 27, 42, 0.30);
    --sidebar-w: 250px;
    --font: 'Inter', 'Segoe UI', Arial, sans-serif;
}

* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    font-family: var(--font);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

/* ---------- Subtle page entrance animation ---------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.main-content > * { animation: fadeUp 0.35s ease both; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ============================================================
   LOGIN / AUTH PAGES
   ============================================================ */
.login-wrapper {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(1000px 500px at 85% -10%, rgba(13,110,253,0.25), transparent 60%),
        linear-gradient(135deg, #1e3a5f 0%, #0d1b2a 100%);
    padding: 16px;
}
.login-card {
    background: var(--card-bg);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-width: 900px;
    width: 100%;
    animation: fadeUp 0.4s ease both;
}
.login-left {
    color: #fff;
    padding: 50px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}
.login-left.admin-theme { background: linear-gradient(160deg, #0d6efd 0%, #0a4fb5 100%); }
.login-left.employee-theme { background: linear-gradient(160deg, #1a8a3e 0%, #0f5f28 100%); }
.login-left i.main-icon { font-size: 3rem; margin-bottom: 20px; }
.login-right { padding: 50px 40px; }

/* Compact single-column auth card (forgot/reset password) */
.auth-card {
    background: var(--card-bg);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 42px 38px;
    max-width: 440px;
    width: 100%;
    animation: fadeUp 0.4s ease both;
}
.auth-icon {
    width: 64px; height: 64px; border-radius: 18px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; color: #fff; margin: 0 auto 20px;
}
.auth-icon.admin-theme { background: linear-gradient(160deg, #0d6efd, #0a4fb5); }

.feature-item { display: flex; align-items: center; margin-bottom: 14px; font-size: 0.95rem; }
.feature-item i {
    font-size: 1rem; margin-right: 10px; background: rgba(255,255,255,0.15);
    padding: 8px; border-radius: 50%; width: 34px; height: 34px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}

.btn-login {
    padding: 12px; border-radius: 10px; font-weight: 600; border: none; color: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    min-height: 46px;
}
.btn-login:active { transform: scale(0.98); }
.btn-login.admin-theme { background: linear-gradient(135deg, #0d6efd, #0a58ca); }
.btn-login.admin-theme:hover { background: #0a58ca; color: #fff; box-shadow: 0 8px 20px rgba(13,110,253,0.35); }
.btn-login.employee-theme { background: linear-gradient(135deg, #1a8a3e, #14702f); }
.btn-login.employee-theme:hover { background: #14702f; color: #fff; box-shadow: 0 8px 20px rgba(26,138,62,0.35); }

.back-link { color: #888; font-size: 0.85rem; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 20px; }
.back-link:hover { color: #444; }

.error-box {
    background: #fdeaea; color: #c0392b; padding: 12px 14px; border-radius: 10px;
    font-size: 0.88rem; margin-bottom: 16px; border: 1px solid #f6cfcb;
    animation: fadeUp 0.3s ease both;
}
.success-box {
    background: #e7f6ec; color: #1a8a3e; padding: 12px 14px; border-radius: 10px;
    font-size: 0.88rem; margin-bottom: 16px; border: 1px solid #c9ecd5;
    animation: fadeUp 0.3s ease both;
}

/* Password field with eye toggle */
.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 44px; }
.password-toggle {
    position: absolute; top: 0; right: 0; height: 100%; width: 44px;
    border: none; background: transparent; color: #9aa3af; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 0.95rem;
}
.password-toggle:hover { color: var(--text); }

/* ============================================================
   HOME / ROLE SELECT
   ============================================================ */
.home-wrapper {
    min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
    background:
        radial-gradient(1000px 500px at 85% -10%, rgba(13,110,253,0.25), transparent 60%),
        linear-gradient(135deg, #1e3a5f 0%, #0d1b2a 100%);
}
.top-brand { padding: 24px 40px; color: #fff; display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.05rem; letter-spacing: 2px; }
.top-brand-logo { width: 32px; height: auto; }
.hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center; }
.hero-logo { width: 96px; height: auto; margin-bottom: 18px; filter: drop-shadow(0 8px 24px rgba(0,0,0,0.45)); animation: fadeUp 0.5s ease both; }
.hero h1 {
    color: #fff; font-family: 'Playfair Display', Georgia, serif;
    font-weight: 800; letter-spacing: 4px; font-size: clamp(1.4rem, 4vw, 2.3rem);
    margin-bottom: 4px;
}
.hero-tagline {
    color: #8fb3dd !important; font-size: 0.8rem; letter-spacing: 4px;
    text-transform: uppercase; font-weight: 600; margin-bottom: 10px !important;
}
.hero p { color: rgba(255,255,255,0.7); margin-bottom: 40px; }
.choice-row { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; width: 100%; }
.choice-card {
    background: #fff; border-radius: 16px; padding: 40px 36px; width: 260px; max-width: 100%;
    text-decoration: none; box-shadow: 0 15px 40px rgba(0,0,0,0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease; display: block;
}
.choice-card:hover { transform: translateY(-6px); box-shadow: 0 20px 50px rgba(0,0,0,0.35); }
.choice-icon { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #fff; margin: 0 auto 18px; }
.choice-card h5 { font-weight: 700; color: #222; margin-bottom: 6px; }
.choice-card p { color: #888; font-size: 0.88rem; margin-bottom: 0; }
.footer-text { text-align: center; color: rgba(255,255,255,0.5); font-size: 0.82rem; padding: 20px; }

/* ============================================================
   SIDEBAR LAYOUT (Admin + Employee dashboards)
   ============================================================ */
.sidebar {
    background: linear-gradient(180deg, #10233a 0%, #0d1b2a 100%);
    min-height: 100vh; color: #fff; padding-top: 20px;
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w); z-index: 1040;
    overflow-y: auto;
    transition: transform 0.28s ease;
}
.sidebar .brand {
    padding: 4px 20px 16px;
    display: flex; align-items: center; gap: 12px;
}
.sidebar .brand-logo {
    width: 44px; height: auto; flex-shrink: 0;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}
.sidebar .brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.sidebar .brand-name {
    font-weight: 800; font-size: 1.02rem; letter-spacing: 2px; color: #fff;
}
.sidebar .brand-sub {
    font-weight: 500; font-size: 0.62rem; letter-spacing: 3.2px; color: #8fb3dd;
}
.sidebar .brand-role {
    margin: 0 20px 14px; padding: 5px 12px;
    background: rgba(13,110,253,0.18); color: #9cc4f5;
    border: 1px solid rgba(13,110,253,0.3);
    border-radius: 20px; font-size: 0.68rem; font-weight: 700;
    letter-spacing: 1.5px; text-transform: uppercase; text-align: center;
    border-bottom: none;
}
.sidebar .brand-role-emp {
    background: rgba(26,138,62,0.18); color: #8fd8a8;
    border-color: rgba(26,138,62,0.35);
}
.mobile-header .m-brand-logo { width: 26px; height: auto; }
.sidebar a {
    display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,0.72);
    text-decoration: none; padding: 13px 20px; font-size: 0.92rem;
    border-left: 3px solid transparent;
    transition: background 0.15s ease, color 0.15s ease;
    min-height: 46px; /* touch friendly */
}
.sidebar a i { width: 18px; text-align: center; }
.sidebar a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar a.active { background: rgba(13,110,253,0.16); color: #fff; border-left-color: var(--primary); }

/* Sidebar close button (mobile only) */
.sidebar-close {
    display: none; position: absolute; top: 14px; right: 14px;
    background: rgba(255,255,255,0.08); border: none; color: #fff;
    width: 36px; height: 36px; border-radius: 10px; font-size: 1rem;
}

/* Dark overlay behind off-canvas sidebar */
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(13,27,42,0.55);
    z-index: 1035; backdrop-filter: blur(2px);
}
body.sidebar-open .sidebar-overlay { display: block; }

/* Mobile top header (hamburger) */
.mobile-header {
    display: none; position: sticky; top: 0; z-index: 1030;
    background: var(--navy); color: #fff; padding: 12px 16px;
    align-items: center; justify-content: space-between;
    box-shadow: var(--shadow-md);
}
.mobile-header .m-brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.hamburger-btn {
    background: rgba(255,255,255,0.1); border: none; color: #fff;
    width: 42px; height: 42px; border-radius: 10px; font-size: 1.05rem;
}

.main-content { margin-left: var(--sidebar-w); padding: 24px 30px; min-width: 0; }

.topbar {
    background: var(--card-bg); border-radius: var(--radius-sm); padding: 16px 20px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px; flex-wrap: wrap; gap: 10px;
}

/* ============================================================
   CARDS / WIDGETS
   ============================================================ */
.stat-card {
    background: var(--card-bg); border-radius: var(--radius); padding: 22px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border); height: 100%;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center;
    justify-content: center; font-size: 1.2rem; color: #fff; margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}
.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.stat-label { color: var(--text-muted); font-size: 0.84rem; }

.card-section {
    background: var(--card-bg); border-radius: var(--radius); padding: 22px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
}

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 34px 16px; color: var(--text-muted); }
.empty-state i { font-size: 2rem; opacity: 0.35; display: block; margin-bottom: 10px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge-present  { background: #e7f6ec; color: #1a8a3e; }
.badge-late     { background: #fdf1e0; color: #b5760a; }
.badge-halfday  { background: #e0edfd; color: #0d6efd; }
.badge-leave    { background: #fdf1e0; color: #b5760a; }
.badge-absent   { background: #fdeaea; color: #c0392b; }
.badge-draft    { background: #eeeeee; color: #666666; }
.badge-sent     { background: #e0edfd; color: #0d6efd; }
.badge-accepted { background: #e7f6ec; color: #1a8a3e; }
.badge-joined   { background: #f0e6fb; color: #7f3fbf; }
.badge-rejected { background: #fdeaea; color: #c0392b; }

.badge[class*="badge-"] { border-radius: 20px; font-weight: 600; }

/* ============================================================
   BUTTONS & INPUTS
   ============================================================ */
.btn-add {
    background: linear-gradient(135deg, #0d6efd, #0a58ca); color: #fff; border: none;
    padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 0.9rem;
    transition: box-shadow 0.15s ease, transform 0.15s ease; min-height: 42px;
}
.btn-add:hover { color: #fff; box-shadow: 0 6px 16px rgba(13,110,253,0.35); }
.btn-add:active { transform: scale(0.98); }

.form-control, .form-select {
    padding: 10px 14px; border-radius: 10px; border: 1.5px solid #dfe4ea;
    font-size: 0.92rem; min-height: 44px; /* touch friendly */
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.12);
}
.form-label { font-weight: 500; font-size: 0.88rem; color: #333; }

/* Loading button spinner (js-loading-btn) */
.btn .btn-spinner {
    display: inline-block; width: 1em; height: 1em; border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff; border-radius: 50%; margin-right: 8px; vertical-align: -0.15em;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #eef1f5 25%, #f7f9fb 50%, #eef1f5 75%);
    background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive { border-radius: var(--radius-sm); -webkit-overflow-scrolling: touch; }
table th {
    font-size: 0.76rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.4px; border-bottom: 2px solid #eef1f5; white-space: nowrap;
}
table td { vertical-align: middle; font-size: 0.9rem; }
.table tbody tr { transition: background 0.12s ease; }
.table tbody tr:hover { background: #f8fafc; }

.action-icon {
    width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center;
    justify-content: center; color: #555; background: #f4f6f9; margin-right: 4px; font-size: 0.85rem;
    text-decoration: none; border: none; transition: background 0.15s ease, color 0.15s ease;
}
.action-icon:hover { background: #e6e9ee; color: #222; }

.search-box {
    border-radius: 10px; border: 1.5px solid #dfe4ea; padding: 9px 14px;
    font-size: 0.88rem; width: 240px; max-width: 100%; min-height: 44px;
}
.search-box:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.12); }

/* ============================================================
   MODALS & ALERTS & TOASTS
   ============================================================ */
.modal-content { border-radius: 16px; border: none; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }

.alert { border-radius: 12px; border: 1px solid transparent; animation: fadeUp 0.3s ease both; }
.alert-success { background: #e7f6ec; color: #14702f; border-color: #c9ecd5; }
.alert-danger  { background: #fdeaea; color: #a93226; border-color: #f6cfcb; }

.toast-stack {
    position: fixed; top: 16px; right: 16px; z-index: 2000;
    display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 32px));
}
.app-toast {
    background: #fff; border-radius: 12px; box-shadow: var(--shadow-md);
    border: 1px solid var(--border); padding: 12px 16px; font-size: 0.88rem;
    display: flex; align-items: flex-start; gap: 10px; animation: fadeUp 0.3s ease both;
}
.app-toast.toast-success { border-left: 4px solid var(--success); }
.app-toast.toast-error   { border-left: 4px solid var(--danger); }

/* ============================================================
   ACCESSIBILITY
   ============================================================ */
a:focus-visible, button:focus-visible, .form-control:focus-visible, .form-select:focus-visible {
    outline: 3px solid rgba(13,110,253,0.45); outline-offset: 2px;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Tablets & below: off-canvas sidebar */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-105%);
        box-shadow: none;
        width: min(300px, 84vw);
    }
    body.sidebar-open .sidebar { transform: translateX(0); box-shadow: 12px 0 40px rgba(0,0,0,0.35); }
    body.sidebar-open { overflow: hidden; }
    .sidebar-close { display: flex; align-items: center; justify-content: center; }
    .mobile-header { display: flex; }
    .main-content { margin-left: 0; padding: 16px; }
    .topbar { padding: 14px 16px; }
}

/* Phones */
@media (max-width: 575.98px) {
    .main-content { padding: 12px; }
    .stat-value { font-size: 1.4rem; }
    .login-right, .login-left { padding: 32px 24px; }
    .auth-card { padding: 32px 22px; }
    .hero h1 { font-size: 1.5rem; }
    .top-brand { padding: 18px 20px; }
    .choice-card { width: 100%; padding: 30px 24px; }
    .search-box { width: 100%; }
    .modal-dialog { margin: 10px; }
    .btn-add, .btn-login { width: 100%; }
    .topbar .d-flex.gap-3 { gap: 0.5rem !important; }
}

/* Very small phones (320px) */
@media (max-width: 360px) {
    .stat-card { padding: 16px; }
    .card-section { padding: 16px; }
    body { font-size: 0.94rem; }
}

/* Login card: stack columns on small screens */
@media (max-width: 767.98px) {
    .login-card .row { flex-direction: column; }
    .login-left { padding: 28px 24px; }
    .login-left .feature-item:nth-child(n+6) { display: none; } /* compact on mobile */
}

/* ============================================================
   PRINT (payslips / offer letters / reports via browser print)
   ============================================================ */
@media print {
    .sidebar, .topbar, .mobile-header, .sidebar-overlay, .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    body { background: #fff; }
    .card-section, .stat-card { box-shadow: none; border: none; }
}

/* ============================================================
   BRANDING v3 — Login logo, Payroll summary cards, Step flow
   ============================================================ */

/* Login page logo (left panel) */
.login-logo {
    width: 72px; height: auto; margin-bottom: 18px;
    filter: drop-shadow(0 4px 14px rgba(0,0,0,0.35));
}
.login-left h3 { letter-spacing: 1.5px; font-size: 1.15rem; }

/* Ultra Simple Payroll — summary cards */
.payroll-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.p-sum-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    display: flex; align-items: center; gap: 14px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.p-sum-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.p-sum-icon {
    width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
}
.p-sum-value { font-weight: 800; font-size: 1.25rem; line-height: 1.2; }
.p-sum-label { color: var(--text-muted); font-size: 0.78rem; }

/* Step flow labels */
.step-label {
    font-weight: 700; font-size: 0.85rem; color: var(--text);
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.step-num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--primary); color: #fff;
    font-size: 0.72rem; font-weight: 800;
}

@media (max-width: 768px) {
    .payroll-summary { grid-template-columns: 1fr; }
    .hero-logo { width: 78px; }
    .login-logo { width: 58px; }
}

/* ---------- SAFETY: logo images can NEVER exceed these sizes ---------- */
img.m-brand-logo { width: 26px !important; height: auto !important; }
img.brand-logo   { width: 44px !important; height: auto !important; }
img.hero-logo    { width: 96px !important; height: auto !important; }
img.top-brand-logo { width: 32px !important; height: auto !important; }
img.login-logo   { width: 72px !important; height: auto !important; }
