/*
 * Fiabli Theme Override
 * Primary color : #DD9805 (gold deep)
 * Accent color  : #FECB27 (gold light)
 * Navy text     : #1F2937
 * Override les couleurs par défaut avec la palette officielle Fiabli (gold/navy)
 */

:root {
    /* Fiabli Gold palette */
    --fiabli-50:  #FFFBEB;
    --fiabli-100: #FEF3C7;
    --fiabli-200: #FDE38A;
    --fiabli-300: #FECB27;
    --fiabli-400: #F9B713;
    --fiabli-500: #F5B006;
    --fiabli-600: #DD9805;
    --fiabli-700: #B57D04;
    --fiabli-800: #8D6203;
    --fiabli-900: #5C4002;
    --fiabli-950: #382702;

    /* Navy (texte/contrast) */
    --fiabli-navy:      #1F2937;
    --fiabli-navy-deep: #111827;
    --fiabli-navy-50:   #F1F4F9;

    /* Accent (alt) */
    --fiabli-accent:       #FECB27;
    --fiabli-accent-light: #FEE07A;
    --fiabli-accent-dark:  #DD9805;

    /* Gradient brand */
    --fiabli-gradient: linear-gradient(135deg, #FECB27 0%, #F5B006 35%, #DD9805 100%);
    --fiabli-gradient-soft: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);

    /* Tokens primaires (override Tailwind/Bootstrap si chargés) */
    --primary: #DD9805 !important;
    --primary-foreground: #ffffff !important;
    --ring: #F5B006 !important;
}

.dark {
    --primary: #FECB27 !important;
    --primary-foreground: #1F2937 !important;

    --background: #111827 !important;
    --foreground: #FFF8E1 !important;

    --card: #1F2937 !important;
    --card-foreground: #FFF8E1 !important;

    --popover: #1F2937 !important;
    --popover-foreground: #FFF8E1 !important;

    --secondary: #1F2937 !important;
    --secondary-foreground: #FFF8E1 !important;

    --muted: #111827 !important;
    --muted-foreground: #9AA8C0 !important;

    --accent: #374151 !important;
    --accent-foreground: #FFF8E1 !important;

    --border: #374151 !important;
    --input: #374151 !important;
    --ring: #FECB27 !important;
}

/* Boutons primaires */
.btn-primary,
.kt-btn-primary {
    background-color: #DD9805 !important;
    border-color: #DD9805 !important;
    color: #ffffff !important;
}

.btn-primary:hover,
.kt-btn-primary:hover {
    background-color: #B57D04 !important;
    border-color: #B57D04 !important;
}

.btn-primary:active,
.btn-primary:focus {
    background-color: #8D6203 !important;
    border-color: #8D6203 !important;
}

/* Texte primaire */
.text-primary {
    color: #DD9805 !important;
}

.dark .text-primary {
    color: #FECB27 !important;
}

/* Background primaire */
.bg-primary {
    background-color: #DD9805 !important;
}

.bg-primary\/10 {
    background-color: rgba(221, 152, 5, 0.1) !important;
}

/* Border primaire */
.border-primary {
    border-color: #DD9805 !important;
}

/* Focus visible */
*:focus-visible {
    outline-color: #F5B006 !important;
}

/* Checkbox / radio */
input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background-color: #DD9805 !important;
    border-color: #DD9805 !important;
}

/* Select / input focus */
select:focus,
input:focus,
textarea:focus {
    border-color: #F5B006 !important;
    box-shadow: 0 0 0 3px rgba(245, 176, 6, 0.2) !important;
}

/* Badge */
.badge-primary {
    background-color: #DD9805 !important;
    color: #ffffff !important;
}

a.text-primary:hover {
    color: #8D6203 !important;
}

/* Accent (gradient) */
.text-accent {
    color: #FECB27 !important;
}

.bg-accent {
    background-color: #FECB27 !important;
}

/* Star rating accent */
.star-rating .star-filled {
    color: #FECB27;
}

