/* Portal Container */
.portal-container {
    min-height: 100vh;
    padding: 60px 20px;
    background: var(--gradient-primary);
    position: relative;
    overflow: hidden;
}

/* Gradient overlays for visual interest */
.portal-container::before,
.portal-container::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    z-index: 0;
}

.portal-container::before {
    top: -300px;
    right: -200px;
}

.portal-container::after {
    bottom: -300px;
    left: -200px;
}

/* Portal specific gradients */
.portal-container.pre-hslhs {
    background: var(--gradient-pre-hslhs);
}

.portal-container.hslhs-program {
    background: var(--gradient-hslhs-program);
}

.portal-container.post-hslhs {
    background: var(--gradient-post-hslhs);
}

/* Back link */
.portal-back-link {
    position: absolute;
    top: 25px;
    left: 25px;
    color: var(--light-text);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0.8;
    transition: var(--transition-fast);
    z-index: 10;
}

.portal-back-link:hover {
    opacity: 1;
    transform: translateX(-3px);
    color: var(--light-text);
}

.portal-back-link i {
    font-size: 12px;
}

/* Quick Navigation Menu Styles */
.quick-nav-menu {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 1000;
}

.quick-nav-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(13, 33, 161, 0.3);
    transition: var(--transition);
}

.quick-nav-toggle:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(13, 33, 161, 0.4);
}

.quick-nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 10px;
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-width: 300px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.quick-nav-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.quick-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.quick-nav-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.close-quick-nav {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    box-shadow: none;
}

.close-quick-nav:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: rotate(90deg);
}

.quick-nav-items {
    padding: 10px;
}

.quick-nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 8px;
    transition: var(--transition-fast);
    margin-bottom: 5px;
}

.quick-nav-item:hover {
    background: rgba(13, 33, 161, 0.05);
    transform: translateX(5px);
    color: var(--text-color);
}

.dark-theme .quick-nav-item:hover {
    background: rgba(51, 71, 196, 0.1);
}

.nav-item-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
}

.nav-item-icon.pre-hslhs {
    background: var(--gradient-primary);
}

.nav-item-icon.hslhs-program {
    background: var(--gradient-secondary);
}

.nav-item-icon.post-hslhs {
    background: var(--gradient-accent);
}

.nav-item-content {
    flex: 1;
}

.nav-item-content h5 {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.nav-item-content p {
    margin: 0;
    font-size: 13px;
    color: var(--muted-text);
}

.nav-item-arrow {
    font-size: 14px;
    color: var(--muted-text);
    transition: var(--transition-fast);
}

.quick-nav-item:hover .nav-item-arrow {
    color: var(--primary-color);
    transform: translateX(3px);
}

/* Section highlight animation */
.section-highlight {
    animation: sectionHighlight 2s ease-in-out;
}

@keyframes sectionHighlight {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(10px); background-color: rgba(13, 33, 161, 0.05); }
    75% { transform: translateX(10px); background-color: rgba(13, 33, 161, 0.05); }
}

/* Portal header */
.portal-header {
    text-align: center;
    margin-bottom: 30px;
    color: var(--light-text);
    position: relative;
    z-index: 1;
}

.portal-header h1 {
    font-size: 36px;
    margin-bottom: 15px;
    color: var(--light-text);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Main portal card */
.portal-card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 40px 30px;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: var(--shadow);
    position: relative;
    z-index: 1;
}

/* Form styling */
.form-container h2 {
    margin-bottom: 15px;
    color: var(--primary-color);
    text-align: center;
}

.form-container p {
    text-align: center;
    margin-bottom: 30px;
    color: var(--muted-text);
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
    position: relative;
}

/* Resources section styling */
.resources-section {
    margin-top: 40px;
}

.section-title { /* This class is used for main section titles within portal-phase-section AND for overall resources title if not in a phase-section */
    margin-bottom: 30px;
    color: var(--primary-color);
    font-size: 28px;
    text-align: center;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

/* ==== Search Functionality Styling ==== */
.search-container {
    padding: 20px;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    transition: var(--transition);
}

.search-box:focus-within {
    transform: translateY(-2px);
}

.search-box i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-size: 18px;
}

#resource-search {
    width: 100%;
    padding: 16px 50px 16px 50px;
    border-radius: 30px;
    border: 2px solid rgba(0, 0, 0, 0.05);
    background-color: var(--card-background);
    color: var(--text-color);
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: var(--transition-fast);
}

#resource-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 6px 20px rgba(4, 71, 171, 0.15);
}

.dark-theme #resource-search {
    border-color: rgba(255, 255, 255, 0.1);
    background-color: var(--card-background);
}

