@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap');

:root {
    --primary-color: #e30613; /* Boncourt Red */
    --secondary-color: #000000;
    --bg-color: #ffffff;
    --card-bg: #f9f9f9;
    --text-color: #333333;
    --white: #ffffff;
}

html, body {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: 'Open Sans', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    width: 95%;
    max-width: 1200px; /* Widened for better admin experience */
    margin: 0 auto;
    padding: 0 15px;
}

header {
    background-color: var(--white);
    color: var(--secondary-color);
    text-align: center;
    padding: 1.5rem 0;
    border-bottom: 3px solid var(--primary-color);
}

header img.logo {
    max-width: 120px;
    height: auto;
    margin-bottom: 10px;
}

header h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    flex: 1;
}

/* Navigation Menu */
.menu-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
    color: var(--secondary-color);
}

.side-drawer {
    position: fixed;
    top: 0;
    left: -281px;
    width: 280px;
    height: 100%;
    background: var(--white);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: left 0.3s ease, visibility 0.3s;
    padding: 20px 20px 40px 20px; /* More bottom padding for settings visibility */
    display: flex;
    flex-direction: column;
    visibility: hidden;
    overflow-y: auto;
    box-sizing: border-box;
}

.side-drawer.open {
    left: 0;
    visibility: visible;
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.drawer-overlay.active {
    display: block;
}

.drawer-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.drawer-menu-item {
    padding: 12px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.drawer-menu-item:hover, .drawer-menu-item.active {
    background: #f0f0f0;
    color: var(--primary-color);
}

.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin: 20px 0;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 4px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    font-family: 'Open Sans', sans-serif;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #c40510;
}

.btn:active {
    transform: scale(0.98);
}

h2, h3 {
    color: var(--secondary-color);
    font-weight: 700;
}

/* =====================================================
   Rubrique Selector (Segmented Buttons)
   ===================================================== */
.rubrique-selector {
    margin-top: 15px;
    margin-bottom: 20px;
}

.rubrique-buttons {
    display: flex;
    background: #f0f0f0;
    padding: 4px;
    border-radius: 10px;
    gap: 4px;
}

.rub_btn {
    flex: 1;
    border: none;
    background: none;
    padding: 10px 5px;
    font-size: 0.85rem;
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
    color: #666;
    cursor: pointer;
    border-radius: 7px;
    transition: all 0.2s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rub_btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.rub_btn.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 2px 4px rgba(227, 6, 19, 0.2);
}

@media (max-width: 360px) {
    .rub_btn {
        font-size: 0.75rem;
        padding: 10px 2px;
    }
}

/* =====================================================
   Accordion (Communications Communales)
   ===================================================== */
.accordion-item {
    background: var(--card-bg);
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden;
}

.accordion-header {
    padding: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    user-select: none;
}

.accordion-header:hover {
    background: #f0f0f0;
}

.accordion-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.accordion-icon {
    font-size: 0.7rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
    display: inline-block;
}

.accordion-item.open .accordion-icon {
    transform: rotate(90deg);
}

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    padding: 0 15px;
}

.accordion-item.open .accordion-body {
    max-height: 2000px;
    padding: 0 15px 15px;
}

.accordion-content {
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #333;
}

/* =====================================================
   Agenda
   ===================================================== */
.agenda-month {
    margin-bottom: 30px;
}

.agenda-month-title {
    font-size: 1.3rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--secondary-color);
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #eee;
}

.agenda-event {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    line-height: 1.6;
}

.agenda-event:last-child {
    border-bottom: none;
}

.agenda-date {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.95rem;
}

.agenda-separator {
    color: #666;
}

.agenda-event-title {
    font-weight: 600;
    color: var(--text-color);
}

.agenda-emojis {
    font-size: 1.1rem;
}

.agenda-description {
    color: #666;
    font-size: 0.9rem;
    margin-top: 2px;
    padding-left: 0;
}

.agenda-link {
    display: inline-block;
    margin-top: 4px;
    color: var(--secondary-color);
    text-decoration: underline;
    font-size: 0.9rem;
}

.agenda-link:hover {
    color: var(--primary-color);
}

/* =====================================================
   PWA Installation Overlays
   ===================================================== */

/* Android Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: #fff;
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 2000;
    padding: 15px;
}

.pwa-install-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-install-text {
    flex: 1;
}

/* iOS Overlays */
.pwa-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-overlay.ios-bottom-overlay {
    align-items: flex-end;
    padding-bottom: 30px;
}

.pwa-overlay-content {
    background: #fff;
    width: 90%;
    max-width: 400px;
    padding: 25px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(15px); }
    60% { transform: translateY(7px); }
}
