/**
 * mypro.ch · Admin — Styles
 * Variante violette du thème manager (différenciation visuelle admin vs manager).
 */

:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #a78bfa;
    --secondary: #1f2937;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --bg-primary: #f9fafb;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;

    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.625rem 1.25rem; border-radius: var(--radius-lg);
    font-weight: 600; font-size: 0.875rem;
    border: none; cursor: pointer; transition: all 0.2s; line-height: 1;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white; box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(124, 58, 237, 0.35); }
.btn-primary:disabled { background: #d1d5db; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary { background: #f3f4f6; color: var(--secondary); font-weight: 500; }
.btn-secondary:hover { background: #e5e7eb; }

.btn-success { background: linear-gradient(135deg, #22c55e, #16a34a); color: white; font-weight: 500; }
.btn-warning { background: var(--warning); color: white; font-weight: 500; }
.btn-warning:hover { background: #d97706; }
.btn-danger { background: var(--danger); color: white; font-weight: 500; }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 0.5rem 0.875rem; font-size: 0.8125rem; }
.btn-icon {
    width: 2.25rem; height: 2.25rem; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-lg);
    background: #f3f4f6; border: none; cursor: pointer; transition: all 0.2s;
}
.btn-icon:hover { background: #e5e7eb; }

/* ===== Cards ===== */
.card {
    background: var(--bg-card); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-color);
    padding: 1.25rem;
}
.card-flat { box-shadow: none; }

/* Sectioned card (header + body) used in detail tabs */
.card-section { padding: 0; overflow: hidden; }
.card-section .card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    background: #fafafa;
    display: flex; align-items: center; justify-content: space-between;
}
.card-section .card-header h2 {
    font-size: 0.95rem; font-weight: 700; color: #1f2937;
    display: flex; align-items: center; gap: 0.5rem; margin: 0;
}
.card-section .card-header .card-hint {
    font-size: 0.75rem; color: #6b7280;
}
.card-section .card-body { padding: 18px; }
.card-section .card-body > * + * { margin-top: 0.75rem; }

/* Toggle pill (used inside section rows) */
.toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 0;
}
.toggle-row + .toggle-row { border-top: 1px solid #f3f4f6; }
.toggle-row .toggle-info { display: flex; align-items: flex-start; gap: 0.6rem; }
.toggle-row .toggle-info i { color: var(--primary, #7c3aed); margin-top: 3px; }
.toggle-row .toggle-info .toggle-title { font-weight: 600; color: #1f2937; font-size: 0.875rem; }
.toggle-row .toggle-info .toggle-desc { font-size: 0.72rem; color: #6b7280; margin-top: 2px; }

.stat-card {
    background: white; border-radius: var(--radius-xl);
    padding: 1.25rem; border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm); transition: all 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ===== Forms ===== */
.input {
    width: 100%; padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border-color); border-radius: var(--radius-lg);
    font-size: 0.875rem; background: white; transition: all 0.2s; outline: none;
    font-family: inherit;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1); }

.field { display: block; margin-bottom: 0; }
.field label {
    display: block; font-size: 0.8125rem; font-weight: 500;
    color: var(--text-secondary); margin-bottom: 0.375rem;
}

.search-input {
    flex: 1; min-width: 240px; padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border-color); border-radius: var(--radius-lg);
    font-size: 0.875rem; outline: none; background: white;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1); }

.toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }

/* ===== Sidebar ===== */
.sidebar {
    width: 16rem; background: white;
    border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column;
}
.sidebar-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color); }
.sidebar-logo { display: flex; align-items: center; gap: 0.75rem; }
.sidebar-logo-icon {
    width: 2.5rem; height: 2.5rem; border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), #6366f1);
    display: flex; align-items: center; justify-content: center; color: white;
}
.sidebar-nav { flex: 1; padding: 0.75rem; overflow-y: auto; }
.sidebar-section-title {
    font-size: 0.6875rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 0.875rem 0.75rem 0.375rem;
}
.sidebar-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5rem 0.75rem; border-radius: var(--radius-lg);
    cursor: pointer; transition: all 0.15s; color: var(--text-secondary);
    font-weight: 500; font-size: 0.875rem; margin: 1px 0;
}
.sidebar-item:hover { background: rgba(124, 58, 237, 0.08); color: var(--primary); }
.sidebar-item.active {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white; box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}
.sidebar-item-icon { width: 1.125rem; text-align: center; font-size: 0.875rem; }
.sidebar-footer { padding: 0.75rem; border-top: 1px solid var(--border-color); }

/* ===== Page header ===== */
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap;
}
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.page-subtitle { font-size: 0.875rem; color: var(--text-secondary); margin-top: 0.25rem; }

/* ===== Tabs ===== */
.tabs-bar {
    display: flex; gap: 0.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem; overflow-x: auto; scrollbar-width: thin;
}
.tabs-bar::-webkit-scrollbar { height: 4px; }
.tabs-bar::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }
.tab-link {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.75rem 1rem; font-size: 0.875rem; font-weight: 500;
    color: var(--text-secondary); border-bottom: 2px solid transparent;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
    background: none; border-left: none; border-right: none; border-top: none;
    margin-bottom: -1px;
}
.tab-link:hover { color: var(--text-primary); }
.tab-link.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-link i { font-size: 0.8125rem; opacity: 0.85; }

