/* ============================================================
   main.css — Crenosante
   ============================================================ */

/* --- Variables --- */
:root {
    --green:       #1D9E75;
    --green-light: #e8f5e9;
    --green-dark:  #15785a;
    --red:         #e53e3e;
    --orange:      #dd6b20;
    --blue:        #378ADD;
    --gray-50:     #f9fafb;
    --gray-100:    #f3f4f6;
    --gray-200:    #e5e7eb;
    --gray-400:    #9ca3af;
    --gray-600:    #4b5563;
    --gray-800:    #1f2937;
    --white:       #ffffff;
    --radius:      8px;
    --shadow:      0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg:   0 10px 15px rgba(0,0,0,.10), 0 4px 6px rgba(0,0,0,.05);
    --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: var(--font); color: var(--gray-800); background: var(--gray-50); line-height: 1.6; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
ul { list-style: none; }
small { font-size: .85em; color: var(--gray-400); }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--gray-100); }
.auth-container { width: 100%; max-width: 440px; padding: 1rem; }
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo h1 { font-size: 2rem; color: var(--green); }
.auth-logo p  { color: var(--gray-600); font-size: .95rem; }
.auth-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 2rem; }
.auth-card h2 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: .9rem; color: var(--gray-600); }

/* ============================================================
   WIZARD
   ============================================================ */
