/* ============================================
   Bessières Tennis Club - Backoffice Styles
   ============================================ */

:root {
    --primary: #2a6478;
    --primary-dark: #1e4a5a;
    --primary-light: #4a99b5;
    --secondary: #e8d44d;
    --sidebar-bg: #1b3a4a;
    --sidebar-width: 240px;
}

/* --- Layout --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f5f6fa;
    min-height: 100vh;
}

#wrapper {
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: #fff;
    transition: margin-left 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

.sidebar-header {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h5 {
    color: var(--secondary);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.7rem 1rem;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--secondary);
}

.sidebar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--secondary);
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
    width: 20px;
    text-align: center;
}

/* Ensembles de menu repliables */
.sidebar .nav-group-toggle {
    position: relative;
    padding-right: 2rem;
}

.sidebar .nav-group-chevron {
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    margin: 0;
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.sidebar .nav-group-toggle[aria-expanded="true"] .nav-group-chevron {
    transform: translateY(-50%) rotate(180deg);
}

.sidebar .nav-group.open > .nav-group-toggle {
    color: #fff;
}

.sidebar .nav-group-items {
    background: rgba(0, 0, 0, 0.15);
}

.sidebar .nav-group-items .nav-link {
    padding-left: 2.2rem;
    font-size: 0.85rem;
}

/* « Installer l'appli », séparé du reste en bas du menu */
.sidebar .install-app-item {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Page content offset */
#page-content-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.3s ease;
}

/* Sidebar toggled */
.sidebar.toggled {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar.toggled ~ #page-content-wrapper {
    margin-left: 0;
    width: 100%;
}

/* --- Cards --- */
.stat-card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

/* --- Tables --- */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    border-top: none;
}

/* --- Status badges --- */
.badge-brouillon { background-color: #6c757d; }
.badge-valide { background-color: #0d6efd; }
.badge-publie { background-color: #198754; }
.badge-envoye { background-color: #6610f2; }
.badge-archive { background-color: #adb5bd; }

.badge-victoire { background-color: #198754; }
.badge-defaite { background-color: #dc3545; }
.badge-egalite { background-color: #ffc107; color: #000; }

.badge-reception { background-color: #0dcaf0; color: #000; }
.badge-deplacement { background-color: #ffc107; color: #000; }

/* --- Login page --- */
.login-container {
    max-width: 420px;
    margin: 80px auto;
}

.login-card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

.login-header {
    background: var(--primary);
    color: #fff;
    border-radius: 0.75rem 0.75rem 0 0;
    padding: 2rem;
    text-align: center;
}

/* --- Forms --- */
.form-label {
    font-weight: 500;
    font-size: 0.9rem;
}

/* --- Calendar simple --- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #dee2e6;
}

.calendar-cell {
    background: #fff;
    min-height: 100px;
    padding: 0.3rem;
    font-size: 0.8rem;
}

.calendar-cell.today {
    background: #f0fff4;
}

.calendar-cell .day-number {
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
}

.calendar-cell .event-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 2px;
}

.calendar-event {
    display: block;
    padding: 1px 4px;
    margin: 1px 0;
    border-radius: 3px;
    color: #fff;
    font-size: 0.72rem;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-header-cell {
    background: var(--primary);
    color: #fff;
    text-align: center;
    padding: 0.4rem;
    font-weight: 600;
    font-size: 0.85rem;
}

/* --- Image preview --- */
.img-preview {
    max-width: 200px;
    max-height: 150px;
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
}

.img-preview-large {
    max-width: 100%;
    max-height: 400px;
    border-radius: 0.375rem;
}

/* --- Featured event --- */
.featured-badge {
    background: var(--secondary);
    color: #000;
}

/* --- Newsletter preview --- */
.newsletter-preview {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 2rem;
    background: #fff;
    max-width: 700px;
    margin: 0 auto;
}

/* --- Responsive --- */
/* --- Usage sur téléphone --- */
@media (max-width: 576px) {
    /* Sous 16px, iOS zoome à chaque champ touché. */
    .form-control,
    .form-select {
        font-size: 16px;
    }

    /* Cibles tactiles : un bouton d'action doit se toucher sans viser. */
    .btn-sm,
    .table-responsive-actions .btn {
        min-height: 38px;
        padding-inline: 0.7rem;
    }

    .table-responsive-actions .btn {
        margin-bottom: 0.15rem;
    }

    .sidebar .nav-link {
        padding-block: 0.85rem;
    }
}

/* Application installée : laisser respirer les bords de l'écran. */
.sidebar {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

#page-content-wrapper {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }

    .sidebar.toggled {
        margin-left: 0;
    }

    #page-content-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .sidebar.toggled ~ #page-content-wrapper {
        margin-left: var(--sidebar-width);
    }

    .table-responsive-actions {
        white-space: nowrap;
    }
}

/* --- Filter bar --- */
.filter-bar {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* --- Pagination --- */
.pagination .page-link {
    color: var(--primary);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}
