/* ==========================================================================
   OwnedCrew - Feuille de style principale
   Approche mobile first : les styles de base s'appliquent au plus petit
   écran (téléphone), et on ajoute de la complexité progressivement pour
   les écrans plus larges via des media queries min-width.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Palette de couleurs
   Toutes les couleurs de l'application sont définies ici une seule fois.
   Pour changer une teinte partout, il suffit de modifier la valeur ici.
   -------------------------------------------------------------------------- */
:root {
    /* fonds */
    --bg: #0a0e1a;
    --bg-panel: rgba(255, 255, 255, 0.04);
    --bg-panel-border: rgba(255, 255, 255, 0.08);
    --bg-solide: #0d1220;

    /* accents */
    --accent-cyan: #22d3ee;
    --accent-purple: #8b5cf6;

    /* texte */
    --text-primary: #e2e8f0;
    --text-muted: #94a3b8;

    /* etats (alertes stock bas, succes, avertissements) */
    --color-success: #34d399;
    --color-danger: #f87171;
    --color-warning: #fbbf24;

    /* rayons et espacements reutilises partout, pour rester coherent */
    --radius: 12px;
    --spacing: 1rem;
}

/* --------------------------------------------------------------------------
   2. Reinitialisation de base
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--accent-cyan);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    font-weight: 600;
    margin-top: 0;
}

/* --------------------------------------------------------------------------
   3. Mise en page generale
   -------------------------------------------------------------------------- */
.page {
    padding: var(--spacing);
}

@media (min-width: 900px) {
    .page {
        padding: calc(var(--spacing) * 2);
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* --------------------------------------------------------------------------
   4. Cartes (composant reutilise partout : dashboard, listes, formulaires)
   Effet "verre" : fond semi-transparent + flou de l'arriere-plan.
   -------------------------------------------------------------------------- */
.card {
    background: var(--bg-panel);
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius);
    padding: var(--spacing);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.card h2 {
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
}

/* une seule colonne sur mobile, plusieurs sur grand ecran */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing);
}

@media (min-width: 600px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --------------------------------------------------------------------------
   5. Boutons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    border: none;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    color: var(--bg);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    opacity: 0.9;
    text-decoration: none;
}

/* --------------------------------------------------------------------------
   6. Tableaux (utilises par toutes les listes : Contacts, Notes, Stock...)
   -------------------------------------------------------------------------- */
table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.6rem;
    text-align: left;
    border-bottom: 1px solid var(--bg-panel-border);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   7. Menu (bouton hamburger sur mobile, barre laterale sur grand ecran)
   -------------------------------------------------------------------------- */
.nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    margin: var(--spacing);
    background: var(--bg-panel);
    border: 1px solid var(--bg-panel-border);
    border-radius: var(--radius);
    cursor: pointer;
}

.nav-toggle-bar {
    display: block;
    height: 2px;
    margin: 0 auto;
    width: 20px;
    background: var(--text-primary);
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: var(--spacing);
    background: #0d1220;
    border-right: 1px solid var(--bg-panel-border);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 10;
}

.sidebar.is-open {
    transform: translateX(0);
}

.sidebar a {
    color: var(--text-primary);
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius);
}

.sidebar a:hover {
    background: var(--bg-panel);
    text-decoration: none;
}

.sidebar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: var(--spacing);
    color: var(--accent-cyan);
}

@media (min-width: 900px) {
    .nav-toggle {
        display: none;
    }

    .app-shell {
        display: flex;
    }

    .sidebar {
        position: sticky;
        top: 0;
        transform: none;
        flex-shrink: 0;
    }

    .content {
        flex: 1;
        min-width: 0;
    }
}


.stock-visuel {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}

.sidebar-logo {
    width: 140px;
    margin-bottom: var(--spacing);
}

.page-header {
    display: flex;
    flex-direction: column;
    gap: var(--spacing);
    margin-bottom: var(--spacing);
}

.page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (min-width: 600px) {
    .page-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* --------------------------------------------------------------------------
   8. Tableau de bord (page d'accueil)
   -------------------------------------------------------------------------- */
.dashboard-liste {
    list-style: none;
    margin: 0 0 var(--spacing) 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dashboard-liste li {
    display: flex;
    flex-direction: column;
}

.dashboard-liste-detail {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.dashboard-stock {
    list-style: none;
    margin: 0 0 var(--spacing) 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.dashboard-stock-ligne {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.dashboard-stock-barre {
    height: 6px;
    border-radius: 999px;
    background: var(--bg-panel-border);
    overflow: hidden;
    margin-top: 0.25rem;
}

.dashboard-stock-barre-remplie {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    border-radius: 999px;
}

/* --------------------------------------------------------------------------
   9. Calendrier (FullCalendar) - integration avec le theme sombre
   -------------------------------------------------------------------------- */
.fc {
    --fc-border-color: var(--bg-panel-border);
    --fc-page-bg-color: transparent;
    --fc-neutral-bg-color: var(--bg-panel);
    --fc-list-event-hover-bg-color: var(--bg-panel);
    --fc-today-bg-color: rgba(34, 211, 238, 0.08);
    --fc-event-bg-color: var(--accent-purple);
    --fc-event-border-color: var(--accent-purple);
    --fc-event-text-color: #ffffff;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.fc .fc-toolbar-title {
    color: var(--text-primary);
    font-size: 1.1rem;
}

.fc .fc-button {
    background: var(--bg-panel);
    border: 1px solid var(--bg-panel-border);
    color: var(--text-primary);
    text-transform: capitalize;
    box-shadow: none;
}

.fc .fc-button:hover {
    background: var(--bg-panel-border);
}

.fc .fc-button-primary:not(:disabled).fc-button-active {
    background: var(--accent-cyan);
    border-color: var(--accent-cyan);
    color: var(--bg);
}

.fc .fc-daygrid-day-number,
.fc .fc-col-header-cell-cushion {
    color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   10. Formulaires (tous les creer/modifier de l'appli)
   Par defaut, les champs de formulaire Symfony n'ont aucun style et restent
   blancs -- ca jure avec le theme sombre. On les habille ici une seule fois,
   pour que tous les formulaires de l'appli en profitent automatiquement.
   -------------------------------------------------------------------------- */
form div {
    margin-bottom: 1rem;
}

form label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    max-width: 420px;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius);
    border: 1px solid var(--bg-panel-border);
    background: var(--bg-panel);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
}

/* la liste deroulante d'un <select> s'affiche dans une fenetre geree par le
   systeme, pas dans la page elle-meme : le fond translucide du champ ne s'y
   applique pas. Sans cette regle, chaque option apparaissait sur un fond
   quasiment blanc avec un texte clair dessus, illisible. */
select option {
    background: var(--bg-solide);
    color: var(--text-primary);
}

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

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

/* inverse la couleur de l'icone du calendrier natif, noire par defaut,
   invisible sur fond sombre (fonctionne sur Chrome/Edge) */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* --------------------------------------------------------------------------
   11. Carte (Leaflet)
   Leaflet a besoin d'une hauteur explicite sur son conteneur, sinon la carte
   ne s'affiche pas du tout (aucune erreur, juste un espace vide).
   -------------------------------------------------------------------------- */
.carte-conteneur {
    height: 60vh;
    min-height: 320px;
    border-radius: var(--radius);
    margin-bottom: var(--spacing);
}

.carte-legende {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.carte-pastille {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.35rem;
    vertical-align: middle;
}

/* variante compacte utilisee dans la card du tableau de bord */
.carte-conteneur--mini {
    height: 260px;
    min-height: 220px;
}