.clear-search {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    color: var(--muted-text);
    font-size: 16px;
    padding: 8px;
    box-shadow: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-search:hover {
    color: var(--primary-color);
    background: rgba(0, 0, 0, 0.05);
    transform: translateY(-50%);
    box-shadow: none;
}

.dark-theme .clear-search:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* No results message */
.no-results {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    margin: 40px auto;
    max-width: 500px;
}

.no-results-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.no-results i {
    font-size: 60px;
    color: var(--muted-text);
    opacity: 0.5;
}

.no-results h3 {
    margin: 0;
    font-size: 24px;
    color: var(--text-color);
}

.no-results p {
    color: var(--muted-text);
    margin: 10px 0 20px;
    max-width: 400px;
}

.reset-button {
    padding: 12px 25px;
    font-size: 14px;
    border-radius: 30px;
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.reset-button i {
    font-size: 14px;
}

.reset-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(4, 71, 171, 0.2);
}

/* Resources wrapper styling */
/* This will apply to #pre-hslhs-wrapper, #hslhs-program-wrapper, #post-hslhs-wrapper */
.resources-wrapper {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding-top: 10px; /* Added from inline style in previous portal.html */
}

/* Resource category styling */
.resource-category {
    background-color: var(--card-background); 
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
}

.resource-category.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.category-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.category-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.category-title i {
    font-size: 20px;
}

.category-toggle {
    background: transparent;
    color: white;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-fast);
    box-shadow: none;
    padding: 0;
}

.category-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: none;
    box-shadow: none;
}

/* Resources list styling */
.resources-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
    max-height: 1000px; /* Or remove if not needed, handled by category collapse */
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, padding 0.5s ease-in-out; /* Added padding transition */
}

.resources-list.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Resource item styling */
.resource-item {
    background-color: var(--card-background);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden; /* Important for ::before if item is not position:relative */
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    opacity: 0;
    transform: translateY(10px);
    position: relative; /* Added for ::before positioning context */
}

.dark-theme .resource-item {
    border-color: rgba(255, 255, 255, 0.05);
}

.resource-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.resource-item.animated {
    opacity: 1;
    transform: translateY(0);
}

.resource-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-primary); /* Default, overridden by type */
    opacity: 0.7;
    z-index: 1; /* Ensure it's above background but below content */
}

.resource-item.pdf::before {
    background: linear-gradient(to bottom, #e53935, #e35d5b);
}

.resource-item.doc::before {
    background: linear-gradient(to bottom, #0047AB, #0066CC);
}

.resource-item.spreadsheet::before {
    background: linear-gradient(to bottom, #43a047, #7cb342);
}

.resource-item.video::before {
    background: linear-gradient(to bottom, #e91e63, #f48fb1);
}

.resource-item.audio::before {
    background: linear-gradient(to bottom, #9c27b0, #ba68c8);
}

.resource-item.link::before {
    background: linear-gradient(to bottom, #D4AF37, #FFD700);
}

.resource-item.info::before {
    background: linear-gradient(to bottom, #00bcd4, #4dd0e1);
}

.resource-content {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    flex: 1;
    cursor: pointer;
    position: relative; /* Ensure content is above ::before */
    z-index: 2;
}

.resource-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background-color: rgba(var(--primary-color-rgb, 4, 71, 171), 0.05); /* Use RGB version if available */
    border-radius: var(--border-radius-sm);
    color: var(--primary-color);
}
.dark-theme .resource-icon {
    background-color: rgba(var(--dark-primary-color-rgb, 30, 144, 255), 0.1);
}


.resource-details {
    flex: 1;
    min-width: 0;
}

.resource-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

.resource-description {
    font-size: 14px;
    color: var(--muted-text);
    margin-bottom: 10px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.resource-type {
    font-size: 10px;
    padding: 3px 8px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    display: inline-block;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.dark-theme .resource-type {
    background-color: rgba(255, 255, 255, 0.08);
}

.resource-actions {
    display: flex;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    position: relative; /* Ensure actions are above ::before */
    z-index: 2;
    background-color: var(--card-background); /* Ensure it has a background */
}

.dark-theme .resource-actions {
    border-top-color: rgba(255, 255, 255, 0.05);
    background-color: var(--card-background);
}

.resource-actions button {
    flex: 1;
    background-color: transparent;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: none;
    color: var(--muted-text);
    border-radius: 0; /* Remove individual button radius if they are part of a bar */
}
/* Ensure first and last buttons have rounded corners if the container .resource-actions has rounded bottom corners */
.resource-item {
    /* ... existing styles ... */
    border-bottom-left-radius: var(--border-radius-sm);
    border-bottom-right-radius: var(--border-radius-sm);
}
.resource-actions button:first-child {
    border-bottom-left-radius: var(--border-radius-sm);
}
.resource-actions button:last-child {
    border-right: none;
    border-bottom-right-radius: var(--border-radius-sm);
}


.dark-theme .resource-actions button {
    border-right-color: rgba(255, 255, 255, 0.05);
}

.resource-actions button:hover {
    background-color: rgba(0, 0, 0, 0.02);
    color: var(--primary-color);
    transform: none;
    box-shadow: none;
}

.dark-theme .resource-actions button:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.download-btn i, /* These classes seem specific to buttons with icons */
.view-btn i,
.info-btn i,
.share-btn i {
    margin-right: 0; /* Removed default margin if icons are standalone in buttons */
}


/* Return button */
.return-button {
    text-align: center;
    margin-top: 40px;
}

.return-button a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(4, 71, 171, 0.2);
}

.return-button a:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(4, 71, 171, 0.3);
    color: white;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: rgba(4, 71, 171, 0.9); 
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    display: flex;
    align-items: center;
    opacity: 0; 
    transform: translateY(20px); 
    transition: opacity 0.3s ease, transform 0.3s ease; 
}

.dark-theme .toast { 
    background-color: rgba(30, 144, 255, 0.9);
}

.toast i { 
    margin-right: 10px;
}

/* Animation for resource items & general fade-in */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==== Portal Phase Section Styles (for stacked layout in portal.html) ==== */
.portal-phase-section {
    margin-bottom: 50px; 
    padding: 25px; /* Increased padding */
    /* Assuming --card-background is #fff and --dark-card-background is #1e1e1e (rgb(30,30,30)) */
    background-color: rgba(255, 255, 255, 0.85); /* More opaque for better readability */
    border-radius: var(--border-radius-lg);
    box-shadow: var(--card-shadow);
    border-top: 4px solid var(--primary-color); /* Add a top border accent */
    transition: var(--transition);
}

.portal-phase-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(13, 33, 161, 0.15);
}

.dark-theme .portal-phase-section {
     background-color: rgba(30, 30, 30, 0.85); /* More opaque for dark theme */
     border-top-color: var(--secondary-color);
}

/* Specific accent colors for different sections if desired */
#pre-hslhs-section {
    border-top-color: var(--gradient-pre-hslhs-start, var(--primary-color)); /* Define --gradient-pre-hslhs-start or fallback */
}
.dark-theme #pre-hslhs-section {
    border-top-color: var(--dark-gradient-pre-hslhs-start, var(--secondary-color));
}

#hslhs-program-section {
    border-top-color: var(--gradient-hslhs-program-start, var(--secondary-color)); /* Define or fallback */
}
.dark-theme #hslhs-program-section {
    border-top-color: var(--dark-gradient-hslhs-program-start, var(--accent-color));
}

#post-hslhs-section {
    border-top-color: var(--gradient-post-hslhs-start, var(--accent-color)); /* Define or fallback */
}
.dark-theme #post-hslhs-section {
    border-top-color: var(--dark-gradient-post-hslhs-start, var(--primary-color));
}


