/* =============================================================================
   PORTAL SHARED STYLES
   =============================================================================
   Standardized styles for ALL employee portal pages.
   Provides consistent headers, containers, buttons, skeletons, and empty states.

   NOTE: Uses CSS variables from modern-theme.css (:root) and animations
   (fadeInSafe, shimmerSlide) already defined there.
   ============================================================================= */

/* =============================================================================
   CONTAINERS
   ============================================================================= */

.portal-page-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px 16px 100px;
}

.portal-wide-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 16px 100px;
}

.portal-form-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px 16px 100px;
}

@media (min-width: 768px) {
    .portal-page-container,
    .portal-wide-container,
    .portal-form-container {
        padding: 24px 24px 48px;
    }
}

/* =============================================================================
   MOBILE HEADER (sticky top bar — d-md-none)
   ============================================================================= */

.portal-mobile-header {
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid rgba(0, 86, 179, 0.08);
    z-index: 1080;
    padding: 0;
    backdrop-filter: blur(10px);
}

.portal-mobile-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    min-height: 52px;
}

.portal-mobile-header-content h5 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--theme-text-main, #212529);
    letter-spacing: -0.02em;
}

/* --- Mobile Back Button --- */
.portal-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: var(--bs-primary, #0056b3);
    background: rgba(0, 86, 179, 0.08);
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
}

.portal-back-btn:hover {
    background: var(--bs-primary, #0056b3);
    color: white;
    transform: translateX(-2px);
}

.portal-back-btn i {
    font-size: 1.1rem;
}

/* --- Mobile New/Add Button --- */
.portal-new-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--bs-primary, #0056b3) 0%, #004494 100%);
    color: white;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
}

.portal-new-btn:hover {
    box-shadow: 0 4px 12px rgba(0, 86, 179, 0.35);
    transform: translateY(-1px);
    color: white;
}

.portal-new-btn i {
    font-size: 1rem;
}

/* --- Mobile Refresh Button --- */
.portal-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: var(--theme-text-muted, #6c757d);
    background: rgba(108, 117, 125, 0.08);
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
}

.portal-refresh-btn:hover {
    background: rgba(108, 117, 125, 0.15);
    color: var(--theme-text-main, #212529);
}

.portal-refresh-btn i {
    font-size: 1rem;
}

/* --- Mobile Calendar Button --- */
.portal-calendar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: var(--bs-primary, #0056b3);
    background: rgba(0, 86, 179, 0.08);
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
}

.portal-calendar-btn:hover {
    background: rgba(0, 86, 179, 0.15);
}

.portal-calendar-btn i {
    font-size: 1rem;
}

/* --- Mobile Stats Bar --- */
.portal-mobile-stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px 10px;
    gap: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    background: rgba(248, 249, 250, 0.5);
}

.portal-mobile-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    gap: 2px;
}

.portal-mobile-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
}

.portal-mobile-stat-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--theme-text-muted, #6c757d);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.portal-stat-divider {
    width: 1px;
    height: 28px;
    background: rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* --- Mobile Toggle Bar --- */
.portal-mobile-toggle-bar {
    display: flex;
    padding: 8px 16px 10px;
    gap: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    background: rgba(248, 249, 250, 0.5);
}

.portal-toggle-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--theme-text-muted, #6c757d);
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s ease;
}

