/* Global CSS for Techage Primary Portal */
/* Color Scheme: Navy Blue (#001f3f), Orange (#FF6B35), White (#FFFFFF) */

:root {
    --primary-navy: #001f3f;
    --primary-orange: #FF6B35;
    --white: #FFFFFF;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #6c757d;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-gray);
    color: #333;
    line-height: 1.6;
}

/* Loading Overlay */
#loadingOverlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 31, 63, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

#loadingOverlay.show {
    display: flex !important;
}

.loader {
    border: 5px solid var(--white);
    border-top: 5px solid var(--primary-orange);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Brand Colors */
.bg-navy {
    background-color: var(--primary-navy) !important;
}

.bg-orange {
    background-color: var(--primary-orange) !important;
}

.text-navy {
    color: var(--primary-navy) !important;
}

.text-orange {
    color: var(--primary-orange) !important;
}

.btn-navy {
    background-color: var(--primary-navy);
    color: var(--white);
    border: none;
}

.btn-navy:hover {
    background-color: #003366;
    color: var(--white);
}

.btn-orange {
    background-color: var(--primary-orange);
    color: var(--white);
    border: none;
}

.btn-orange:hover {
    background-color: #e55a2b;
    color: var(--white);
}

.btn-outline-navy {
    background-color: transparent;
    color: var(--primary-navy);
    border: 1px solid var(--primary-navy);
}

.btn-outline-navy:hover {
    background-color: var(--primary-navy);
    color: var(--white);
}

/* Card Styles */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: var(--primary-navy);
    color: var(--white);
    border-radius: 10px 10px 0 0 !important;
    font-weight: 600;
    padding: 15px 20px;
}

/* Landing Page Portal Cards */
.portal-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-decoration: none;
}

.portal-card:hover {
    border-color: var(--primary-orange);
    transform: scale(1.05);
}

.portal-card .icon-wrapper {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    font-size: 3rem;
}

/* Sidebar Navigation */
.sidebar {
    min-height: 100vh;
    height: 100vh;
    background-color: var(--primary-navy);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(0);
    transition: transform 0.3s ease;
    will-change: transform;
}

.sidebar.collapsed {
    transform: translateX(-250px);
}

.sidebar .logo {
    flex-shrink: 0;
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Nav scrolls independently of the logo/header so long menus never
   push content off-screen or force the whole sidebar to reflow */
.sidebar nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 107, 53, 0.6) rgba(255, 255, 255, 0.05);
}

.sidebar nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.6);
    border-radius: 4px;
}

.sidebar nav::-webkit-scrollbar-thumb:hover {
    background: var(--primary-orange);
}

.sidebar .nav-link {
    color: var(--white);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, padding-left 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: rgba(255, 107, 53, 0.2);
    border-left-color: var(--primary-orange);
    padding-left: 25px;
}

.sidebar .nav-link i {
    margin-right: 10px;
    width: 20px;
}

/* Grouped/collapsible sidebar sections (admin sidebar) */
.sidebar .nav-group-toggle {
    color: rgba(255, 255, 255, 0.6);
    padding: 10px 20px 6px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
}

.sidebar .nav-group-toggle:hover {
    color: rgba(255, 255, 255, 0.9);
}

.sidebar .nav-group-toggle .chevron {
    transition: transform 0.2s ease;
    font-size: 0.7rem;
}

.sidebar .nav-group-toggle[aria-expanded="true"] .chevron {
    transform: rotate(90deg);
}

.sidebar .nav-group .nav-link {
    padding-left: 34px;
    font-size: 0.93rem;
}

.sidebar .nav-group .nav-link:hover,
.sidebar .nav-group .nav-link.active {
    padding-left: 39px;
}

/* Backdrop shown behind the sidebar on mobile/tablet while it's open */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1020;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Main Content Area */
.main-content {
    margin-left: 250px;
    padding: 20px;
    transition: margin-left 0.3s ease;
}

.main-content.expanded {
    margin-left: 0;
}

/* Top Navigation Bar */
.top-nav {
    background-color: var(--white);
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 10px;
    z-index: 900;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-navy);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.menu-toggle:hover {
    background-color: var(--light-gray);
}

/* Table Styles */
.table {
    background-color: var(--white);
    border-radius: 10px;
    overflow: hidden;
}

.table thead th {
    background-color: var(--primary-navy);
    color: var(--white);
    border: none;
    font-weight: 600;
    padding: 15px;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: var(--light-gray);
}

.table td {
    padding: 12px 15px;
    vertical-align: middle;
}