.portal-phase-section .section-title { /* Styles for titles within each phase section */
    text-align: left; 
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color); /* Thinner border for sub-section title */
    font-size: 1.75rem; /* Slightly smaller than main portal title but still prominent */
    color: var(--primary-color); /* Ensure it uses primary color */
    position: relative; /* Keep for ::after if used, but this one doesn't have it */
}
.portal-phase-section .section-title::after {
    content: none; /* Remove the centered underline from the generic .section-title */
}

.dark-theme .portal-phase-section .section-title {
     border-bottom-color: var(--secondary-color);
     color: var(--secondary-color);
}

/* Ensure there's no ::after for titles within .portal-phase-section if it inherits from a global .section-title */
.portal-phase-section .section-title::after {
    display: none;
}

/* Dark Theme Adjustments */
.dark-theme .quick-nav-dropdown {
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-theme .quick-nav-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* Media queries for responsive design */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0; /* Remove gap if they stack, or adjust margin on form-group */
        margin-bottom: 0; /* Adjust if form-group handles spacing */
    }
    .form-row .form-group {
        margin-bottom: 20px; /* Add margin back to individual groups when stacked */
    }
    .form-row .form-group:last-child {
        margin-bottom: 0; 
    }
    
    .resources-list {
        grid-template-columns: 1fr;
    }
    
    .portal-card {
        padding: 30px 20px;
    }
    
    .portal-header h1 {
        font-size: 28px;
    }
    
    /* Quick Navigation Mobile Styles */
    .quick-nav-menu {
        top: 60px;
        left: 15px;
        right: 15px;
    }
    
    .quick-nav-toggle {
        width: 100%;
        justify-content: center;
        padding: 15px;
        border-radius: 12px;
    }
    
    .quick-nav-dropdown {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        max-width: none;
        border-radius: 0;
        margin-top: 0;
        z-index: 10000;
    }
    
    .quick-nav-dropdown.active {
        transform: none;
    }
}

@media (max-width: 576px) {
    .portal-container {
        padding: 40px 15px;
    }
    
    .portal-back-link {
        top: 15px;
        left: 15px;
    }
    
    .resource-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .resource-icon {
        margin-bottom: 10px;
    }
    
    /* Quick Navigation Mobile Styles */
    .quick-nav-toggle span {
        display: none;
    }
}

@media (max-width: 480px) {
    .quick-nav-toggle {
        padding: 12px;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        justify-content: center;
    }
    
    .quick-nav-toggle span {
        display: none;
    }
    
    .nav-item-content h5 {
        font-size: 15px;
    }
    
    .nav-item-content p {
        font-size: 12px;
    }
}

/* Highlighted search text styles */
.highlighted { 
    background-color: rgba(var(--primary-color-rgb, 4, 71, 171), 0.15);
    color: var(--primary-color); 
    font-weight: bold; 
    padding: 0 2px; 
    border-radius: 3px; 
}

.dark-theme .highlighted { 
    background-color: rgba(var(--dark-primary-color-rgb, 30, 144, 255), 0.25);
}