/* ========================================
   Sri Mavullamma Temple - Frontend Styles
   Sacred, Elegant, Responsive Design
   ======================================== */

:root {
    --smat-gold: #d4a574;
    --smat-primary: #8b4513;
    --smat-secondary: #c85a3a;
    --smat-dark: #2c1810;
    --smat-light: #f9f5f0;
    --smat-accent: #8b0000;
    --smat-text: #3d2817;
    --smat-border: #d4a574;
    --smat-shadow: rgba(44, 24, 16, 0.15);
    
    --font-display: 'Cambria', 'Georgia', serif;
    --font-body: 'Segoe UI', 'Roboto', sans-serif;
    --font-telugu: 'Noto Sans Telugu', 'NotoSansTelugu', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#smat-app {
    font-family: var(--font-body);
    color: var(--smat-text);
    background: linear-gradient(135deg, var(--smat-light) 0%, #f5f0e8 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ========== HEADER / NAVIGATION ========== */

.smat-header {
    background: linear-gradient(180deg, var(--smat-dark) 0%, #3d2817 100%);
    padding: 2rem 1rem;
    text-align: center;
    border-bottom: 4px solid var(--smat-gold);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px var(--smat-shadow);
}

.smat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(212, 165, 116, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(139, 69, 19, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.smat-temple-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--smat-gold);
    font-weight: 600;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.smat-temple-title.telugu {
    font-family: var(--font-telugu);
    font-size: 2rem;
}

.smat-temple-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

/* Navigation Tabs */
.smat-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    position: relative;
    z-index: 1;
}

.smat-nav-item {
    padding: 0.75rem 1.5rem;
    border: 2px solid transparent;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.smat-nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--smat-secondary);
    transition: left 0.3s ease;
    z-index: -1;
}

.smat-nav-item:hover {
    border-color: var(--smat-gold);
    color: white;
}

.smat-nav-item:hover::before {
    left: 0;
}

.smat-nav-item.active {
    background: var(--smat-secondary);
    border-color: var(--smat-gold);
    color: white;
    box-shadow: 0 4px 15px rgba(200, 90, 58, 0.3);
}

/* ========== MAIN CONTENT ========== */

.smat-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1rem;
}

.smat-section {
    display: none;
    animation: fadeInUp 0.5s ease forwards;
}

.smat-section.active {
    display: block;
}

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

/* ========== HISTORY SECTION ========== */

.smat-history-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px var(--smat-shadow);
    border-left: 5px solid var(--smat-secondary);
}

.smat-history-title {
    font-family: var(--font-display);
    font-size: 2.2rem;
    color: var(--smat-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--smat-gold);
}

.smat-history-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--smat-text);
    text-align: justify;
}

/* ========== EVENTS SECTION ========== */

.smat-events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.smat-event-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px var(--smat-shadow);
    transition: all 0.3s ease;
    border-top: 4px solid var(--smat-secondary);
    cursor: pointer;
}

.smat-event-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(200, 90, 58, 0.2);
}

.smat-event-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--smat-gold), var(--smat-secondary));
}

.smat-event-content {
    padding: 1.5rem;
}

.smat-event-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--smat-primary);
    margin-bottom: 0.5rem;
}

.smat-event-date {
    color: var(--smat-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.smat-event-description {
    color: var(--smat-text);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ========== GALLERY SECTION ========== */

.smat-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.smat-gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--smat-shadow);
}

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

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

.smat-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 24, 16, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: white;
    font-size: 1.2rem;
}

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

/* ========== FINANCE SECTION ========== */

.smat-finance-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px var(--smat-shadow);
}

.smat-finance-title {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--smat-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--smat-gold);
}

.smat-year-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.smat-year-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--smat-gold);
    background: white;
    color: var(--smat-primary);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.smat-year-btn:hover,
.smat-year-btn.active {
    background: var(--smat-secondary);
    color: white;
    border-color: var(--smat-secondary);
}

.smat-finance-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.smat-summary-card {
    background: linear-gradient(135deg, var(--smat-light), #f0e8df);
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 5px solid var(--smat-secondary);
    text-align: center;
}

.smat-summary-label {
    font-size: 0.9rem;
    color: var(--smat-text);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.smat-summary-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--smat-secondary);
    font-weight: bold;
}

.smat-finance-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
}

.smat-finance-table thead {
    background: var(--smat-dark);
    color: white;
}

