/* =========================================
   1. GLOBAL VARIABLES & RESET
   ========================================= */
:root {
    --primary: #800000; /* Pera Maroon */
    --secondary: #2E7D32; /* Scout Green */
    --accent: #FFD700; /* Gold */
    --bg-light: #f8f9fa;
    --text-dark: #2c3e50;
    --white: #ffffff;
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body { 
    font-family: 'Segoe UI', sans-serif; 
    color: var(--text-dark); 
    background: var(--bg-light); 
    line-height: 1.6; 
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* =========================================
   2. NAVIGATION BAR
   ========================================= */
.navbar {
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 5px solid var(--primary);
}

.logo {
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    display: flex;
    align-items: center;
}

.logo-img { height: 40px; margin-right: 10px; }

.nav-links { display: flex; gap: 20px; }
.nav-links a { font-weight: 500; transition: 0.3s; color: var(--text-dark); }
.nav-links a:hover { color: var(--secondary); }
.nav-links a.active-nav { color: var(--primary); border-bottom: 3px solid var(--primary); }

.menu-toggle { display: none; font-size: 1.5rem; cursor: pointer; color: var(--primary); }

/* =========================================
   3. HERO & SECTIONS
   ========================================= */
.hero {
    background: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6)), url('assets/hero.jpg');
    background-size: cover;
    background-position: center;
    height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
}

.hero-content { padding: 0 20px; }
.hero h1 { font-size: 3.5rem; margin-bottom: 1rem; }
.hero-subtitle { font-size: 1.2rem; margin-bottom: 2rem; }

.section { padding: 4rem 2rem; max-width: 1200px; margin: auto; }
.section-title { text-align: center; margin-bottom: 3rem; }
.section-title h2 { font-size: 2.5rem; color: var(--primary); }
.bg-white { background-color: #ffffff; }
.bg-beige { background-color: #f4f1ea; }

.btn { 
    background: var(--secondary); color: white; padding: 12px 30px; 
    border-radius: 50px; font-weight: bold; transition: 0.3s; 
    border: none; cursor: pointer; display: inline-block;
}
.btn:hover { background: var(--primary); }
.btn-margin-top { width: fit-content; margin-top: 10px; }
.full-width { width: 100%; grid-column: 1 / -1; }
.text-center-margin { display: flex; justify-content: center; width: 100%; margin-top: 40px; }

/* =========================================
   4. CARDS & GRIDS (Standard)
   ========================================= */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 30px; }

.card { 
    background: white; border-radius: 12px; overflow: hidden; 
    box-shadow: var(--shadow); transition: 0.3s; display: flex; 
    flex-direction: column; height: 100%; position: relative; 
}
.card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.15); }

