/* =====================================================
   MOOMOO CAFÉ - DESIGN SYSTEM
   Thème : Vache rose moderne & élégant
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;0,9..144,800;1,9..144,400&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Palette principale - rose vache */
    --pink-50: #fff5f9;
    --pink-100: #ffe4ef;
    --pink-200: #ffc9de;
    --pink-300: #ffa5c8;
    --pink-400: #ff7eb9;
    --pink-500: #ff5fa5;
    --pink-600: #e63d8a;
    --pink-700: #c4286f;
    --pink-800: #9a1f57;
    --pink-900: #6b1a3f;

    /* Neutres */
    --white: #ffffff;
    --cream: #fef9f5;
    --milk: #fafafa;
    --gray-100: #f7f3f5;
    --gray-200: #e8e0e4;
    --gray-300: #c9bcc3;
    --gray-400: #998690;
    --gray-500: #6b5862;
    --gray-600: #4a3d44;
    --gray-700: #2e252a;
    --gray-900: #1a1418;

    /* Accents */
    --black-spot: #2e252a; /* Tâches noires de la vache */
    --accent-gold: #d4af37;
    --accent-mint: #b4e8d4;
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #ef4444;
    --info: #60a5fa;

    /* Typographie */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;

    /* Espacements */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-xl: 32px;
    --radius-full: 999px;

    /* Ombres */
    --shadow-sm: 0 2px 8px rgba(255, 95, 165, 0.08);
    --shadow-md: 0 8px 24px rgba(255, 95, 165, 0.12);
    --shadow-lg: 0 20px 50px rgba(255, 95, 165, 0.18);
    --shadow-xl: 0 30px 80px rgba(255, 95, 165, 0.25);

    /* Transitions */
    --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --t-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--cream);
    color: var(--gray-700);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 15% 10%, rgba(255, 165, 200, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(255, 126, 185, 0.12) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Motif tâches de vache en arrière-plan décoratif */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    background-image:
        radial-gradient(ellipse 80px 60px at 10% 20%, rgba(46, 37, 42, 0.025) 50%, transparent 51%),
        radial-gradient(ellipse 100px 70px at 90% 70%, rgba(46, 37, 42, 0.02) 50%, transparent 51%),
        radial-gradient(ellipse 60px 90px at 70% 15%, rgba(46, 37, 42, 0.025) 50%, transparent 51%),
        radial-gradient(ellipse 70px 50px at 25% 85%, rgba(46, 37, 42, 0.02) 50%, transparent 51%);
    z-index: -1;
}

h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    color: var(--gray-900);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.5rem; }

a { color: var(--pink-600); text-decoration: none; transition: var(--t-fast); }
a:hover { color: var(--pink-700); }

/* =====================================================
   LAYOUT GÉNÉRAL
   ===================================================== */

.app-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    background: linear-gradient(180deg, var(--white) 0%, var(--pink-50) 100%);
    border-right: 1px solid var(--pink-100);
    padding: 1.75rem 1.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem 1.5rem;
    border-bottom: 2px dashed var(--pink-200);
    margin-bottom: 1.25rem;
}

.sidebar-logo-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--pink-400) 0%, var(--pink-600) 100%);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: var(--shadow-md);
    position: relative;
    transform: rotate(-3deg);
    transition: var(--t-normal);
}

.sidebar-logo:hover .sidebar-logo-icon {
    transform: rotate(3deg) scale(1.05);
}

/* Tâches sur le logo */
.sidebar-logo-icon::before,
.sidebar-logo-icon::after {
    content: '';
    position: absolute;
    background: var(--gray-900);
    border-radius: 50%;
    opacity: 0.85;
}
.sidebar-logo-icon::before {
    width: 14px; height: 10px;
    top: 8px; right: 6px;
    border-radius: 60% 40% 50% 50%;
}
.sidebar-logo-icon::after {
    width: 10px; height: 8px;
    bottom: 8px; left: 8px;
    border-radius: 40% 60% 50% 50%;
}

.sidebar-logo-text h1 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.1;
    font-style: italic;
}

.sidebar-logo-text span {
    font-size: 0.7rem;
    color: var(--pink-600);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gray-400);
    font-weight: 700;
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 0.875rem;
    color: var(--gray-600);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    transition: var(--t-fast);
    position: relative;
}

.sidebar-link-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.sidebar-link:hover {
    background: var(--pink-100);
    color: var(--pink-700);
    transform: translateX(2px);
}