.smat-finance-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 3px solid var(--smat-gold);
}

.smat-finance-table td {
    padding: 1rem;
    border-bottom: 1px solid #e8dfd5;
}

.smat-finance-table tbody tr:hover {
    background: var(--smat-light);
}

.smat-finance-type {
    font-weight: 600;
    color: var(--smat-secondary);
}

.smat-finance-amount {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--smat-primary);
}

/* ========== DONATIONS SECTION ========== */

.smat-donations-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px var(--smat-shadow);
}

.smat-donations-title {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--smat-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--smat-gold);
}

.smat-donation-item {
    background: var(--smat-light);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 5px solid var(--smat-secondary);
}

.smat-donation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.smat-donor-name {
    font-weight: 600;
    color: var(--smat-primary);
    font-size: 1.1rem;
}

.smat-donation-amount {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--smat-secondary);
    font-size: 1.2rem;
}

.smat-donation-meta {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
    color: var(--smat-text);
    opacity: 0.8;
}

/* ========== OTHERS SECTION ========== */

.smat-others-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 8px 32px var(--smat-shadow);
}

.smat-others-title {
    font-family: var(--font-display);
    font-size: 2.2rem;
    color: var(--smat-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--smat-gold);
}

.smat-others-text {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--smat-text);
}

/* ========== FOOTER ========== */

.smat-footer {
    background: var(--smat-dark);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    border-top: 4px solid var(--smat-gold);
}

.smat-footer-text {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* ========== UTILITIES ========== */

.smat-empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--smat-text);
}

.smat-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.smat-loading {
    text-align: center;
    padding: 2rem;
    color: var(--smat-secondary);
}

.smat-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--smat-light);
    border-top: 4px solid var(--smat-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ========== RESPONSIVE DESIGN ========== */

@media (max-width: 768px) {
    .smat-temple-title {
        font-size: 2rem;
    }

    .smat-temple-title.telugu {
        font-size: 1.6rem;
    }

    .smat-nav {
        gap: 0.25rem;
    }

    .smat-nav-item {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .smat-main {
        padding: 1.5rem 1rem;
    }

    .smat-events-grid,
    .smat-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }

    .smat-finance-summary {
        grid-template-columns: 1fr;
    }

    .smat-finance-table {
        font-size: 0.9rem;
    }

    .smat-finance-table th,
    .smat-finance-table td {
        padding: 0.75rem;
    }

    .smat-summary-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .smat-temple-title {
        font-size: 1.6rem;
        letter-spacing: 1px;
    }

    .smat-temple-title.telugu {
        font-size: 1.3rem;
    }

    .smat-nav-item {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
    }

    .smat-history-container,
    .smat-finance-container,
    .smat-donations-container,
    .smat-others-content {
        padding: 1.5rem 1rem;
    }

    .smat-history-title,
    .smat-finance-title,
    .smat-donations-title,
    .smat-others-title {
        font-size: 1.6rem;
    }

    .smat-event-card,
    .smat-gallery-item {
        border-radius: 8px;
    }

    .smat-summary-card {
        padding: 1rem;
    }

    .smat-summary-value {
        font-size: 1.3rem;
    }

    .smat-donation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .smat-donation-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* ========== PRINT STYLES ========== */

@media print {
    .smat-nav {
        display: none;
    }

    .smat-footer {
        display: none;
    }

    .smat-section {
        display: block !important;
        page-break-after: always;
    }
}

/* ========================================
   EVENTS — structured list view
   ======================================== */
.smat-section-heading {
    font-family: var(--font-display);
    font-size: 2.2rem;
    color: var(--smat-primary);
    margin-bottom: 2rem;
    padding-bottom: .75rem;
    border-bottom: 3px solid var(--smat-gold);
}

.smat-events-block {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 16px var(--smat-shadow);
    margin-bottom: 2rem;
}

.smat-events-block-header {
    background: var(--smat-dark);
    color: var(--smat-gold);
    font-weight: 700;
    font-size: 1rem;
    padding: .85rem 1.25rem;
    letter-spacing: .5px;
}

.smat-event-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f0e8df;
    transition: background .2s;
}
.smat-event-row:last-child { border-bottom: none; }
.smat-event-row:hover { background: var(--smat-light); }

.smat-event-row-icon {
    font-size: 1.4rem;
    padding-top: .1rem;
    flex-shrink: 0;
}

.smat-event-row-body { flex: 1; }

.smat-event-row-name {
    font-weight: 700;
    color: var(--smat-primary);
    font-size: 1.05rem;
}

.smat-event-row-desc {
    font-size: .9rem;
    color: #777;
    margin-top: .2rem;
}

.smat-event-row-date {
    font-weight: 700;
    color: var(--smat-secondary);
    font-size: .9rem;
    white-space: nowrap;
    flex-shrink: 0;
    padding-top: .15rem;
}

/* Archive collapsible */
.smat-events-archive {
    margin-bottom: 2rem;
}

.smat-events-archive-toggle {
    display: flex;
    align-items: center;
    gap: .75rem;
    cursor: pointer;
    background: #f5f0e8;
    border: 2px dashed var(--smat-gold);
    border-radius: 8px;
    padding: .9rem 1.25rem;
    font-weight: 700;
    color: var(--smat-primary);
    list-style: none;
    user-select: none;
}
.smat-events-archive-toggle::-webkit-details-marker { display: none; }
.smat-events-archive-toggle .smat-evt-count {
    background: var(--smat-secondary);
    color: white;
    border-radius: 20px;
    padding: .15rem .65rem;
    font-size: .8rem;
    margin-left: auto;
}

.smat-archive-block { margin-top: 1rem; }

/* ========================================
   GALLERY — tabs + groups + lightbox
   ======================================== */
.smat-gal-tabs {
    display: flex;
    gap: .75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.smat-gal-tab {
    padding: .7rem 1.5rem;
    border: 2px solid var(--smat-gold);
    border-radius: 50px;
    background: white;
    color: var(--smat-primary);
    font-weight: 700;
    font-size: .95rem;
    cursor: pointer;
    transition: all .3s;
}
.smat-gal-tab:hover,
.smat-gal-tab.active {
    background: var(--smat-secondary);
    border-color: var(--smat-secondary);
    color: white;
}

.smat-gal-group {
    margin-bottom: 3rem;
}

.smat-gal-group-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--smat-primary);
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--smat-gold);
}