/* Progress bar IA */
.ai-progress-bar {
    background: var(--fiabli-gradient) !important;
}

/* Dark mode helpers */
.dark .bg-gray-800 { background-color: #111827 !important; }
.dark .bg-gray-900 { background-color: #111827 !important; }
.dark .border-gray-700 { border-color: #374151 !important; }
.dark .border-gray-800 { border-color: #1F2937 !important; }

.dark .card {
    background-color: #1F2937 !important;
    border-color: #374151 !important;
}

.dark .sidebar,
.dark [class*="sidebar"] {
    background-color: #111827 !important;
}

.dark .table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(254, 203, 39, 0.04) !important;
}

.dark .hover\:bg-gray-800:hover {
    background-color: #374151 !important;
}

/* ============================================
   Onboarding Stepper
   ============================================ */

.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin: 0 auto;
    max-width: 400px;
}

.stepper-step {
    display: flex;
    align-items: center;
}

.stepper-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #d1d5db;
    color: #9ca3af;
    background: #ffffff;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
}

.stepper-dot.active {
    border-color: #DD9805;
    color: #ffffff;
    background: #DD9805;
    box-shadow: 0 0 0 4px rgba(221, 152, 5, 0.18);
}

.stepper-dot.completed {
    border-color: #22c55e;
    color: #ffffff;
    background: #22c55e;
}

.stepper-dot.completed::after {
    content: '';
    display: block;
    width: 10px;
    height: 6px;
    border-left: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    transform: rotate(-45deg);
    margin-top: -2px;
}

.stepper-dot.completed span { display: none; }

.stepper-line {
    width: 48px;
    height: 2px;
    background: #d1d5db;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.stepper-line.completed { background: #22c55e; }

/* ============================================
   SIRET Search Modal (Dialog)
   ============================================ */

.siret-dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 23, 43, 0.55);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.siret-dialog-backdrop.open { opacity: 1; visibility: visible; }

.siret-dialog {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(11, 23, 43, 0.25);
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.siret-dialog-backdrop.open .siret-dialog { transform: scale(1); }

.siret-dialog-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.siret-dialog-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #1F2937;
    margin: 0;
}

.siret-dialog-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: background 0.15s;
}

.siret-dialog-close:hover { background: #f3f4f6; }

.siret-dialog-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.siret-dialog-search {
    position: relative;
    margin-bottom: 1rem;
}

.siret-dialog-search input {
    width: 100%;
    padding: 0.625rem 0.75rem 0.625rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.siret-dialog-search input:focus {
    border-color: #F5B006;
    box-shadow: 0 0 0 3px rgba(245, 176, 6, 0.15);
}

.siret-dialog-search .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

.siret-result-item {
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.siret-result-item:hover {
    border-color: #F5B006;
    background: #FFFBEB;
}

.siret-result-item .company-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: #1F2937;
}

.siret-result-item .company-details {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.siret-result-item .company-siret {
    font-size: 0.75rem;
    color: #DD9805;
    font-family: monospace;
    margin-top: 0.125rem;
}

.siret-loading,
.siret-no-results {
    text-align: center;
    padding: 1.5rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.siret-loading .spinner-sm {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #DD9805;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-bottom: 0.5rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   Onboarding Step Content
   ============================================ */

.onboarding-step { display: none; }
.onboarding-step.active { display: block; animation: fadeInStep 0.3s ease; }

@keyframes fadeInStep {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Location card */
.location-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: border-color 0.15s, background 0.15s;
    cursor: pointer;
}

.location-card:hover {
    border-color: #F5B006;
    background: #FFFBEB;
}

.location-card input[type="checkbox"]:checked ~ .location-info {
    color: #DD9805;
}

.location-info .location-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: #1F2937;
}

.location-info .location-address {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Sync progress */
.sync-progress-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

.sync-progress-item .sync-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top-color: #DD9805;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}

.sync-progress-item .sync-check {
    color: #22c55e;
    flex-shrink: 0;
}

.sync-progress-item .sync-error {
    color: #ef4444;
    flex-shrink: 0;
}
