/* College Gallery Manager Frontend Styles */
.college-gallery-frontend {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: transparent; /* remove purple background */
    min-height: 0;
    padding: 0; /* remove outer padding so it blends with theme */
}

.college-gallery-container {
    display: grid;
    grid-template-columns: 220px 1fr; /* compact sidebar */
    min-height: 80vh;
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    overflow: hidden;
}

/* Header Styles */
.gallery-header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 8px 12px; /* very compact */
    text-align: center;
}
.gallery-header .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.sidebar-toggle {
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: none; /* shown on mobile */
}

.gallery-header h1 {
    margin: 0;
    font-size: 1.4rem; /* compact */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.gallery-header h1 i {
    color: #f1c40f;
}

.breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px; /* tighter */
    color: #ecf0f1;
    font-size: 0.9rem; /* compact */
    margin-top: 6px; /* compact */
    flex-wrap: wrap;
}

.breadcrumb a {
    color: #f1c40f;
    text-decoration: none;
    transition: color 0.2s;
    cursor: pointer;
}

.breadcrumb a:hover {
    color: #ffffff;
}

.breadcrumb span {
    color: #ffffff;
    font-weight: 600;
}

/* Sidebar Styles */
.gallery-sidebar {
    width: 100%;
    background: #34495e;
    color: white;
    padding: 10px 0; /* more compact */
    overflow-y: auto;
    border-right: 1px solid #4a6278;
}
.gallery-sidebar.sticky { position: sticky; top: 0; align-self: start; height: calc(100vh - 140px); }

.sidebar-section {
    margin-bottom: 8px; /* extra tight spacing between sections */
}