.wizard-container { width: 100%; max-width: 560px; padding: 1rem; margin: 0 auto; }
.wizard-steps { display: flex; align-items: center; justify-content: center; margin-bottom: 1.5rem; gap: 0; }
.wizard-step { display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.wizard-step__num {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--gray-200); color: var(--gray-600);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .9rem;
}
.wizard-step--active .wizard-step__num  { background: var(--green); color: #fff; }
.wizard-step--done .wizard-step__num    { background: var(--green-dark); color: #fff; }
.wizard-step__label { font-size: .78rem; color: var(--gray-600); }
.wizard-sep { flex: 1; height: 2px; background: var(--gray-200); min-width: 40px; margin: 0 4px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: .35rem; color: var(--gray-800); }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%; padding: .55rem .75rem;
    border: 1px solid var(--gray-200); border-radius: var(--radius);
    font-size: .95rem; font-family: var(--font); background: var(--white);
    transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(29,158,117,.15); }
.form-group input[type="color"] { height: 44px; padding: .2rem; cursor: pointer; }
.form-group--checkbox label { display: flex; align-items: flex-start; gap: .5rem; font-weight: normal; cursor: pointer; }
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.form-group--sm { flex: 0 0 120px !important; }

/* Jours toggle */
.jours-grid { display: flex; gap: .5rem; flex-wrap: wrap; }
.jour-toggle { cursor: pointer; user-select: none; }
.jour-toggle input { display: none; }
.jour-toggle span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 50%;
    border: 2px solid var(--gray-200); font-size: .9rem; font-weight: 600;
    color: var(--gray-600); transition: all .15s;
}
.jour-toggle input:checked + span { background: var(--green); border-color: var(--green); color: #fff; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1.2rem; border-radius: var(--radius);
    font-size: .9rem; font-weight: 600; cursor: pointer;
    border: 2px solid transparent; transition: all .15s; font-family: var(--font);
    text-decoration: none;
}
.btn--primary  { background: var(--green); color: #fff; border-color: var(--green); }
.btn--primary:hover { background: var(--green-dark); border-color: var(--green-dark); text-decoration: none; }
.btn--outline  { background: transparent; color: var(--green); border-color: var(--green); }
.btn--outline:hover { background: var(--green-light); text-decoration: none; }
.btn--danger   { background: var(--red); color: #fff; border-color: var(--red); }
.btn--danger:hover { background: #c53030; border-color: #c53030; }
.btn--full     { width: 100%; }
.btn--sm       { padding: .3rem .8rem; font-size: .82rem; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: .75rem 1rem; border-radius: var(--radius);
    font-size: .9rem; margin-bottom: 1rem;
}
.alert--error   { background: #fff5f5; border: 1px solid #fed7d7; color: #c53030; }
.alert--success { background: #f0fff4; border: 1px solid #9ae6b4; color: #276749; }
.alert--warning { background: #fffbeb; border: 1px solid #fbd38d; color: #975a16; }
.alert--info    { background: #ebf8ff; border: 1px solid #bee3f8; color: #2c5282; }
.alert ul { padding-left: 1.2rem; list-style: disc; }

/* ============================================================
   APP LAYOUT (admin)
   ============================================================ */
.app-page { display: flex; flex-direction: column; min-height: 100vh; }
.app-main  { flex: 1; padding: 1.5rem; max-width: 1400px; margin: 0 auto; width: 100%; }

/* --- Navbar --- */
.navbar {
    display: flex; align-items: center; gap: 1.5rem;
    background: var(--white); border-bottom: 1px solid var(--gray-200);
    padding: .75rem 1.5rem; position: sticky; top: 0; z-index: 100;
}
.navbar-brand a { font-size: 1.1rem; font-weight: 800; color: var(--green); text-decoration: none; }
.navbar-menu { display: flex; gap: .25rem; flex: 1; }
.navbar-menu li a {
    padding: .4rem .75rem; border-radius: var(--radius);
    color: var(--gray-600); font-size: .9rem; font-weight: 500;
    transition: background .15s; text-decoration: none;
}
/* Cibler uniquement le lien direct (> a) pour éviter la cascade sur les sous-menus */
.navbar-menu > li.active > a,
.navbar-menu > li > a:hover { background: var(--green-light); color: var(--green); text-decoration: none; }

/* Sous-menu paramètres */
.navbar-submenu {
    display: flex; gap: .35rem; padding: .4rem 0 0; flex-wrap: wrap;
}
.navbar-submenu li a {
    padding: .2rem .55rem; font-size: .8rem; border-radius: var(--radius);
    color: var(--gray-500); background: transparent;
}
.navbar-submenu li a:hover,
.navbar-submenu li.sub-active a {
    background: var(--green-light); color: var(--green);
}
.navbar-user { display: flex; align-items: center; gap: .75rem; font-size: .85rem; color: var(--gray-600); }

/* --- Agenda toolbar --- */
.agenda-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem; flex-wrap: wrap; gap: .75rem;
}
.agenda-toolbar h2 { font-size: 1.3rem; }
.agenda-filters { display: flex; align-items: center; gap: .75rem; }
.agenda-filters select { padding: .4rem .75rem; border: 1px solid var(--gray-200); border-radius: var(--radius); }

/* FullCalendar overrides */
#calendar { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.fc-event { cursor: pointer; }
.fc-timegrid-event .fc-event-title { font-size: .8rem; }
.fc .fc-button { background: var(--green) !important; border-color: var(--green) !important; font-size: .85rem !important; }
.fc .fc-button:hover { background: var(--green-dark) !important; border-color: var(--green-dark) !important; }
.fc .fc-button-active { background: var(--green-dark) !important; }

/* ============================================================
   MODAL
   ============================================================ */
.modal { display: none; position: fixed; inset: 0; z-index: 500; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.modal-content {
    position: relative; background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 2rem; width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto; z-index: 1;
}
.modal-close { position: absolute; top: 1rem; right: 1rem; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--gray-400); }
.modal-close:hover { color: var(--gray-800); }
.modal h3 { font-size: 1.2rem; margin-bottom: 1rem; }
.modal-date { color: var(--green); font-weight: 600; margin-bottom: 1rem; }
.modal-actions { display: flex; gap: .75rem; margin-top: 1.5rem; }

/* ============================================================
   PATIENT SEARCH
   ============================================================ */
#patient-results { border: 1px solid var(--gray-200); border-radius: var(--radius); margin-top: .25rem; background: var(--white); max-height: 200px; overflow-y: auto; }
.search-item { padding: .5rem .75rem; cursor: pointer; font-size: .9rem; border-bottom: 1px solid var(--gray-100); }
.search-item:hover { background: var(--green-light); }
.search-item--new { color: var(--green); font-weight: 600; }
.search-item small { color: var(--gray-400); margin-left: .5rem; }

/* ============================================================
   DETAIL TABLE
   ============================================================ */
.detail-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.detail-table td { padding: .5rem .25rem; font-size: .9rem; vertical-align: top; }
.detail-table td:first-child { color: var(--gray-600); width: 100px; white-space: nowrap; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999;
    padding: .75rem 1.25rem; border-radius: var(--radius);
    font-size: .9rem; font-weight: 600; box-shadow: var(--shadow-lg);
    animation: slideIn .25s ease;
}
.toast--success { background: var(--green); color: #fff; }
.toast--error   { background: var(--red); color: #fff; }
.toast--warning { background: var(--orange); color: #fff; }
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .form-row { flex-direction: column; }
    .form-group--sm { flex: 1 !important; }
    .navbar-menu { display: none; } /* TODO: burger menu */
    .app-main { padding: 1rem; }
    .agenda-toolbar { flex-direction: column; align-items: flex-start; }
    .modal-content { margin: 1rem; }
    .auth-card { padding: 1.5rem; }
}
