/* ==========================================
   Search Page Styles (Premium 3-Card Grid)
   ========================================== */
.search-results-grid-premium {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px; /* Compensate for card padding/margin */
}

.search-card-premium {
    background: #fff;
    border-radius: 20px;
    padding: 25px;
    margin: 15px; /* Explicit margin to prevent overlap */
    flex: 1 1 calc(33.333% - 30px); /* Strict 3-column layout */
    min-width: 300px;
    display: flex;
    flex-direction: column;
    min-height: 220px; /* Reduced height as requested */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f5f9;
    transition: all 0.4s ease;
    position: relative;
    box-sizing: border-box;
}

.search-card-premium:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(13, 33, 63, 0.1);
    border-color: var(--accent-color, #00A3FF);
}

/* Large Centered Icon for Media */
.search-card-media-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 60px;
    color: rgba(0, 0, 0, 0.03); /* Subtle background icon */
    z-index: 0;
    pointer-events: none;
}

.search-card-content, .search-card-type, .search-card-footer {
    position: relative;
    z-index: 1; /* Stay above the icon */
}

/* Dynamic Tag Colors */
.search-card-type {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 5px 14px;
    border-radius: 50px;
    margin-bottom: 15px;
    width: fit-content;
}

.search-card-type i {
    margin-right: 6px;
    font-size: 11px;
}