.sidebar-section h3 {
    padding: 0 12px 4px; /* tighter */
    font-size: 0.95rem !important; /* protect from theme overrides */
    color: #bdc3c7 !important; /* protect from theme overrides */
    border-bottom: 1px solid #4a6278;
    margin-bottom: 6px; /* tighter */
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.tree-item {
    padding: 0 15px;
}

.tree-toggle {
    padding: 6px 10px; /* very compact */
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-bottom: 3px;
    font-weight: 500;
}

.tree-toggle:hover {
    background: #3d566e;
    transform: translateX(5px);
}

.tree-toggle.active {
    background: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.tree-toggle i.fa-chevron-right {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    width: 12px;
}

.tree-toggle.active i.fa-chevron-right {
    transform: rotate(90deg);
}

.tree-toggle i.fa-folder, .tree-toggle i.fa-folder-open {
    color: #f1c40f;
}

.tree-children {
    padding-left: 25px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.tree-children.active {
    max-height: 2000px;
}

.event-item {
    padding: 6px 10px; /* very compact */
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px; /* more compact */
    font-weight: 500;
}

.event-item:hover {
    background: #3d566e;
    transform: translateX(5px);
}

.event-item.active {
    background: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.event-item i {
    font-size: 0.9rem;
    color: #f1c40f;
}

.quick-access {
    display: none;
}

.quick-access:hover {
    background: none;
    border-color: transparent;
}

.latest-events .event-item i {
    color: #f39c12;
}

/* Add offset between sections instead of inside years tree */
.gallery-sidebar .sidebar-section + .sidebar-section {
    margin-top: 10px; /* small gap between sections */
    padding-top: 10px;
    border-top: none; /* remove divider */
}

/* Main Content Styles */
.main-content {
    padding: 3px; /* compact */
    background: #f8f9fa;
    min-height: 600px;
}

.content-header {
    margin-bottom: 2px; /* ultra compact */
    padding-bottom: 4px; /* ultra compact */
    border-bottom: 1px solid #e9ecef; /* thinner */
    display: grid;
    grid-template-columns: 1fr auto; /* left title+desc, right date+crumbs */
    align-items: start;
    gap: 6px 12px; /* row gap, column gap */
}
/* compact header reverted */
.content-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px; /* ultra tight */
    margin-top: 2px; /* ultra tight */
    flex-wrap: wrap;
    font-size: 0.85rem; /* compact */
    line-height: 1.1; /* compact */
}
.content-breadcrumb a {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
}
.content-breadcrumb a:hover {
    text-decoration: underline;
}
.content-breadcrumb i {
    color: #adb5bd;
}

.content-header h2 {
    font-size: 1.05rem !important; /* smaller title, enforce over theme */
    color: #2c3e50;
    margin-bottom: 0; /* remove extra gap */
    display: flex;
    align-items: center;
    gap: 6px; /* tighter */
    line-height: 1.1; /* compact line height */
}
.content-title { font-size: 1.05rem !important; }
.content-header .header-left { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; }
.content-header .header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.content-header .content-meta { color: #6c757d; font-size: 0.9rem; margin: 0; line-height: 1.1; }
.content-header h2 i {
    font-size: 1rem; /* smaller icon */
}

.content-header p {
    color: #6c757d;
    font-size: 0.9rem; /* compact */
    margin: 0; /* no extra spacing */
    line-height: 1.1; /* tighter */
}
.content-header p.content-desc {
    color: #7a8692; /* slightly muted */
}

/* Mobile header dropdown controls (hidden by default) */
.mobile-control { display: none; }
.mobile-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 6px 8px;
    font-size: 0.8rem;
    color: #2c3e50;
    max-width: 220px;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%2399a1a8" height="16" viewBox="0 0 24 24" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px; /* room for caret */
    cursor: pointer;
}

/* Folder View Styles */
.folder-view {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns */
    gap: 16px; /* compact */
    padding: 0; /* remove extra gap below header */
    margin-top: 0; /* ensure tight to header */
}

.folder {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid #e9ecef;
}

.folder:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.folder-header {
    padding: 18px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.folder-header i {
    font-size: 1.3rem;
}

.folder-preview {
    height: 160px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 0; /* remove gaps to avoid white lines */
    padding: 0; /* remove padding to let images fully cover */
    background: transparent; /* no background showing through */
}

.folder-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.folder-preview img:hover {
    transform: scale(1.05);
}

.folder-info {
    padding: 15px;
    border-top: 1px solid #e9ecef;
}

.folder-info h3 {
    font-size: 1rem;
    margin-bottom: 6px;
    color: #2c3e50;
    font-weight: 600;
}

.folder-info p {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 0;
    font-weight: 500;
}

/* Images Grid Styles */
.images-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns */
    gap: 16px; /* compact */
    padding: 0; /* remove extra gap below header */
    margin-top: 15px; /* ensure tight to header */
}

.image-card {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    background: #000; /* prevent white edges during load */
    border: 0; /* remove border to eliminate white outline */
    aspect-ratio: 16 / 9; /* enforce 16:9 cover */
}

.image-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.image-card img {
    width: 100%;
    height: 100%; /* fill card area */
    object-fit: cover; /* crop to 16:9 */
    display: block;
    transition: transform 0.3s ease;
    border-radius: 12px; /* rounded images */
}

.image-card:hover img {
    transform: scale(1.05);
}

/* Remove captions in images grid */
.image-info { display: none; }

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

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-content img {
    max-width: 75vw; /* medium size */
    max-height: 75vh; /* medium size */
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    display: block;
    object-fit: contain; /* preserve image while centered */
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    padding: 0 20px;
}

.lightbox-nav button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.lightbox-nav button:hover {
    background: rgba(255,255,255,0.4);
    transform: scale(1.1);
}

.lightbox-close {
    position: absolute;
    top: 25px;
    right: 25px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    z-index: 10000;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.4);
    transform: scale(1.1);
}

.lightbox-counter {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    background: rgba(0,0,0,0.7);
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

/* Loading States */
.loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
    color: #6c757d;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #bdc3c7;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #495057;
}

.empty-state p {
    font-size: 1.1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 60px 20px;
    color: #dc3545;
    background: #f8d7da;
    border-radius: 8px;
    margin: 20px 0;
}

.error-state h3 {
    margin-bottom: 15px;
}

.error-state button {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 15px;
}

.error-state button:hover {
    background: #c82333;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .college-gallery-container { grid-template-columns: 1fr; margin: 0; max-width: none; border-radius: 0; box-shadow: none; }
    #gallery-sidebar { display: none; }
    .sidebar-toggle { display: inline-flex; }
    /* show mobile selects on tablet/phone */
    .mobile-control { display: inline-block; }
    .folder-view { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
    .images-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
}

@media (max-width: 768px) {
    .gallery-header h1 { font-size: 1.1rem; }
    .breadcrumb { font-size: 0.85rem; }
    .mobile-controls-row { display: flex; gap: 8px; width: 100%; align-items: center; }
    .mobile-controls-row .mobile-latest { flex: 1 1 auto; }
    .mobile-controls-row .mobile-years { flex: 1 1 auto; display: flex; justify-content: flex-end; }
    .mobile-select { width: 100%; max-width: none; }
    /* Single column layout for header and content on mobile */
    .content-header { display: block; }
    .content-header .header-left, .content-header .header-right { width: 100%; align-items: flex-start; text-align: left; }
    .content-header h2 { font-size: 1rem; }
    .content-header .content-meta { display: block; width: 100%; margin-top: 6px; }
    .content-breadcrumb { display: block; width: 100%; margin-top: 6px; }
    /* Single column for folder and images */
    .folder-view { grid-template-columns: 1fr !important; gap: 10px; }
    .images-grid { grid-template-columns: 1fr !important; gap: 10px; }
    
    .folder-header { padding: 10px; }
    .folder-preview { height: 150px; }
    
    .lightbox-nav button {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .lightbox-close {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    /* Ensure folder parts stack consistently on mobile: header -> preview -> info */
    .folder { display: grid; grid-template-areas: "header" "preview" "info"; }
    .folder-header { grid-area: header; }
    .folder-preview { grid-area: preview; }
    .folder-info { grid-area: info; background: #ffffff; }
    
    /* Mobile content header as a single card */
    .content-header {
        background: #ffffff;
        border: 1px solid #e9ecef;
        border-radius: 10px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
        padding: 12px;
        margin-bottom: 10px;
    }
    .content-header h2 { color: #2c3e50; }
    .content-header .content-desc { color: #6b7784; }
    .content-header .content-meta { color: #6c757d; }
    .content-breadcrumb { color: #6c757d; }
    .content-breadcrumb a { color: #3498db; }
}

@media (max-width: 480px) {
    .college-gallery-frontend {
        padding: 10px;
    }
    .mobile-controls-row { display: flex; gap: 6px; }
    .mobile-select { flex: 1 1 0; max-width: none; }
    .main-content { padding: 12px; }
    /* Keep single column with tighter gaps and smaller type */
    .content-header h2 { font-size: 0.95rem; }
    .content-header .content-desc { font-size: 0.85rem; }
    .content-header .content-meta { font-size: 0.85rem; }
    .content-breadcrumb { font-size: 0.85rem; }
    .folder-view { grid-template-columns: 1fr; gap: 8px; }
    .images-grid { grid-template-columns: 1fr; gap: 12px; margin-top: 10px; }
    
    .folder-preview { height: 140px; }
    
    .image-card img {
        height: 150px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in-left {
    animation: slideInLeft 0.4s ease-out;
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}