/* Ecole Maternelle Michel Gevrey - Cantine - Mobile First */
/* Palette extraite du logo et de la facade de l'ecole */

:root {
    --bleu: #1b3a5c;
    --bleu-clair: #3b7dd8;
    --orange: #e8751a;
    --orange-clair: #f59e42;
    --jaune: #f5c518;
    --rouge: #d63031;
    --vert: #27ae60;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #1a1a2e;
    --radius: 10px;
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: var(--bleu);
    color: #fff;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(27, 58, 92, 0.3);
}

.nav-brand {
    font-weight: 700;
    font-size: 1rem;
    margin-right: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
}

.nav-brand img {
    height: 40px;
    width: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.nav-color-bar {
    height: 4px;
    width: 100%;
    background: linear-gradient(to right, var(--rouge) 0%, var(--rouge) 20%, var(--orange) 20%, var(--orange) 40%, var(--jaune) 40%, var(--jaune) 60%, var(--bleu-clair) 60%, var(--bleu-clair) 80%, var(--bleu) 80%, var(--bleu) 100%);
    flex-shrink: 0;
}

.nav-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    display: block;
    padding: 0.5rem 1rem;
}

.nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0;
    background: rgba(0,0,0,0.15);
}

.nav-links.open {
    display: flex;
}

.nav-links a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 0.65rem 1.25rem;
    transition: background 0.2s;
    font-size: 0.95rem;
}

.nav-links a:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.nav-logout {
    color: #fca5a5 !important;
    border-top: 1px solid rgba(255,255,255,0.1);
}

@media (min-width: 768px) {
    .nav-toggle { display: none; }
    .nav-links {
        display: flex;
        flex-direction: row;
        width: auto;
        background: none;
        gap: 0;
    }
    .nav-links a {
        padding: 0.75rem 0.9rem;
        border-radius: 0;
    }
    .nav-links a:hover {
        background: rgba(255,255,255,0.12);
    }
    .nav-logout {
        border-top: none;
        border-left: 1px solid rgba(255,255,255,0.15);
    }
}

/* Container */
.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 1.25rem 1rem;
    flex: 1;
    width: 100%;
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-weight: 500;
    border-left: 4px solid;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-left-color: var(--vert);
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-left-color: var(--rouge);
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-left-color: var(--bleu-clair);
}

/* Cards */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-top: 3px solid var(--orange);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--bleu);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--bleu);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--bleu-clair);
    box-shadow: 0 0 0 3px rgba(59, 125, 216, 0.15);
}

select.form-control {
    appearance: auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    min-height: 44px;
}

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

.btn-primary {
    background: var(--bleu);
    color: #fff;
}

.btn-primary:hover {
    background: var(--bleu-clair);
    box-shadow: 0 2px 8px rgba(59, 125, 216, 0.3);
}

.btn-success {
    background: var(--vert);
    color: #fff;
}

.btn-success:hover {
    background: #219a52;
}

.btn-danger {
    background: var(--rouge);
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    min-height: 36px;
}

.btn:disabled, .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.7rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    background: var(--bleu);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

tr:nth-child(even) {
    background: var(--gray-50);
}

tr:hover {
    background: #eef4fb;
}

/* Badges regime */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-normal {
    background: #d6eaf8;
    color: #1a5276;
}

.badge-sv {
    background: #d5f5e3;
    color: #1e8449;
}

.badge-sp {
    background: #fdebd0;
    color: #b9520c;
}

.badge-pr {
    background: #fadbd8;
    color: #922b21;
}

/* Pointage checklist */
.pointage-list {
    list-style: none;
}

.pointage-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.5rem;
    border-bottom: 1px solid var(--gray-200);
    transition: background 0.15s;
}

.pointage-item:hover {
    background: #fef9f0;
}

.pointage-item:last-child {
    border-bottom: none;
}

.pointage-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--orange);
    flex-shrink: 0;
}

.pointage-name {
    flex: 1;
    font-weight: 500;
}

.pointage-actions {
    flex-shrink: 0;
}

/* Stats cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border-bottom: 3px solid var(--jaune);
    transition: transform 0.15s;
}

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

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--bleu);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

/* Login page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bleu) 0%, #2c5282 50%, var(--bleu) 100%);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 70%, rgba(232, 117, 26, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(245, 197, 24, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.login-container {
    max-width: 400px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255,255,255,0.3);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    background: #fff;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    padding: 2rem;
    border-top: 4px solid var(--orange);
}

.login-title {
    text-align: center;
    margin-bottom: 0.25rem;
    color: var(--bleu);
    font-size: 1.4rem;
    font-weight: 800;
}

.login-subtitle {
    text-align: center;
    color: var(--gray-500);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--gray-700);
    min-width: 40px;
    text-align: center;
}

.pagination .active {
    background: var(--bleu);
    color: #fff;
    border-color: var(--bleu);
}

/* Action bar */
.action-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.action-bar .spacer {
    flex: 1;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    color: var(--gray-500);
    font-size: 0.8rem;
    margin-top: auto;
    background: var(--bleu);
    color: rgba(255,255,255,0.7);
}

.footer-color-bar {
    height: 4px;
    background: linear-gradient(to right, var(--rouge) 0%, var(--rouge) 20%, var(--orange) 20%, var(--orange) 40%, var(--jaune) 40%, var(--jaune) 60%, var(--bleu-clair) 60%, var(--bleu-clair) 80%, var(--bleu) 80%, var(--bleu) 100%);
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.d-flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Print */
@media print {
    .navbar, .footer, .footer-color-bar, .nav-color-bar, .btn, .action-bar, .nav-toggle { display: none !important; }
    body { background: #fff; }
    .container { max-width: 100%; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; border-top: none; }
}

/* QR code print */
.qr-print-page {
    page-break-after: always;
    text-align: center;
    padding: 2rem;
}

.qr-print-page img {
    max-width: 300px;
}

.qr-print-page h2 {
    margin-top: 1rem;
    font-size: 1.5rem;
    color: var(--bleu);
}
