/* ─── Google Sans Code ────────────────────────────────────────────────────── */
@font-face {
    font-family: 'Google Sans Code';
    src: url('/fonts/GoogleSansCode-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Google Sans Code';
    src: url('/fonts/GoogleSansCode-Italic-VariableFont_wght.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

@import 'tailwindcss';

@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';

/* ─── AZ-TAG Design Tokens ────────────────────────────────────────────────── */
@theme {
    --font-sans: 'Google Sans Code', ui-sans-serif, system-ui, sans-serif;
    --font-mono: 'Google Sans Code', ui-monospace, monospace;

    --color-az-primary:     #2563eb;
    --color-az-primary-dk:  #1e40af;
    --color-az-secondary:   #0f172a;
    --color-az-accent:      #10b981;
    --color-az-accent-dk:   #059669;
    --color-az-danger:      #ef4444;
    --color-az-warning:     #f59e0b;
    --color-az-bg:          #f8fafc;
    --color-az-sidebar:     #0f172a;
    --color-az-sidebar-hover: #1e293b;
    --color-az-border:      #e2e8f0;
    --color-az-text:        #0f172a;
    --color-az-muted:       #64748b;
}

/* ─── Base ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Google Sans Code', ui-sans-serif, system-ui, sans-serif;
    background: #f8fafc;
    color: #0f172a;
    min-height: 100vh;
}

/* ─── Layout ──────────────────────────────────────────────────────────────── */
.atelier-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 40;
}
.sidebar-logo {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo img { height: 36px; }
.sidebar-logo .app-name {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    margin-top: 0.5rem;
}
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}
.nav-section {
    padding: 0.25rem 0.75rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    margin-top: 1rem;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.6rem 1.25rem;
    color: rgba(255,255,255,0.65);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}
.nav-link:hover {
    background: #1e293b;
    color: #fff;
}
.nav-link.active {
    background: rgba(37,99,235,0.15);
    color: #fff;
    border-left-color: #2563eb;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.shortcut-hint {
    margin-left: auto;
    font-size: 0.62rem;
    font-weight: 700;
    color: rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.06);
    padding: 1px 6px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
}
.sidebar-footer .user-name { color: rgba(255,255,255,0.8); font-weight: 600; }

/* Main content */
.main-content {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar-title {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}
.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.page-body {
    padding: 1.75rem;
    flex: 1;
}

/* ─── Cards ───────────────────────────────────────────────────────────────── */
.card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1.25rem;
}
.card-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-bottom: 0.5rem;
}
.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
}
.kpi-value.success { color: #10b981; }
.kpi-value.danger  { color: #ef4444; }
.kpi-value.primary { color: #2563eb; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
}
.btn:active { transform: scale(0.98); }
.btn-primary  { background: #2563eb; color: #fff; }
.btn-primary:hover  { background: #1e40af; }
.btn-success  { background: #10b981; color: #fff; }
.btn-success:hover  { background: #059669; }
.btn-danger   { background: #ef4444; color: #fff; }
.btn-danger:hover   { background: #dc2626; }
.btn-ghost    { background: transparent; color: #64748b; border: 1px solid #e2e8f0; }
.btn-ghost:hover    { background: #f1f5f9; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.35rem;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.55rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-family: inherit;
    color: #0f172a;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.form-error { font-size: 0.8rem; color: #ef4444; margin-top: 0.25rem; }
.form-hint  { font-size: 0.78rem; color: #64748b; margin-top: 0.25rem; }

/* ─── Badges / Status ─────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}
.badge-success  { background: #d1fae5; color: #065f46; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-warning  { background: #fef3c7; color: #92400e; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-muted    { background: #f1f5f9; color: #475569; }

/* ─── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 0.75rem; border: 1px solid #e2e8f0; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
table.data-table th {
    background: #f8fafc;
    padding: 0.65rem 1rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
}
table.data-table td {
    padding: 0.7rem 1rem;
    color: #0f172a;
    border-bottom: 1px solid #f1f5f9;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: #f8fafc; }

/* ─── Progress bar ────────────────────────────────────────────────────────── */
.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: #2563eb;
    border-radius: 9999px;
    transition: width 0.4s ease;
}
.progress-bar-fill.success { background: #10b981; }

/* ─── Reset result ────────────────────────────────────────────────────────── */
.step-line {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.step-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.step-icon.pending  { background: #f1f5f9; color: #64748b; }
.step-icon.running  { background: #dbeafe; color: #2563eb; }
.step-icon.ok       { background: #d1fae5; color: #059669; }
.step-icon.fail     { background: #fee2e2; color: #dc2626; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.8s linear infinite; }

/* ─── Alerts / Flash ──────────────────────────────────────────────────────── */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ─── Agent status ────────────────────────────────────────────────────────── */
.agent-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.agent-dot.online  { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,0.2); }
.agent-dot.offline { background: #94a3b8; }

/* ─── Login page ──────────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}
.login-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.35);
}
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo img { height: 48px; }
.login-title {
    font-size: 1.1rem;
    font-weight: 800;
    text-align: center;
    color: #0f172a;
    margin-bottom: 0.25rem;
}
.login-sub {
    font-size: 0.8rem;
    text-align: center;
    color: #64748b;
    margin-bottom: 1.75rem;
}

/* ─── Brand selector ──────────────────────────────────────────────────────── */
.brand-selector {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.brand-option { display: none; }
.brand-label {
    flex: 1;
    min-width: 120px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.875rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.625rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.brand-option:checked + .brand-label {
    border-color: #2563eb;
    background: rgba(37,99,235,0.07);
    color: #1e40af;
}

/* ─── Scan input ──────────────────────────────────────────────────────────── */
.scan-input-wrap {
    position: relative;
}
.scan-input {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.875rem 3rem 0.875rem 1rem;
    border: 2px solid #2563eb;
    border-radius: 0.625rem;
}
.scan-input:focus {
    box-shadow: 0 0 0 4px rgba(37,99,235,0.15);
}
.scan-icon {
    position: absolute;
    right: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #2563eb;
    pointer-events: none;
}

/* ─── Pagination ──────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 0.25rem; align-items: center; flex-wrap: wrap; }
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #475569;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    transition: background 0.1s;
}
.page-link:hover { background: #f1f5f9; }
.page-link.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.page-link.disabled { opacity: 0.4; pointer-events: none; }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { width: 100%; min-height: auto; position: relative; }
    .main-content { margin-left: 0; }
    .atelier-layout { flex-direction: column; }
}

/* ─── Inventaire ESL ──────────────────────────────────────────────────────── */
.inv-filter {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 0.78rem;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.inv-filter:hover  { background: #f1f5f9; }
.inv-filter.active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* Dropdown "Charger depuis l'AP" */
.load-ap-option {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    text-align: left;
    background: none;
    border: none;
    font-size: 0.82rem;
    color: #374151;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.1s;
}
.load-ap-option:hover { background: #f1f5f9; }

/* ─── Bouton warning (pour locate timeout) ────────────────────────────────── */
.btn-warning       { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }

/* ─── Localiser une ESL ──────────────────────────────────────────────────── */
.locate-group {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.locate-color {
    padding: 0.18rem 0.3rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-family: inherit;
    color: #374151;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
}
.locate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

/* ─── Dark mode ───────────────────────────────────────────────────────────── */
body.dark {
    background: #0f172a;
    color: #e2e8f0;
}
body.dark .topbar {
    background: #1e293b;
    border-color: #334155;
}
body.dark .topbar-title { color: #e2e8f0; }
body.dark .card {
    background: #1e293b;
    border-color: #334155;
}
body.dark .card-title { color: #94a3b8; }
body.dark .kpi-value { color: #e2e8f0; }
body.dark .form-label { color: #cbd5e1; }
body.dark .form-input,
body.dark .form-select,
body.dark .form-textarea {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}
body.dark .form-hint { color: #94a3b8; }
body.dark .table-wrap { border-color: #334155; }
body.dark table.data-table th {
    background: #1e293b;
    color: #94a3b8;
    border-color: #334155;
}
body.dark table.data-table td {
    color: #e2e8f0;
    border-color: #1e293b;
}
body.dark table.data-table tr:hover td { background: #0f172a; }
body.dark .btn-ghost {
    color: #94a3b8;
    border-color: #334155;
}
body.dark .btn-ghost:hover { background: #0f172a; }
body.dark .step-line { border-color: #334155; }
body.dark .badge-muted { background: #334155; color: #94a3b8; }
body.dark .brand-label {
    border-color: #334155;
    color: #94a3b8;
}
body.dark .brand-option:checked + .brand-label {
    border-color: #3b82f6;
    background: rgba(59,130,246,0.12);
    color: #93c5fd;
}
body.dark .scan-input {
    border-color: #3b82f6;
    background: #0f172a;
    color: #e2e8f0;
}
body.dark .scan-icon { color: #60a5fa; }
body.dark .inv-filter {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}
body.dark .inv-filter:hover { background: #0f172a; }
body.dark .inv-filter.active { background: #2563eb; color: #fff; border-color: #2563eb; }
body.dark .load-ap-option { color: #cbd5e1; }
body.dark .load-ap-option:hover { background: #0f172a; }
body.dark #load-ap-menu { background: #1e293b; border-color: #334155; }
body.dark .locate-color { background: #0f172a; border-color: #334155; color: #cbd5e1; }
body.dark .page-link { color: #94a3b8; border-color: #334155; }
body.dark .page-link:hover { background: #1e293b; }
body.dark .progress-bar { background: #334155; }
body.dark .alert-success { background: #064e3b; color: #a7f3d0; border-color: #065f46; }
body.dark .alert-danger  { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }
body.dark .alert-warning { background: #78350f; color: #fde68a; border-color: #92400e; }
body.dark .alert-info    { background: #1e3a5f; color: #bfdbfe; border-color: #1e40af; }
body.dark .esl-card-ap  { background: #0f172a; border-color: #334155; }
body.dark .text-muted   { color: #94a3b8 !important; }