/* Photos grid */
.smat-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.smat-gallery-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--smat-shadow);
    background: var(--smat-light);
}
.smat-gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}
.smat-gallery-item:hover .smat-gallery-img { transform: scale(1.07); }
.smat-gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(44,24,16,.65);
    display: flex;
    align-items: flex-end;
    padding: .75rem;
    color: white;
    font-weight: 600;
    font-size: .9rem;
    opacity: 0;
    transition: opacity .3s;
}
.smat-gallery-item:hover .smat-gallery-overlay { opacity: 1; }

/* Videos grid */
.smat-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.smat-video-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--smat-shadow);
    cursor: pointer;
    transition: transform .3s, box-shadow .3s;
    border-top: 4px solid var(--smat-secondary);
}
.smat-video-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 28px rgba(200,90,58,.2);
}

.smat-video-thumb {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--smat-dark);
    overflow: hidden;
}
.smat-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.smat-vid-thumb-ph {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--smat-dark), #5a3020);
}
.smat-video-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    background: rgba(0,0,0,.3);
    opacity: 0;
    transition: opacity .3s;
}
.smat-video-card:hover .smat-video-play-btn { opacity: 1; }

.smat-video-info {
    padding: .85rem 1rem;
}
.smat-video-title {
    font-weight: 700;
    color: var(--smat-primary);
    margin-bottom: .3rem;
}
.smat-video-desc {
    font-size: .85rem;
    color: #888;
}

/* Lightbox */
.smat-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.smat-lightbox-bg {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.88);
    cursor: pointer;
}
.smat-lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.smat-lightbox-content img {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 8px;
    object-fit: contain;
}
.smat-lightbox-caption {
    color: white;
    margin-top: .75rem;
    font-size: 1rem;
    font-weight: 600;
}
.smat-lightbox-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}
.smat-video-embed-wrap {
    width: min(860px, 90vw);
    aspect-ratio: 16/9;
}
.smat-video-embed-wrap iframe,
.smat-video-embed-wrap video {
    width: 100%;
    height: 100%;
    border-radius: 6px;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .smat-event-row { flex-wrap: wrap; }
    .smat-event-row-date { width: 100%; text-align: right; }
    .smat-gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); }
    .smat-video-grid   { grid-template-columns: 1fr; }
}
