:root {
    --primary: #1a2e35;
    --primary-light: #2c4a54;
    --accent: #4a7c59;
    --accent-light: #f0f7f0;
    --bg: #f9f7f2;
    --text: #2c3e50;
    --text-muted: #5d6d7e;
    --white: #ffffff;
    --gold: #c5a059;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    
    /* Category Colors */
    --cat-es: #1b4332;
    --cat-en: #2d6a4f;
    --cat-pt: #52b788;
    --cat-fr: #b7e4c7;
    --cat-talleres: #bc6c25;
    --cat-miembros: #3d5a80; /* Changed from gold to deep indigo/blue for better differentiation */
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3 {
    font-family: 'Bitter', serif;
    font-weight: 700;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.05);
}

/* Header & Navigation */
header {
    background: var(--primary);
    color: var(--white);
    padding: 1.2rem 1rem 0;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    margin-bottom: 1.2rem;
    animation: fadeInDown 0.6s ease-out;
    display: flex;
    justify-content: center;
}

.logo-btn {
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.logo-btn:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}

.logo-main {
    height: 44px;
    width: auto;
    max-width: 100%;
    display: block;
}

header h1, .subtitle {
    display: none;
}

#tabs {
    display: flex;
    gap: 0.4rem; /* Increased gap slightly for better breathing room */
    justify-content: flex-start; /* Ensure left-alignment for scroll affordance */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 1.5rem 0 0.5rem; /* Right padding to scroll past the mask */
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    
    /* Horizontal Scroll Hint: Fade out effect on the right */
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
}

#tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    background: var(--tab-color); /* Persistent categorical color */
    border: none;
    color: var(--white);
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    flex-shrink: 0;
    border-radius: 8px 8px 0 0;
    margin-right: 2px;
    opacity: 0.8; /* Slightly muted when inactive */
    filter: saturate(0.8);
}

/* Category Specific Assignments */
.tab-btn[data-category="3"] { --tab-color: var(--cat-es); }
.tab-btn[data-category="2"] { --tab-color: var(--cat-en); }
.tab-btn[data-category="178"] { --tab-color: var(--cat-pt); }
.tab-btn[data-category="137"] { --tab-color: var(--cat-fr); }
.tab-btn[data-category="98"] { --tab-color: var(--cat-talleres); }
.tab-btn[data-category="miembros"] { --tab-color: var(--cat-miembros); }

/* Handle specific text contrast for light colors always */
.tab-btn[data-category="137"] {
    color: #1b4332; /* Contrast for light green */
}

.tab-btn:hover {
    opacity: 1;
    filter: saturate(1);
    transform: translateY(-2px);
}

.tab-btn.active {
    opacity: 1;
    filter: saturate(1.2) brightness(1.1);
    transform: translateY(-4px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 2;
}

/* Active Indicator: A thick white/gold bar to mark selection */
.tab-btn.active::after {
    content: '';
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--white);
    box-shadow: 0 -2px 10px rgba(255, 255, 255, 0.5);
}

/* For the light French tab, use a dark indicator */
.tab-btn.active[data-category="137"]::after {
    background: #1b4332;
    box-shadow: none;
}

/* Sections */
main {
    padding: 1.5rem;
    flex: 1;
}

.event-section {
    margin-bottom: 3rem;
}

.event-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
    padding-left: 0.5rem;
    border-left: 4px solid var(--accent);
}

/* Event Grid & Cards */
.event-grid {
    display: grid;
    gap: 1.5rem;
}

.event-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.event-card:hover {
    transform: translateY(-5px);
}

.event-image {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
    background-color: #eee;
}

.event-info {
    padding: 1.2rem;
}

.event-meta {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.event-title {
    font-size: 1.1rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.event-excerpt {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

/* Miembros Grid & Cards */
.miembros-grid {
    display: grid;
    gap: 1.2rem;
    grid-template-columns: 1fr;
}

.miembro-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.3s;
    cursor: pointer;
    display: flex;
    align-items: center;
    border: 2px solid transparent;
    gap: 1.5rem;
}

.miembro-card:hover {
    transform: translateY(-4px);
    border-color: var(--gold);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.miembro-icon {
    font-size: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    background: var(--accent-light);
    border-radius: 50%;
    flex-shrink: 0;
}

.miembro-info {
    flex: 1;
}

.miembro-info h3 {
    color: var(--primary);
    font-size: 1.25rem;
    margin-bottom: 0.2rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

.miembro-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

/* Utility */
.loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 2rem auto;
    animation: spin 1s linear infinite;
}

.hidden {
    display: none !important;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
}

.modal-content {
    background: var(--bg);
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    height: 90vh;
    border-radius: 20px 20px 0 0;
    padding: 3.5rem 1.5rem 1.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
}

#modal-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    height: 100%;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2.5rem;
    background: var(--bg);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.modal-iframe-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.about-iframe {
    width: 100%;
    flex: 1;
    border: none;
    border-radius: 12px;
}

/* About Content styling */
.about-content {
    line-height: 1.7;
    color: var(--text);
}

.about-content h2 {
    margin-bottom: 1.5rem;
    color: var(--primary);
    border-bottom: 2px solid var(--gold);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.about-content p {
    margin-bottom: 1.2rem;
    font-size: 0.95rem;
}

.about-content .wp-block-image {
    margin: 1.5rem 0;
}

.about-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.about-content a {
    color: var(--accent);
    text-decoration: underline;
    font-weight: 600;
}

/* Detail UI */
.detail-header img {
    width: 100%;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.detail-tag {
    display: inline-block;
    background: var(--accent-light);
    color: var(--accent);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.detail-title {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
}

.detail-info-block {
    background: var(--white);
    padding: 1.2rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.info-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-label {
    font-weight: 700;
    width: 80px;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.info-value {
    font-size: 0.9rem;
}

.maps-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent);
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 1rem;
    transition: opacity 0.2s;
}

.maps-btn:hover {
    opacity: 0.9;
}

footer {
    padding: 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* iOS Install Prompt */
.ios-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    border: 1px solid rgba(0, 0, 0, 0.05);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.ios-prompt-content {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.ios-prompt-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.prompt-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.prompt-title h3 {
    font-size: 1rem;
    margin-bottom: 0.1rem;
    color: var(--primary);
}

.prompt-title p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ios-prompt-steps {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--accent-light);
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
}

.step-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    color: var(--accent);
}

.step p {
    font-size: 0.85rem;
    color: var(--text);
}

.prompt-close-btn {
    background: var(--bg);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    padding: 0.6rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.prompt-close-btn:hover {
    background: #eee;
}

/* Responsive adjustments */
@media (max-width: 500px) {
    #tabs {
        justify-content: flex-start;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 400px) {
    .tab-btn {
        padding: 0.8rem 0.5rem;
        font-size: 0.8rem;
    }
}