/* ============================================================
   Avian HRM — Custom Styles
   Built on Bootstrap 5.3 with sidebar layout
   ============================================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 60px;
    --primary: #4361ee;
    --primary-light: #e8ecfd;
    --secondary: #6c757d;
    --success: #2dc653;
    --warning: #f4a261;
    --danger: #e63946;
    --info: #48bfe3;
    --dark: #1d2d44;
    --body-bg: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #1d2d44;
    --text-muted: #6c757d;
    --border-color: #e2e8f0;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

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

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--dark);
    color: #fff;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width 0.25s ease, transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.02em;
}

.sidebar-brand-text {
    color: #fff;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
}

.sidebar-nav .nav {
    padding: 0 0.75rem;
}

.sidebar-nav .nav-item .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    color: rgba(255,255,255,0.65);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
    margin-bottom: 2px;
}

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

.sidebar-nav .nav-item .nav-link.active {
    color: #fff;
    background: var(--primary);
}

.sidebar-nav .nav-item .nav-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
}

.nav-section {
    padding: 0.75rem 0.75rem 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
    list-style: none;
}

.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.loyalty-badge {
    text-align: center;
    padding: 0.375rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}
.loyalty-1 { background: rgba(76,175,80,0.15); color: #66bb6a; }
.loyalty-2 { background: rgba(255,193,7,0.15); color: #ffc107; }
.loyalty-3 { background: rgba(255,215,0,0.2); color: #ffd700; }

/* ============================================================
   SIDEBAR COLLAPSED STATE (icon-only)
   ============================================================ */
.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .badge {
    display: none !important;
}
.sidebar.collapsed .sidebar-header {
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.5rem;
    gap: 0.25rem;
}
.sidebar.collapsed .sidebar-brand {
    justify-content: center;
}
.sidebar.collapsed .sidebar-header > .d-flex {
    justify-content: center;
}
.sidebar.collapsed .sidebar-header .sidebar-collapse-toggle.d-none {
    display: flex !important;
}
.sidebar.collapsed .sidebar-collapse-toggle {
    display: flex !important;
}
.sidebar.collapsed .sidebar-nav .nav {
    padding: 0 0.35rem;
}
.sidebar.collapsed .sidebar-nav .nav-item .nav-link {
    justify-content: center;
    padding: 0.6rem;
    gap: 0;
}
.sidebar.collapsed .sidebar-nav .nav-item .nav-link i {
    font-size: 1.2rem;
    width: auto;
}
.sidebar.collapsed .sidebar-collapse-toggle i::before {
    content: "\F504";
}
.sidebar-collapse-toggle {
    color: rgba(255,255,255,0.6);
    border: none;
    padding: 4px 6px;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.sidebar-collapse-toggle:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin 0.3s ease;
}
.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

.top-navbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1020;
}

.page-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-search .form-control {
    width: 250px;
    border-radius: 0.5rem;
    font-size: 0.85rem;
}
.nav-search .input-group-text {
    border-radius: 0.5rem 0 0 0.5rem;
    color: var(--text-muted);
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    color: var(--text-muted);
    background: transparent;
}
.btn-icon:hover { background: var(--body-bg); }

.page-content {
    padding: 1.5rem;
}

/* ============================================================
   AVATAR
   ============================================================ */
.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-md {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.8rem;
}

.avatar-placeholder.avatar-md { font-size: 1rem; }
.avatar-placeholder.avatar-lg { font-size: 1.5rem; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    background: var(--card-bg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.95rem;
}

.stat-card {
    position: relative;
    overflow: hidden;
}
.stat-card .stat-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    opacity: 0.1;
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}
.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

/* ============================================================
   TABLES
   ============================================================ */
.table { font-size: 0.875rem; }
.table th {
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    border-bottom-width: 2px;
}
.table td { vertical-align: middle; }

/* ============================================================
   BADGES & STATUS
   ============================================================ */
.badge-dot {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8rem;
    font-weight: 500;
}
.badge-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.badge-dot.present::before { background: var(--success); }
.badge-dot.late::before { background: var(--warning); }
.badge-dot.absent::before { background: var(--danger); }
.badge-dot.on_leave::before { background: var(--info); }
.badge-dot.holiday::before { background: var(--secondary); }

.status-badge {
    padding: 0.25em 0.625em;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ============================================================
   PROGRESS BARS & METERS
   ============================================================ */
.bonus-meter {
    height: 8px;
    border-radius: 4px;
    background: #e9ecef;
    overflow: hidden;
}
.bonus-meter-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}
.bonus-meter-daily { background: linear-gradient(90deg, var(--primary), #6c8cff); }
.bonus-meter-weekly { background: linear-gradient(90deg, var(--success), #6ee7b7); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark) 0%, #3c5a99 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand i {
    font-size: 2.5rem;
    color: var(--primary);
}

.login-brand h2 {
    font-weight: 700;
    margin-top: 0.75rem;
    font-size: 1.5rem;
}

.login-brand p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================================
   ORG CHART — styles moved to org_chart.html template
   ============================================================ */

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1039;
        display: none;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

/* ============================================================
   UTILITY
   ============================================================ */
.fs-7 { font-size: 0.85rem !important; }
.fs-8 { font-size: 0.75rem !important; }
.text-primary { color: var(--primary) !important; }
.bg-primary-light { background: var(--primary-light) !important; }
.border-dashed { border-style: dashed !important; }

/* Smooth transitions for HTMX */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-settling { opacity: 0.8; }

/* ============================================================
   DASHBOARD WIDGETS (BambooHR-Inspired)
   ============================================================ */

/* Widget Card — slightly elevated, warm feel */
.widget-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    height: 100%;
    transition: box-shadow 0.2s ease;
}
.widget-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
.widget-card .widget-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Greeting section */
.dash-greeting {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

/* Action icons for What's Happening feed */
.action-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}
.action-icon.bg-primary-subtle { background: rgba(67, 97, 238, 0.12); color: var(--primary); }
.action-icon.bg-success-subtle { background: rgba(45, 198, 83, 0.12); color: var(--success); }
.action-icon.bg-warning-subtle { background: rgba(244, 162, 97, 0.12); color: var(--warning); }
.action-icon.bg-danger-subtle { background: rgba(230, 57, 70, 0.12); color: var(--danger); }
.action-icon.bg-info-subtle { background: rgba(72, 191, 227, 0.12); color: var(--info); }

/* Celebration icons */
.celebration-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff3e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Quick Link Buttons grid */
.quick-link-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    background: var(--body-bg);
    transition: all 0.15s ease;
    font-size: 0.8rem;
    font-weight: 500;
}
.quick-link-btn i {
    font-size: 1.4rem;
    color: var(--primary);
}
.quick-link-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translateY(-2px);
}

/* Leave Balance Pill Bars */
.leave-balance-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--body-bg);
    overflow: hidden;
}
.leave-balance-bar .bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

/* Notification dot (unread) */
.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

/* Holiday date badge */
.holiday-date-badge {
    min-width: 42px;
    text-align: center;
    background: var(--body-bg);
    border-radius: 0.5rem;
    padding: 0.25rem 0.5rem;
}
.holiday-date-badge .month {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1;
}
.holiday-date-badge .day {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

/* Stat values for "This Month" widget */
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Empty state helper */
.empty-state {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}