/* Default / Page */
.search-card-premium .search-card-type { background: rgba(0, 163, 255, 0.1); color: #00A3FF; }

/* Schools */
.type-schools .search-card-type { background: rgba(13, 33, 63, 0.1); color: #0d213f; }

/* News */
.type-ahis_news .search-card-type { background: rgba(34, 197, 94, 0.1); color: #16a34a; }

/* Notices */
.type-notices .search-card-type { background: rgba(249, 115, 22, 0.1); color: #ea580c; }

/* Articles */
.type-teacher_articles .search-card-type { background: rgba(168, 85, 247, 0.1); color: #9333ea; }

/* Gallery */
.type-ahis_image_gallery .search-card-type { background: rgba(236, 72, 153, 0.1); color: #db2777; }

/* Video */
.type-ahis_video_gallery .search-card-type { background: rgba(239, 68, 68, 0.1); color: #dc2626; }

.search-card-content {
    flex: 1;
}

.search-card-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 12px;
    font-family: var(--font-heading, 'Outfit', sans-serif);
    color: var(--primary-color, #0d213f);
    
    /* Title Truncation (Professional 1-Line Clamp) */
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;  
    overflow: hidden;
}

.search-card-title a {
    color: inherit;
    text-decoration: none;
}

.search-card-excerpt {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 20px;
    /* Excerpt Truncation */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;  
    overflow: hidden;
}

.search-card-footer {
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
}

.search-card-link {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-color, #0d213f);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Pagination Centering */
.nun-pagination {
    display: flex;
    justify-content: center;
    margin: 60px 0 100px;
    width: 100%;
}

.nun-pagination ul {
    display: flex;
    list-style: none;
    padding: 0;
    gap: 12px;
}

/* Responsive Grid */
@media (max-width: 1199px) {
    .search-card-premium {
        flex: 1 1 calc(50% - 30px);
    }
}

@media (max-width: 767px) {
    .search-card-premium {
        flex: 1 1 100%;
    }
}

/* No Results Recovery */
.no-search-results-premium {
    text-align: center;
    padding: 100px 40px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.03);
    max-width: 800px;
    margin: 0 auto 60px;
}

.no-results-visual {
    font-size: 70px;
    color: #e2e8f0;
    margin-bottom: 30px;
}

.search-recovery-box {
    margin-top: 40px;
    background: #f8fafc;
    padding: 40px;
    border-radius: 16px;
}

.recovery-search-form .search-input-group {
    display: flex;
    background: #fff;
    padding: 6px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    max-width: 500px;
    margin: 0 auto;
}

.recovery-search-form .search-field {
    flex: 1;
    border: none;
    padding: 0 25px;
    font-size: 15px;
    outline: none;
    background: transparent;
}

.recovery-search-form .search-submit {
    background: var(--primary-color, #0d213f);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.recovery-search-form .search-submit:hover {
    background: var(--accent-color, #00A3FF);
}

/* ==========================================
   404 Page Styles (Premium Redesign)
   ========================================== */
.error-wrapper-premium {
    text-align: center;
    padding: 80px 0;
    max-width: 800px;
    margin: 0 auto;
}

.error-visual-premium {
    position: relative;
    margin-bottom: 50px;
}

.error-main-icon {
    font-size: 120px;
    color: var(--primary-color, #0d213f);
    margin-bottom: -40px;
    position: relative;
    z-index: 2;
}

.error-number-overlay {
    font-size: 200px;
    font-weight: 900;
    color: var(--accent-color, #00A3FF);
    opacity: 0.06;
    letter-spacing: -10px;
    line-height: 1;
    user-select: none;
}

.error-title-premium {
    font-size: 48px;
    font-weight: 800;
    color: var(--primary-color, #0d213f);
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.error-message-premium {
    font-size: 18px;
    color: #64748b;
    margin-bottom: 45px;
    line-height: 1.8;
}

.error-actions-premium {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 60px;
}

.btn-premium-404 {
    background: var(--primary-color, #0d213f);
    color: #fff;
    padding: 18px 40px;
    border-radius: 50px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px rgba(13, 33, 63, 0.2);
}

.btn-premium-404:hover {
    background: var(--accent-color, #00A3FF);
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0, 163, 255, 0.3);
}

.btn-outline-404 {
    border: 2px solid var(--primary-color, #0d213f);
    color: var(--primary-color, #0d213f);
    padding: 16px 40px;
    border-radius: 50px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
}

.btn-outline-404:hover {
    background: var(--primary-color, #0d213f);
    color: #fff;
    transform: translateY(-4px);
}

.error-search-recovery {
    max-width: 500px;
    margin: 0 auto;
    padding-top: 40px;
    border-top: 1px solid #f1f5f9;
}

.error-search-recovery p {
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 20px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Responsive Grid */
@media (max-width: 1199px) {
    .search-results-grid-premium {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .search-results-grid-premium {
        grid-template-columns: 1fr;
    }
    .no-search-results-premium {
        padding: 60px 20px !important;
        margin: 0 15px 40px !important;
        border-radius: 15px !important;
    }
    .no-results-visual {
        font-size: 50px !important;
        margin-bottom: 15px !important;
    }
    .no-search-results-premium h2 {
        font-size: 24px !important;
    }
    .no-search-results-premium p {
        font-size: 14px !important;
    }
    .search-recovery-box {
        padding: 25px 15px !important;
        margin-top: 30px !important;
    }
    .recovery-search-form .search-input-group {
        flex-direction: column !important;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
        gap: 12px !important;
        padding: 0 !important;
    }
    .recovery-search-form .search-field {
        background: #fff !important;
        border: 1px solid #e2e8f0 !important;
        padding: 15px 20px !important;
        border-radius: 30px !important;
        width: 100% !important;
        height: 50px !important;
    }
    .recovery-search-form .search-submit {
        width: 100% !important;
        height: 50px !important;
        border-radius: 30px !important;
    }
    .error-title-premium {
        font-size: 32px;
    }
    .error-number-overlay {
        font-size: 120px;
    }
    .error-actions-premium {
        flex-direction: column;
    }
}

/* ==========================================
   Gallery Hub Styles
   ========================================== */
.gallery-hero-premium {
    padding: 10px 0 20px;
    background: transparent;
    text-align: center;
    margin-bottom: 30px;
}

.gallery-title-main {
    font-size: 48px;
    font-weight: 800;
    color: var(--primary-color, #0d213f);
    margin-bottom: 10px;
}

.gallery-subtitle-main {
    font-size: 18px;
    color: #64748b;
    margin-bottom: 40px;
}

.gallery-filters-wrapper {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.gallery-filter-btn {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.gallery-filter-btn:hover {
    border-color: var(--accent-color, #00A3FF);
    color: var(--accent-color, #00A3FF);
}

.gallery-filter-btn.active {
    background: var(--primary-color, #0d213f);
    color: #fff;
    border-color: var(--primary-color, #0d213f);
    box-shadow: 0 10px 20px rgba(13, 33, 63, 0.2);
}

.gallery-grid-premium {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 100px;
}

.gallery-item-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.4s ease;
}

.gallery-item-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.gallery-thumbnail-box {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #eee;
}

/* Album Preview Grid Mini */
.album-preview-grid-mini {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    width: 100%;
    height: 100%;
    gap: 2px;
}

.album-preview-grid-mini .mini-thumb {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.album-preview-grid-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.gallery-item-card:hover .gallery-img,
.gallery-item-card:hover .album-preview-grid-mini img {
    transform: scale(1.1);
}

.gallery-overlay-premium {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 33, 63, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item-card:hover .gallery-overlay-premium {
    opacity: 1;
}

.gallery-icon-circle {
    width: 60px;
    height: 60px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color, #0d213f);
    font-size: 20px;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.gallery-item-card:hover .gallery-icon-circle {
    transform: scale(1);
}

.gallery-badge-premium {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--accent-color, #00A3FF);
    color: #fff;
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gallery-content-box {
    padding: 25px;
}

.gallery-card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--primary-color, #0d213f);
}

.gallery-school-tag {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
}

/* ==========================================
   Single Video Page Styles
   ========================================== */
.ahis-single-video-page {
    padding-bottom: 100px;
}

.video-hero-premium {
    background: #000;
    padding: 40px 0;
    margin-bottom: 30px;
}

.video-player-wrapper {
    max-width: 1000px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
    background: #111;
}

.video-responsive-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
}

.video-responsive-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-meta-bar {
    display: flex;
    gap: 25px;
    margin-bottom: 20px;
    color: #94a3b8;
    font-weight: 600;
    font-size: 14px;
}

.video-single-title {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary-color, #0d213f);
    margin-bottom: 30px;
}

.video-description-content {
    font-size: 17px;
    line-height: 1.8;
    color: #475569;
    margin-bottom: 60px;
}

.related-videos-section {
    padding: 80px 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.related-videos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 30px;
}

.related-video-card h4 {
    margin-top: 15px;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color, #0d213f);
}

.related-thumb {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
}

.related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================
   Single Album Page Styles
   ========================================== */
.album-header-premium {
    padding: 40px 0 30px;
    background: transparent;
    border-bottom: 1px solid #f1f5f9;
}

.album-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    color: var(--accent-color, #00A3FF);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.album-title {
    font-size: 42px;
    font-weight: 800;
    color: var(--primary-color, #0d213f);
    margin-bottom: 20px;
}

.album-grid-section {
    padding: 60px 0 100px;
}

.album-grid-premium {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 60px;
}

.album-photo-item {
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.album-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.album-photo-item:hover img {
    transform: scale(1.1);
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 163, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: #fff;
    font-size: 24px;
}

.album-photo-item:hover .photo-overlay {
    opacity: 1;
}

/* Lightbox Styles */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    z-index: 10001;
}

.lightbox-prev, .lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: background 0.3s;
}

.lightbox-prev:hover, .lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev { left: 40px; }
.lightbox-next { right: 40px; }

/* Utilities */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1199px) {
    .gallery-grid-premium { grid-template-columns: repeat(3, 1fr); }
    .album-grid-premium { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
    .gallery-grid-premium { grid-template-columns: repeat(2, 1fr); }
    .album-grid-premium { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
    .gallery-grid-premium { grid-template-columns: 1fr; }
    .album-grid-premium { grid-template-columns: repeat(2, 1fr); }
    .gallery-filters-wrapper { flex-wrap: wrap; }
    .related-videos-grid { grid-template-columns: 1fr; }
    .lightbox-prev, .lightbox-next { width: 40px; height: 40px; }
    .lightbox-prev { left: 10px; }
    .lightbox-next { right: 10px; }
}

/* Gallery Banner Height Fix */
.ahis-gallery-page .page-hero,
.ahis-single-gallery-page .page-hero,
.ahis-single-video-page .page-hero {
    height: 300px !important;
    min-height: 300px !important;
    /* Recalculate center for shorter banner:
       center = padding-top + (300 - padding-top) / 2 */
    padding-top: 80px !important;
}

.ahis-gallery-page .breadcrumb-wrapper,
.ahis-single-gallery-page .breadcrumb-wrapper,
.ahis-single-video-page .breadcrumb-wrapper {
    margin-top: 0 !important;
}

/* ==========================================
   Page Left Sidebar — Hierarchical Nav
   (Matches Professional Reference Design)
   ========================================== */
.page-sidebar-nav {
    border: 1px solid #e2e8f0;
    overflow: hidden;
    background: #fff;
}

/* Navy / Theme-Color Header Box */
.page-sidebar-heading {
    background: var(--primary-color, #0d213f);
    padding: 18px 20px;
}

.page-sidebar-heading a {
    color: #fff !important;
    font-size: 16px;
    font-weight: 800;
    text-decoration: none !important;
    display: block;
    line-height: 1.3;
}

/* Row List */
.page-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.page-sidebar-item {
    border-bottom: 1px solid #f0f0f0;
}

.page-sidebar-item:last-child {
    border-bottom: none;
}

/* All items — default style (muted gray, regular weight) */
.page-sidebar-item a {
    display: block;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #94a3b8 !important;
    text-decoration: none !important;
    transition: color 0.2s ease, background 0.2s ease;
    line-height: 1.5;
}

.page-sidebar-item a:hover {
    color: var(--primary-color, #0d213f) !important;
    background: #f8fafc;
}

/* Active / Current page — bold dark text, no extra decoration */
.page-sidebar-item.current > a {
    color: var(--primary-color, #0d213f) !important;
    font-weight: 800;
    background: transparent;
}