.portal-toggle-item.active {
    background: rgba(0, 86, 179, 0.1);
    color: var(--bs-primary, #0056b3);
    border-color: rgba(0, 86, 179, 0.2);
    font-weight: 600;
}

.portal-toggle-badge {
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--bs-primary, #0056b3);
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* =============================================================================
   DESKTOP HEADER (d-none d-md-block)
   ============================================================================= */

.portal-desktop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.portal-desktop-header .portal-header-content {
    flex: 1 1 auto;
    min-width: 200px;
}

.portal-page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--theme-text-main, #212529);
    margin: 0 0 2px;
    display: flex;
    align-items: center;
    letter-spacing: -0.03em;
    line-height: 1.3;
    white-space: nowrap;
}

.portal-page-title i {
    font-size: 1.15rem;
    margin-right: 8px;
    flex-shrink: 0;
}

.portal-page-subtitle {
    font-size: 0.85rem;
    color: var(--theme-text-muted, #6c757d);
    margin: 0;
    font-weight: 400;
    white-space: nowrap;
}

/* --- Desktop Header Actions --- */
.portal-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

/* --- Desktop Stat Badges --- */
.portal-stats-badges {
    display: flex;
    gap: 6px;
}

.portal-stat-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 12px;
    border-radius: 10px;
    min-width: 54px;
}

.portal-stat-badge .badge-value {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.portal-stat-badge .badge-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.8;
}

.portal-stat-badge.pending {
    background: rgba(251, 192, 45, 0.1);
    color: #b8860b;
}

.portal-stat-badge.approved {
    background: rgba(25, 135, 84, 0.1);
    color: var(--bs-success, #198754);
}

.portal-stat-badge.total {
    background: rgba(0, 86, 179, 0.1);
    color: var(--bs-primary, #0056b3);
}

.portal-stat-badge.total-hrs {
    background: rgba(13, 202, 240, 0.1);
    color: #0aa2c0;
}

.portal-stat-badge.rejected {
    background: rgba(211, 47, 47, 0.1);
    color: var(--bs-danger, #d32f2f);
}

/* --- Desktop "New Request" Button --- */
.portal-btn-new {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--bs-primary, #0056b3) 0%, #004494 100%);
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 86, 179, 0.2);
}

.portal-btn-new:hover {
    box-shadow: 0 6px 20px rgba(0, 86, 179, 0.35);
    transform: translateY(-2px);
    color: white;
}

.portal-btn-new:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 86, 179, 0.2);
}

.portal-btn-new i {
    font-size: 0.9rem;
}

/* --- Desktop Refresh Button --- */
.portal-btn-refresh {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--theme-text-muted, #6c757d);
    background: rgba(108, 117, 125, 0.08);
    border: 1px solid rgba(108, 117, 125, 0.15);
    cursor: pointer;
    transition: all 0.2s ease;
}

.portal-btn-refresh:hover {
    background: rgba(108, 117, 125, 0.15);
    color: var(--theme-text-main, #212529);
}

/* --- Desktop Header Action Button (outline style) --- */
.portal-btn-header-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--bs-primary, #0056b3);
    background: transparent;
    border: 1px solid rgba(0, 86, 179, 0.25);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.portal-btn-header-action:hover {
    background: rgba(0, 86, 179, 0.05);
    border-color: var(--bs-primary, #0056b3);
    color: var(--bs-primary, #0056b3);
}

/* --- Desktop View Toggle --- */
.portal-view-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}

.portal-view-toggle .portal-toggle-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--theme-text-muted, #6c757d);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.portal-view-toggle .portal-toggle-btn.active {
    background: white;
    color: var(--bs-primary, #0056b3);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-weight: 600;
}

.portal-view-toggle .portal-toggle-btn .count-badge {
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--bs-primary, #0056b3);
    color: white;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* --- Desktop Year Navigation --- */
.portal-year-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-year-nav .year-label {
    font-size: 1rem;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
    color: var(--theme-text-main, #212529);
}

/* --- Desktop Back Link (for form pages) --- */
.portal-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--theme-text-muted, #6c757d);
    text-decoration: none;
    margin-bottom: 12px;
    padding: 6px 0;
    transition: color 0.2s ease;
}

.portal-back-link:hover {
    color: var(--bs-primary, #0056b3);
}

.portal-back-link i {
    font-size: 0.9rem;
    transition: transform 0.2s ease;
}

.portal-back-link:hover i {
    transform: translateX(-3px);
}

/* =============================================================================
   FILTERS
   ============================================================================= */

.portal-filters-card {
    background: white;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(0, 86, 179, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.portal-filters-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.portal-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--theme-text-muted, #6c757d);
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.portal-filter-btn:hover {
    background: rgba(0, 86, 179, 0.05);
    border-color: rgba(0, 86, 179, 0.2);
    color: var(--bs-primary, #0056b3);
}

.portal-filter-btn i.bi-chevron-down {
    font-size: 0.7rem;
    opacity: 0.6;
}

/* =============================================================================
   SKELETON LOADERS
   ============================================================================= */

.portal-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.portal-skeleton-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.portal-skeleton-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-skeleton-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #fafafa 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmerSlide 1.5s ease-in-out infinite;
    border-radius: 6px;
}

/* Common skeleton shapes */
.portal-skeleton-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    flex-shrink: 0;
}

.portal-skeleton-date {
    width: 48px;
    height: 52px;
    border-radius: 10px;
    flex-shrink: 0;
}

.portal-skeleton-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.portal-skeleton-title {
    height: 14px;
    width: 60%;
    border-radius: 4px;
}

.portal-skeleton-subtitle {
    height: 11px;
    width: 40%;
    border-radius: 4px;
}

.portal-skeleton-badge {
    width: 64px;
    height: 24px;
    border-radius: 6px;
    flex-shrink: 0;
}

.portal-skeleton-line {
    height: 12px;
    border-radius: 4px;
}

.portal-skeleton-line.w-75 { width: 75%; }
.portal-skeleton-line.w-50 { width: 50%; }
.portal-skeleton-line.w-25 { width: 25%; }

/* Skeleton for stat cards */
.portal-skeleton-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.portal-skeleton-stat {
    flex: 1;
    height: 64px;
    border-radius: 10px;
}

/* Skeleton for settings pages */
.portal-skeleton-section {
    padding: 20px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.portal-skeleton-toggle {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    flex-shrink: 0;
}

/* =============================================================================
   EMPTY STATE
   ============================================================================= */

.portal-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 48px 24px;
}

.portal-empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0, 86, 179, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.portal-empty-icon i {
    font-size: 1.75rem;
    color: var(--theme-text-muted, #6c757d);
    opacity: 0.5;
}

.portal-empty-state h5 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--theme-text-main, #212529);
    margin: 0 0 8px;
}

.portal-empty-state p {
    font-size: 0.9rem;
    color: var(--theme-text-muted, #6c757d);
    margin: 0 0 20px;
    max-width: 300px;
}

.portal-empty-state .portal-btn-new {
    font-size: 0.85rem;
    padding: 10px 24px;
}

/* =============================================================================
   FORM SUBMIT BUTTON
   ============================================================================= */

.portal-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--bs-primary, #0056b3) 0%, #004494 100%);
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 86, 179, 0.2);
    letter-spacing: 0.02em;
}

.portal-submit-btn:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(0, 86, 179, 0.35);
    transform: translateY(-1px);
}

.portal-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.portal-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.portal-submit-btn .spinner-border {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

/* =============================================================================
   LIST ITEMS (request cards, record cards)
   ============================================================================= */

.portal-list-item {
    background: white;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
}

.portal-list-item:hover {
    border-color: rgba(0, 86, 179, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.portal-list-item:active {
    transform: scale(0.995);
}

/* =============================================================================
   ALERT / INFO BANNERS
   ============================================================================= */

.portal-info-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.portal-info-banner.info {
    background: rgba(0, 86, 179, 0.06);
    color: var(--bs-primary, #0056b3);
    border: 1px solid rgba(0, 86, 179, 0.1);
}

.portal-info-banner.warning {
    background: rgba(251, 192, 45, 0.08);
    color: #856404;
    border: 1px solid rgba(251, 192, 45, 0.15);
}

.portal-info-banner.success {
    background: rgba(25, 135, 84, 0.06);
    color: var(--bs-success, #198754);
    border: 1px solid rgba(25, 135, 84, 0.1);
}

/* =============================================================================
   SECTION HEADERS (within page content)
   ============================================================================= */

.portal-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--theme-text-muted, #6c757d);
    margin: 20px 0 12px;
    padding: 0 4px;
}

/* =============================================================================
   RESPONSIVE UTILITIES
   ============================================================================= */

/* At container widths below ~600px effective, stack the header */
@media (max-width: 991.98px) {
    .portal-desktop-header {
        gap: 12px;
    }

    .portal-page-title {
        font-size: 1.2rem;
    }

    .portal-page-subtitle {
        font-size: 0.8rem;
    }

    .portal-stat-badge {
        padding: 5px 10px;
        min-width: 48px;
    }

    .portal-stat-badge .badge-value {
        font-size: 0.9rem;
    }

    .portal-stat-badge .badge-label {
        font-size: 0.55rem;
    }
}

@media (max-width: 575.98px) {
    .portal-desktop-header {
        flex-direction: column;
        align-items: stretch;
    }

    .portal-desktop-header .portal-header-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    .portal-stats-badges {
        justify-content: flex-start;
    }

    .portal-mobile-stat-value {
        font-size: 1rem;
    }

    .portal-page-title {
        font-size: 1.15rem;
    }
}

/* Hide on mobile / desktop helpers */
.portal-desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .portal-desktop-only {
        display: flex;
    }
    .portal-mobile-only {
        display: none !important;
    }
}