.sidebar-link.active {
    background: linear-gradient(135deg, var(--pink-500) 0%, var(--pink-600) 100%);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--pink-700);
    border-radius: 0 4px 4px 0;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--pink-100);
}

.user-card {
    background: var(--white);
    padding: 0.875rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--pink-100);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pink-300), var(--pink-500));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-info strong {
    display: block;
    font-size: 0.85rem;
    color: var(--gray-700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-info small {
    color: var(--gray-400);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* MAIN CONTENT */
.main-content {
    padding: 2rem 2.5rem;
    overflow-x: hidden;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--pink-100);
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.1;
}

.page-title .accent {
    color: var(--pink-600);
    font-style: italic;
}

.page-subtitle {
    color: var(--gray-400);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* =====================================================
   COMPOSANTS
   ===================================================== */

/* CARDS */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--pink-100);
    transition: var(--t-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--pink-100);
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
}

/* STAT CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--pink-100);
    position: relative;
    overflow: hidden;
    transition: var(--t-normal);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 120px; height: 120px;
    background: radial-gradient(circle, var(--pink-100) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(40%, -40%);
}

.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--pink-400), var(--pink-600));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--white);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
}

.stat-trend {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 600;
}
.stat-trend.down { color: var(--danger); }

/* BOUTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: var(--t-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--pink-500), var(--pink-600));
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--white);
}

.btn-secondary {
    background: var(--white);
    color: var(--pink-600);
    border: 1px solid var(--pink-200);
}

.btn-secondary:hover {
    background: var(--pink-50);
    border-color: var(--pink-300);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}
.btn-ghost:hover { background: var(--pink-50); color: var(--pink-600); }

.btn-danger {
    background: var(--danger);
    color: var(--white);
}
.btn-danger:hover { background: #dc2626; transform: translateY(-2px); color: var(--white); }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }

/* FORMS */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-700);
}

.form-label.required::after {
    content: '*';
    color: var(--danger);
    margin-left: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--gray-700);
    background: var(--white);
    transition: var(--t-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--pink-400);
    box-shadow: 0 0 0 4px rgba(255, 126, 185, 0.15);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* TABLES */
.table-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--pink-100);
    box-shadow: var(--shadow-sm);
}

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

.data-table thead {
    background: var(--pink-50);
}

.data-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pink-700);
    font-weight: 700;
    border-bottom: 2px solid var(--pink-100);
}

.data-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pink-100);
    font-size: 0.9rem;
    color: var(--gray-700);
}

.data-table tbody tr {
    transition: var(--t-fast);
}

.data-table tbody tr:hover {
    background: var(--pink-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: white; }
.badge-patron { background: linear-gradient(135deg, var(--pink-500), var(--pink-600)); color: white; }
.badge-employe { background: var(--accent-mint); color: #065f46; }

.badge-draft { background: var(--gray-200); color: var(--gray-600); }
.badge-sent { background: #dbeafe; color: #1e40af; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* FLASH MESSAGES */
.flash {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

.flash-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.flash-error { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.flash-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.flash-info { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--info); }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(46, 37, 42, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--gray-100);
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--t-fast);
}

.modal-close:hover {
    background: var(--pink-100);
    transform: rotate(90deg);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h3 {
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--gray-400);
    font-size: 0.9rem;
}

/* UTILS */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-end { display: flex; justify-content: flex-end; gap: 0.5rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-400); }
.text-pink { color: var(--pink-600); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.font-bold { font-weight: 700; }

.actions-cell {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.icon-btn {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--pink-50);
    color: var(--pink-600);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--t-fast);
    text-decoration: none;
}

.icon-btn:hover { background: var(--pink-200); transform: scale(1.1); }
.icon-btn.danger { background: #fee2e2; color: var(--danger); }
.icon-btn.danger:hover { background: var(--danger); color: white; }

/* RESPONSIVE */
@media (max-width: 1024px) {
    .app-layout { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: -280px;
        z-index: 100;
        transition: left var(--t-normal);
    }
    .sidebar.open { left: 0; }
    .main-content { padding: 1.5rem; }
}

@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
    .page-title { font-size: 1.75rem; }
    .stats-grid { grid-template-columns: 1fr; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 0.75rem; }
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--pink-50); }
::-webkit-scrollbar-thumb { background: var(--pink-300); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--pink-400); }