.tab-btn {
    padding: 0.5rem 0.875rem; border-radius: var(--radius-md);
    font-size: 0.8125rem; font-weight: 600; color: var(--text-secondary);
    background: #f3f4f6; border: none; cursor: pointer; transition: all 0.15s;
}
.tab-btn:hover { background: #e5e7eb; }
.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white; box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

/* ===== Tables ===== */
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td {
    text-align: left; padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color); font-size: 0.875rem;
}
table.data th {
    color: var(--text-secondary); font-weight: 600;
    font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em;
    background: #f9fafb;
}
table.data tbody tr { transition: background 0.15s; }
table.data tbody tr:hover { background: #f9fafb; }
table.data .row-link, .row-link { cursor: pointer; }
table.data tbody tr:last-child td { border-bottom: none; }

/* ===== Badges ===== */
.badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.25rem 0.625rem; border-radius: 9999px;
    font-size: 0.6875rem; font-weight: 600;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warn    { background: #fef3c7; color: #b45309; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
.badge-info    { background: #dbeafe; color: #1d4ed8; }
.badge-muted   { background: #f3f4f6; color: #6b7280; }
.badge-violet  { background: #ede9fe; color: #6d28d9; }

/* ===== Modal ===== */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.55); backdrop-filter: blur(4px);
    z-index: 50; display: flex; align-items: center; justify-content: center;
    padding: 1rem; animation: fadeIn 0.2s ease-out;
}
.modal {
    background: var(--bg-card); border-radius: var(--radius-xl);
    max-width: 720px; width: 100%; max-height: 92vh; overflow: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: scaleIn 0.2s ease-out;
}
.modal-header {
    padding: 1.125rem 1.5rem; border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer {
    padding: 0.875rem 1.5rem; border-top: 1px solid var(--border-color);
    display: flex; gap: 0.5rem; justify-content: flex-end;
}

/* ===== Detail rows ===== */
.detail-row {
    display: grid; grid-template-columns: 160px 1fr; gap: 0.75rem;
    padding: 0.5rem 0; border-bottom: 1px solid var(--border-color); font-size: 0.875rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .label { color: var(--text-secondary); font-weight: 500; }

/* ===== Loading / Empty ===== */
.loading-spinner {
    width: 2.5rem; height: 2.5rem;
    border: 3px solid var(--border-color); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
.spinner-dot {
    width: 1.125rem; height: 1.125rem;
    border: 2px solid #fff; border-top-color: transparent;
    border-radius: 50%; animation: spin 0.6s linear infinite;
}

/* ===== Toast ===== */
.toast {
    position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 100;
    padding: 0.75rem 1.25rem; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); font-size: 0.875rem; font-weight: 500;
    background: white; border-left: 4px solid var(--primary);
    animation: slideIn 0.25s ease-out;
}
.toast-success { border-left-color: var(--success); color: #15803d; }
.toast-error   { border-left-color: var(--danger);  color: #b91c1c; }

/* ===== Animations ===== */
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn  { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideIn  { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .detail-row { grid-template-columns: 1fr; gap: 0.25rem; }
    .detail-row .label { font-size: 0.75rem; }
}

/* ============== Operator row (liste centrales) ============== */
.operator-row {
    transition: all 0.15s ease;
    border: 1px solid var(--border-color);
}
.operator-row:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 12px -4px rgba(124, 58, 237, 0.15);
    transform: translateY(-1px);
}

/* =====================================================
   CENTRAL MAP PICKER
   ===================================================== */
.cmp-map-wrap { position: relative; }
.cmp-map {
    height: 360px;
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    background: #eef2f7;
}
.cmp-layer-switch {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 500;
    display: flex; gap: 4px;
    background: #fff;
    padding: 4px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.cmp-layer-switch__btn {
    appearance: none; border: 0; background: transparent;
    color: #4b5563;
    font-size: 0.78rem; font-weight: 600;
    padding: 6px 10px;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.15s;
}
.cmp-layer-switch__btn:hover { background: #f3f4f6; color: #111827; }
.cmp-layer-switch__btn.active { background: #7c3aed; color: #fff; box-shadow: 0 1px 2px rgba(124, 58, 237, 0.4); }

.cmp-sugg {
    position: absolute; z-index: 50;
    top: 100%; left: 0; right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    max-height: 280px;
    overflow: auto;
}
.cmp-sugg__item {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.12s;
}
.cmp-sugg__item:last-child { border-bottom: 0; }
.cmp-sugg__item:hover { background: #f9fafb; }

/* ─── LogoDropzone ─── */
.logo-dz {
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    padding: 10px;
    background: #fff;
    display: flex; flex-direction: column;
    transition: border-color .15s, background .15s;
}
.logo-dz--over { border-color: #6366f1; background: #eef2ff; }
.logo-dz__head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 8px; margin-bottom: 8px;
}
.logo-dz__label { font-weight: 600; font-size: 13px; color: #1e293b; }
.logo-dz__hint  { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.logo-dz__del {
    background: #fee2e2; color: #dc2626;
    border: none; border-radius: 8px;
    width: 28px; height: 28px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; transition: background .15s;
}
.logo-dz__del:hover { background: #fecaca; }
.logo-dz__zone {
    position: relative;
    flex: 1; min-height: 120px;
    border-radius: 8px;
    background: #fafafa;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; overflow: hidden;
    transition: background .15s;
}
.logo-dz__zone:hover { background: #f1f5f9; }
.logo-dz--dark .logo-dz__zone { background: #1f2937; }
.logo-dz--dark .logo-dz__zone:hover { background: #111827; }
.logo-dz__img {
    max-width: 100%; max-height: 140px;
    object-fit: contain;
}
.logo-dz__empty {
    text-align: center; color: #94a3b8;
    padding: 16px;
}
.logo-dz--dark .logo-dz__empty { color: #94a3b8; }
.logo-dz__overlay {
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.7);
    display: flex; align-items: center; justify-content: center;
}