/* Badge Styles */
.badge {
    padding: 5px 10px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Form Styles */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 0.2rem rgba(255, 107, 53, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--primary-navy);
    margin-bottom: 5px;
}

/* Modal Styles */
.modal-header {
    background-color: var(--primary-navy);
    color: var(--white);
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Dashboard Statistics Cards */
.stat-card {
    border-left: 4px solid var(--primary-orange);
    padding: 20px;
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.7;
}

.stat-card .stat-icon-badge {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: currentColor;
    flex-shrink: 0;
}

.stat-card .stat-icon-badge i {
    color: var(--white);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-navy);
}

.stat-card .stat-label {
    color: var(--dark-gray);
    font-size: 0.9rem;
    text-transform: uppercase;
}

/* Quick Action tiles (dashboard) */
.quick-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 22px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--white);
    text-align: center;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quick-action-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    color: var(--white);
}

.quick-action-tile i {
    font-size: 1.8rem;
}

/* Parent portal color theme (moved out of a per-page inline <style> block) */
body.portal-parent .sidebar {
    background-color: #28a745;
}

body.portal-parent .sidebar .nav-link:hover,
body.portal-parent .sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    border-left-color: var(--white);
}

body.portal-parent .btn-parent {
    background-color: #28a745;
    color: var(--white);
    border: none;
}

body.portal-parent .btn-parent:hover {
    background-color: #218838;
    color: var(--white);
}

/* Alert Styles */
.alert {
    border-radius: 10px;
    border: none;
}

/* Action Buttons */
.action-btn {
    padding: 5px 10px;
    font-size: 0.85rem;
    margin: 0 2px;
}

/* Pagination */
.pagination {
    gap: 6px;
}

.pagination .page-link {
    color: var(--primary-navy);
    border: 1px solid var(--medium-gray);
    border-radius: 8px !important;
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    padding: 8px 14px;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-orange);
    border-color: var(--primary-orange);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
}

.pagination .page-link:hover {
    background-color: var(--light-gray);
    color: var(--primary-navy);
    border-color: var(--primary-navy);
    transform: translateY(-1px);
}

.pagination .page-item.active .page-link:hover {
    background-color: #e55a2b;
    color: var(--white);
    border-color: #e55a2b;
}

.pagination .page-item.disabled .page-link {
    color: var(--dark-gray);
    background-color: var(--light-gray);
    border-color: var(--medium-gray);
    cursor: not-allowed;
    transform: none;
}

/* Responsive Design - Mobile First */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-250px);
        box-shadow: none;
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    .main-content,
    .main-content.expanded {
        margin-left: 0;
    }

    .top-nav {
        position: static;
    }
}

@media (max-width: 768px) {
    .top-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        padding: 10px 12px;
        gap: 8px;
    }

    .top-nav h5 {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 40vw;
    }

    .top-nav .dropdown {
        flex-shrink: 0;
    }

    .top-nav .dropdown > .btn {
        padding: 6px 10px;
        font-size: 0.82rem;
        white-space: nowrap;
        max-width: 42vw;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-flex;
        align-items: center;
        gap: 4px;
    }

    .menu-toggle {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
        flex-shrink: 0;
    }

    .table {
        font-size: 0.85rem;
    }
    
    .table thead {
        display: none;
    }
    
    .table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid var(--medium-gray);
        border-radius: 10px;
    }
    
    .table td {
        display: flex;
        justify-content: space-between;
        padding: 10px;
        border: none;
        border-bottom: 1px solid var(--medium-gray);
    }
    
    .table td:last-child {
        border-bottom: none;
    }
    
    .table td::before {
        content: attr(data-label);
        font-weight: bold;
        color: var(--primary-navy);
    }
    
    .portal-card {
        margin-bottom: 20px;
    }
}

@media (max-width: 576px) {
    .stat-card {
        margin-bottom: 15px;
    }

    .btn {
        font-size: 0.85rem;
        padding: 8px 15px;
    }

    /* Card headers that pair a title with an action button (e.g. "+ Add Session")
       should stack instead of squeezing both into one cramped row */
    .card-header.d-flex {
        flex-wrap: wrap;
        gap: 8px;
    }

    .card-header.d-flex .btn {
        white-space: nowrap;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .sidebar-overlay,
    .top-nav,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-navy);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-orange);
}

/* Utility Classes */
.cursor-pointer {
    cursor: pointer;
}

.shadow-sm {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.shadow-md {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.shadow-lg {
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}