.card-img-container { width: 100%; height: 220px; background: #eee; overflow: hidden; position: relative; }
.card-img-container img { width: 100%; height: 100%; object-fit: cover; }
.fallback-logo { object-fit: contain !important; padding: 20px; }

.card-content { padding: 1.5rem; display: flex; flex-direction: column; flex-grow: 1; }
.card-meta { color: var(--secondary); font-weight: bold; font-size: 0.9rem; margin-bottom: 5px; }
.card-meta-location { font-size: 0.9rem; color: #666; margin-top: 5px; }

.card-title { font-size: 1.3rem; margin: 0.5rem 0; color: var(--text-dark); font-weight: 700; }
.card-title-large { font-size: 1.8rem; margin: 15px 0; color: var(--text-dark); }

.card-desc { font-size: 0.95rem; color: #666; margin-bottom: 15px; flex-grow: 1; }
.card-desc-large { font-size: 1rem; line-height: 1.7; color: #666; }

.badge { 
    position: absolute; top: 15px; right: 15px; 
    background: var(--secondary); color: white; 
    padding: 5px 12px; border-radius: 20px; 
    font-size: 0.8rem; font-weight: bold; text-transform: uppercase; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); 
}
.badge-primary { background-color: var(--primary); }

/* Read More Link */
.read-more-link {
    display: inline-block; margin-top: auto; color: var(--primary);
    font-weight: 700; font-size: 0.9rem; transition: 0.3s;
    border-bottom: 2px solid transparent; width: fit-content;
}
.read-more-link:hover {
    color: var(--secondary); border-bottom: 2px solid var(--secondary);
    transform: translateX(5px);
}
.read-more-link i { margin-left: 5px; font-size: 0.8rem; transition: 0.3s; }

/* Text Utilities */
.text-center-muted { text-align: center; color: #888; }
.section-divider { max-width: 1100px; margin: auto; border: 0; border-top: 1px solid #eee; }
.card-date-margin { margin-bottom: 15px; }

/* =========================================
   5. UPCOMING EVENTS (Horizontal Layout)
   ========================================= */
.upcoming-layout {
    display: flex; flex-direction: column; gap: 30px;
    max-width: 1000px; margin: auto;
}

.upcoming-layout .card {
    display: flex; flex-direction: row; min-height: 350px; align-items: stretch;
}

.upcoming-layout .card-img-container {
    flex: 0 0 45%; background-color: #f4f4f4;
    height: auto !important; border-right: 1px solid #eee;
}

.upcoming-layout .card-img-container img {
    object-fit: contain; object-position: center;
}

.upcoming-layout .card-content {
    flex: 1; padding: 2.5rem; display: flex;
    flex-direction: column; justify-content: center;
}

.upcoming-layout .card .badge {
    top: 15px; left: 15px; right: auto; z-index: 10;
}

/* =========================================
   6. GALLERY STYLES (Masonry)
   ========================================= */
.gallery-filter-container {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
    margin-bottom: 40px; padding-bottom: 20px; border-bottom: 1px solid #eee;
}

.gallery-pill {
    text-decoration: none; display: inline-block; padding: 10px 25px;
    border-radius: 50px; background-color: #e0e0e0; color: #555;
    font-weight: 600; font-size: 0.9rem; transition: 0.3s all ease; border: none;
}
.gallery-pill:hover, .active-pill {
    background-color: var(--secondary); color: white;
    transform: translateY(-2px); box-shadow: 0 4px 10px rgba(46, 125, 50, 0.3);
}

.album-section { scroll-margin-top: 120px; margin-bottom: 60px; }
.gallery-album-title {
    color: var(--primary); border-left: 5px solid var(--accent);
    padding-left: 15px; margin-bottom: 20px;
}
.gallery-album-date { font-size: 0.8rem; color: #666; font-weight: normal; margin-left: 10px; }

/* Masonry Grid */
.gallery-grid { column-count: 3; column-gap: 20px; width: 100%; }
.gallery-item { break-inside: avoid; margin-bottom: 20px; }
.gallery-img {
    width: 100%; height: auto; display: block;
    border-radius: 12px; transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--shadow);
}
.gallery-img:hover { transform: scale(1.03); box-shadow: 0 10px 25px rgba(0,0,0,0.2); }

/* =========================================
   7. ABOUT PAGE
   ========================================= */
.about-section {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem; align-items: center;
}
.about-image { border-radius: 15px; box-shadow: var(--shadow); }
.section-subtitle { color: var(--primary); font-weight: bold; text-transform: uppercase; letter-spacing: 1px; }
.section-heading { font-size: 2.5rem; margin-bottom: 1rem; }
.about-text { color: #555; line-height: 1.8; margin-bottom: 30px; }

/* Objectives Grid */
.objective-card { text-align: center; padding: 30px; height: 100%; }
.objective-icon { font-size: 2.5rem; color: var(--secondary); margin-bottom: 20px; }
.objective-title { color: var(--primary); font-size: 1.2rem; margin-bottom: 15px; }
.span-full { grid-column: 1 / -1; max-width: 600px; margin: auto; }

/* Motto */
.motto-box {
    margin-top: 60px; text-align: center; padding: 40px;
    background: linear-gradient(45deg, var(--primary), #500000);
    color: white; border-radius: 15px; box-shadow: var(--shadow);
}
.motto-text { font-size: 3.5rem; margin: 10px 0 0 0; color: var(--accent); font-weight: 800; letter-spacing: 2px; }

/* Badges & Uniform */
.badge-card { text-align: center; padding: 20px; }
.badge-img-container { height: 150px; display: flex; align-items: center; justify-content: center; }
.badge-img { max-height: 140px; width: auto; }

.uniform-list { list-style: none; padding: 0; color: #555; }
.uniform-list li { margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.uniform-icon { color: var(--secondary); width: 25px; }

/* =========================================
   8. CONTACT & FORMS
   ========================================= */
.contact-container { 
    display: grid; grid-template-columns: 1fr 1fr; border-radius: 20px; 
    overflow: hidden; box-shadow: var(--shadow); background: white; 
}
.contact-info { background: var(--primary); color: white; padding: 3rem; }
.contact-form { padding: 3rem; }
.form-title { color: var(--primary); margin-bottom: 20px; }

/* Input Styling */
input, textarea, select { 
    width: 100%; padding: 12px; margin-bottom: 15px; 
    border: 1px solid #ddd; border-radius: 8px; resize: none; 
    font-family: 'Segoe UI', sans-serif; font-size: 1rem; background-color: white;
}

/* Contact Details */
.contact-details {
    margin-top: 30px;
}

.contact-item {
    display: flex;
    align-items: flex-start; /* Aligns icon to the top */
    gap: 15px;
    margin-bottom: 25px;
}

/* Wrapper for Icon to keep it stable */
.icon-box {
    width: 30px;
    text-align: center;
    padding-top: 2px; /* Tiny adjustment to align with text top */
}

.contact-icon {
    font-size: 1.2rem;
    color: var(--accent); /* Gold color for icons */
}

/* Wrapper for Text to keep it aligned left */
.text-box {
    flex: 1;
}

.text-box strong {
    display: block; /* Forces label to own line */
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.text-box p {
    margin: 0;
    color: rgba(255, 255, 255, 0.8); /* Slightly softer white for reading */
    line-height: 1.5;
}

/* Map */
.map-container {
    margin-top: 20px; border-radius: 10px; overflow: hidden; 
    height: 250px; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.map-iframe { width: 100%; height: 100%; border: 0; }

/* Membership Page */
.membership-container {
    max-width: 800px; margin: auto; background: white; padding: 10px;
    box-shadow: var(--shadow); border-radius: 10px; overflow: hidden;
}
.membership-frame { width: 100%; height: 800px; border: 0; display: block; }

/* =========================================
   9. ADMIN PANEL
   ========================================= */
.login-container {
    max-width: 400px; margin: 50px auto; background: white; 
    padding: 30px; border-radius: 10px; box-shadow: var(--shadow); text-align: center;
}
.admin-panel-box {
    background: white; padding: 30px; border-radius: 15px; 
    max-width: 1200px; margin: auto; margin-bottom: 40px; box-shadow: var(--shadow);
}
.admin-section-title { color: var(--primary); border-bottom: 2px solid #eee; padding-bottom: 10px; margin-bottom: 20px; }
.admin-box { background: #f9f9f9; padding: 20px; border-radius: 10px; margin-bottom: 20px; border: 1px solid #eee; }

/* Admin Edit Page */
.edit-container { background: white; padding: 40px; border-radius: 15px; max-width: 800px; margin: auto; box-shadow: var(--shadow); }
.edit-header { color: var(--primary); border-bottom: 1px solid #ddd; padding-bottom: 10px; margin-bottom: 20px; }
.form-row { display: flex; gap: 20px; }
.form-col { flex: 1; }
.edit-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-top: 10px; }
.edit-img-wrapper { position: relative; height: 100px; }
.edit-img-wrapper img { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }
.btn-del-img {
    position: absolute; top: -5px; right: -5px; background: red; color: white;
    width: 20px; height: 20px; border-radius: 50%; text-align: center; 
    line-height: 20px; text-decoration: none; font-weight: bold; font-size: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Dashboard Tables */
.dashboard-table { width: 100%; border-collapse: collapse; margin-top: 20px; background: white; }
.dashboard-table th, .dashboard-table td { padding: 12px; border-bottom: 1px solid #ddd; text-align: left; }
.dashboard-table th { background: var(--primary); color: white; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; margin-right: 5px; text-decoration: none; border-radius: 4px; color: white; }
.btn-edit { background-color: #2196F3; }
.btn-del { background-color: #f44336; }

/* Settings Form */
.settings-form { display: flex; gap: 10px; align-items: flex-end; }
.settings-input-wrapper { flex-grow: 1; }
.settings-input { margin-bottom: 0; }
.settings-btn { height: 46px; }

/* =========================================
   10. EVENT/NEWS DETAIL PAGE
   ========================================= */
.detail-header-img {
    width: 100%; height: 400px; overflow: hidden; 
    border-radius: 15px; margin-bottom: 30px; box-shadow: var(--shadow);
}
.detail-header-img img { width: 100%; height: 100%; object-fit: cover; }
.detail-content-wrapper { max-width: 800px; margin: auto; }
.detail-title { color: var(--primary); font-size: 2.5rem; margin-bottom: 10px; }
.detail-meta { display: flex; gap: 20px; color: #666; margin-bottom: 20px; font-weight: bold; }
.detail-box {
    background: white; padding: 30px; border-radius: 15px; line-height: 1.8;
    font-size: 1.1rem; box-shadow: var(--shadow);
}
.detail-gallery-section { margin-top: 50px; }
.detail-gallery-title {
    color: var(--primary); border-bottom: 2px solid var(--accent);
    display: inline-block; padding-bottom: 5px; margin-bottom: 20px;
}

/* =========================================
   11. FOOTER
   ========================================= */
footer { background: #222; color: white; padding: 4rem 2rem 2rem; margin-top: 4rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; max-width: 1200px; margin: auto; text-align: left; }
.footer-col h3 { color: var(--accent); margin-bottom: 20px; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a { color: #ccc; transition: 0.3s; }
.footer-col ul li a:hover { color: white; padding-left: 5px; }
.footer-desc { color: #ccc; line-height: 1.6; }
.footer-bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid #444; text-align: center; font-size: 0.9rem; color: #888; }

/* Social Icons */
.footer-socials { margin-top: 20px; font-size: 1.5rem; }
.social-link { color: white; margin-right: 15px; transition: color 0.3s; }
.social-link:hover { color: var(--accent); }
.dev-link { text-decoration: underline; color: inherit; font-weight: bold; }
.dev-link:hover { color: var(--accent); }

/* Footer Contact Alignment */
.footer-contact p { display: flex; align-items: flex-start; gap: 15px; margin-bottom: 15px; color: #ccc; line-height: 1.4; }
.footer-contact p i { width: 25px; text-align: center; margin-top: 4px; color: var(--accent); }

/* Back to Top Button */
#backToTop {
    display: none; position: fixed; bottom: 30px; right: 30px; z-index: 9999;
    border: none; outline: none; background-color: var(--secondary); color: white;
    cursor: pointer; padding: 15px; border-radius: 50%; font-size: 1.2rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); width: 50px; height: 50px;
    align-items: center; justify-content: center; transition: transform 0.3s, background-color 0.3s;
}
#backToTop:hover { background-color: var(--primary); transform: translateY(-5px); }

/* =========================================
   12. 404 PAGE
   ========================================= */
.error-page-container {
    height: 70vh; display: flex; flex-direction: column; align-items: center;
    justify-content: center; text-align: center; background-color: #f4f1ea; padding: 20px;
}
.error-icon { font-size: 5rem; color: var(--primary); margin-bottom: 20px; }
.error-title { font-size: 4rem; color: var(--primary); margin: 0; font-weight: 800; line-height: 1; }
.error-subtitle { margin-top: 10px; color: #333; }
.error-text { color: #666; max-width: 500px; margin: 20px auto; font-size: 1.1rem; line-height: 1.6; }

/* =========================================
   13. MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 768px) {
    .navbar { flex-wrap: wrap; }
    .menu-toggle { display: block; }
    .nav-links { display: none; width: 100%; flex-direction: column; text-align: center; padding-top: 20px; }
    .nav-links.active { display: flex; }
    
    .hero h1 { font-size: 2.2rem; }
    
    /* Fix Upcoming Horizontal Layout on Mobile */
    .upcoming-layout .card { flex-direction: column; }
    .upcoming-layout .card-img-container { flex: none; width: 100%; height: 250px !important; }
    .upcoming-layout .card-content { padding: 1.5rem; }
    
    /* Fix Contact Form Layout */
    .contact-container { grid-template-columns: 1fr; }
    
    /* Fix Gallery Columns */
    .gallery-grid { column-count: 1; column-gap: 0; }
    .gallery-item { margin-bottom: 25px; }
}