@tailwind base;
@tailwind components;
@tailwind utilities;

/* Police d'icônes Material Symbols — hébergée en local (fonctionne sans internet) */
@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 100 700;
    src: url(../assets/material-symbols.woff2) format('woff2');
}
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Toast */
.toast {
    @apply px-4 py-3 rounded-xl shadow-lg text-sm font-medium max-w-xs;
    animation: toast-in 0.3s ease-out, toast-out 0.3s 2.7s ease-in forwards;
}

.toast-success { @apply bg-gray-800 text-white; }
.toast-error { @apply bg-red-600 text-white; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

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

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Number inputs without spinners */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }

/* Sidebar active state */
.nav-link.bg-gray-800 { border-left: 3px solid #3b82f6; }

/* Print */
@media print {
    #sidebar, #sidebar-overlay, header, #toast-container { display: none !important; }
    main { margin: 0 !important; }
}

/* ===== Thème sombre ===== */
html.dark { color-scheme: dark; }
html.dark body { background: #0f172a; color: #e2e8f0; }

html.dark .bg-white { background-color: #1e293b !important; }
html.dark .bg-gray-50 { background-color: #172033 !important; }
html.dark .bg-gray-100 { background-color: #0f172a !important; }

html.dark .text-gray-900,
html.dark .text-gray-800 { color: #f1f5f9 !important; }
html.dark .text-gray-700 { color: #e2e8f0 !important; }
html.dark .text-gray-600 { color: #cbd5e1 !important; }
html.dark .text-gray-500 { color: #94a3b8 !important; }
html.dark .text-gray-400 { color: #74839a !important; }

html.dark .border,
html.dark .border-t,
html.dark .border-b,
html.dark .border-l,
html.dark .border-r,
html.dark .border-gray-200,
html.dark .border-gray-300 { border-color: #334155 !important; }

html.dark .hover\:bg-gray-50:hover { background-color: #243247 !important; }
html.dark .hover\:bg-gray-100:hover { background-color: #243247 !important; }
html.dark .hover\:bg-gray-200:hover { background-color: #2d3c54 !important; }

/* Pastilles / boutons à fond clair */
html.dark .bg-blue-50 { background-color: #1e3a5f !important; }
html.dark .bg-red-50 { background-color: #4a1d24 !important; }
html.dark .bg-emerald-50 { background-color: #143a2e !important; }
html.dark .bg-red-100 { background-color: #5b232b !important; }
html.dark .text-blue-700 { color: #93c5fd !important; }
html.dark .text-red-700, html.dark .text-red-600 { color: #fca5a5 !important; }
html.dark .text-emerald-700, html.dark .text-emerald-600 { color: #6ee7b7 !important; }
html.dark .hover\:bg-blue-100:hover { background-color: #27496e !important; }
html.dark .hover\:bg-red-100:hover { background-color: #5b232b !important; }
html.dark .hover\:bg-emerald-100:hover { background-color: #1a4a3a !important; }

/* Champs de saisie */
html.dark input,
html.dark select,
html.dark textarea { background-color: #1e293b !important; color: #e2e8f0 !important; border-color: #334155 !important; }
html.dark input::placeholder { color: #64748b !important; }
html.dark option { background-color: #1e293b; color: #e2e8f0; }

/* Scrollbar sombre */
html.dark ::-webkit-scrollbar-thumb { background: #475569; }
html.dark ::-webkit-scrollbar-thumb:hover { background: #64748b; }
