/**
 * JavaScript Component Styles
 * 
 * @package School_Theme
 */

/* ==========================================================================
   LIGHTBOX STYLES
   ========================================================================== */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.lightbox.is-open {
    display: flex;
    opacity: 1;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    margin: auto;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

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

.lightbox-close {
    top: 20px;
    right: 20px;
    font-size: 30px;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    max-width: 80%;
    text-align: center;
}

.lightbox-counter {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
}

/* ==========================================================================
   MOBILE MENU STYLES
   ========================================================================== */

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    width: 44px;
    height: 44px;
    position: relative;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: currentColor;
    margin: 3px 0;
    transition: all 0.3s ease;
    transform-origin: center;
}

.mobile-menu-toggle.is-active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.is-active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.is-active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.main-navigation.is-open {
    transform: translateX(0);
}

.mobile-menu-open {
    overflow: hidden;
}

.submenu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    font-size: 14px;
    color: inherit;
}

.menu-item-has-children.submenu-open .sub-menu {
    display: block;
}

/* ==========================================================================
   GALLERY STYLES
   ========================================================================== */

.gallery-grid {
    position: relative;
}

.gallery-item {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 8px;
    overflow: hidden;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-filter-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 8px 16px;
    margin: 0 5px 10px 0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.gallery-filter-btn:hover,
.gallery-filter-btn.active {
    background: var(--primary-color, #3498db);
    color: white;
    border-color: var(--primary-color, #3498db);
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

/* Lazy loading styles */
img.lazy {
    opacity: 0;
    transition: opacity 0.3s;
}

img.loaded {
    opacity: 1;
}

/* ==========================================================================
   ACCORDION STYLES
   ========================================================================== */

.accordion-item {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 10px;
    overflow: hidden;
}

.accordion-trigger {
    width: 100%;
    background: #f8f9fa;
    border: none;
    padding: 15px 20px;
    text-align: left;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}

.accordion-trigger:hover {
    background: #e9ecef;
}

.accordion-trigger::after {
    content: '+';
    font-size: 18px;
    transition: transform 0.3s ease;
}

.accordion-item.is-open .accordion-trigger::after {
    transform: rotate(45deg);
}

.accordion-content {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.accordion-item.is-open .accordion-content {
    padding: 20px;
    max-height: 1000px;
}

/* ==========================================================================
   TABS STYLES
   ========================================================================== */

.tab-list {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
    list-style: none;
    padding: 0;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 16px;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    color: #666;
}

.tab-button:hover,
.tab-button.active {
    color: var(--primary-color, #3498db);
    border-bottom-color: var(--primary-color, #3498db);
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-panel.active {
    display: block;
}

/* ==========================================================================
   BACK TO TOP BUTTON
   ========================================================================== */

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--primary-color, #3498db);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--secondary-color, #2c3e50);
    transform: translateY(-3px);
}

/* ==========================================================================
   FORM STYLES
   ========================================================================== */

.field-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

input.error,
textarea.error,
select.error {
    border-color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.05);
}

.newsletter-message {
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 14px;
}

.newsletter-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.newsletter-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.newsletter-message.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ==========================================================================
   SCROLL EFFECTS
   ========================================================================== */

.site-header.scrolled {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

/* ==========================================================================
   LOADING STATES
   ========================================================================== */

.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color, #3498db);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==========================================================================
   RESPONSIVE STYLES
   ========================================================================== */

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .lightbox-content {
        padding: 20px;
    }
    
    .lightbox-close,
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .lightbox-caption {
        font-size: 12px;
        padding: 8px 15px;
        bottom: 10px;
    }
    
    .lightbox-counter {
        top: 10px;
        left: 10px;
        font-size: 11px;
        padding: 3px 10px;
    }
    
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    .tab-list {
        flex-wrap: wrap;
    }
    
    .tab-button {
        flex: 1;
        min-width: 100px;
        font-size: 14px;
        padding: 10px 15px;
    }
}