/* ===== Admin CSS — Générateur de sites partenaires ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --sidebar-bg: #1e3a5f;
    --sidebar-w: 250px;
    --primary: #1a56db;
    --primary-dark: #1644b0;
    --success: #16a34a;
    --danger: #dc2626;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-500: #64748b;
    --gray-700: #334155;
    --gray-900: #0f172a;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

body { font-family: 'Inter', sans-serif; background: var(--gray-50); color: var(--gray-900); }

/* Sidebar */
.admin-body { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar-bg); color: #fff; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header h2 { font-size: 1.3rem; font-weight: 700; }
.sidebar-subtitle { font-size: 0.8rem; color: rgba(255,255,255,0.6); }
.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1.5rem; color: rgba(255,255,255,0.7); text-decoration: none; transition: all 0.2s; font-size: 0.9rem; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item svg { flex-shrink: 0; }
.sidebar-footer { padding: 1rem 1.5rem; border-top: 1px solid rgba(255,255,255,0.1); font-size: 0.85rem; display: flex; justify-content: space-between; align-items: center; }
.logout-link { color: rgba(255,255,255,0.6); text-decoration: none; }
.logout-link:hover { color: #fff; }

/* Main content */
.main-content { flex: 1; margin-left: var(--sidebar-w); }
.top-header { background: #fff; border-bottom: 1px solid var(--gray-200); padding: 1rem 2rem; display: flex; align-items: center; justify-content: space-between; }
.top-header h1 { font-size: 1.25rem; font-weight: 700; color: var(--gray-900); }
.mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; color: var(--gray-700); }
.content-area { padding: 2rem; }

/* Alerts */
.alert { padding: 0.85rem 1rem; border-radius: var(--radius); margin: 0 2rem 0; font-size: 0.9rem; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }

/* Dashboard stats */
.dashboard-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); text-align: center; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--gray-500); margin-top: 0.25rem; }

/* Section header */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.section-header h2 { font-size: 1.1rem; font-weight: 600; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1.1rem; border-radius: var(--radius); font-size: 0.9rem; font-weight: 500; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--gray-700); border-color: var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-500); }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

/* Partners grid */
.partners-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.partner-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.partner-card-header { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 0.85rem; }
.partner-logo { width: 44px; height: 44px; border-radius: 8px; object-fit: contain; background: var(--gray-50); }
.partner-logo-placeholder { width: 44px; height: 44px; border-radius: 8px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; flex-shrink: 0; }
.partner-card-header h3 { font-size: 1rem; font-weight: 600; }
.partner-slug { font-size: 0.8rem; color: var(--gray-500); }
.partner-card-meta { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.85rem; }
.badge { padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: #f0fdf4; color: var(--success); }
.badge-draft { background: var(--gray-100); color: var(--gray-500); }
.date { font-size: 0.8rem; color: var(--gray-500); }
.partner-card-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* Empty state */
.empty-state { text-align: center; padding: 3rem; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
.empty-state p { margin: 1rem 0; color: var(--gray-500); }

/* Form — sidebar layout */
.partner-form { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-wrap: wrap; min-height: 600px; }
.form-sidebar { width: 220px; min-width: 220px; background: var(--gray-50); border-right: 1px solid var(--gray-200); border-radius: var(--radius) 0 0 var(--radius); padding: 0.75rem 0; position: sticky; top: 0; align-self: flex-start; max-height: calc(100vh - 80px); overflow-y: auto; }
.form-sidebar-group { margin-bottom: 0.25rem; }
.form-sidebar-group-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); padding: 0.6rem 1rem 0.3rem; }
.tab-btn { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.5rem 1rem; background: none; border: none; border-left: 3px solid transparent; font-size: 0.83rem; font-weight: 500; color: var(--gray-500); cursor: pointer; white-space: nowrap; transition: all 0.15s; text-align: left; }
.tab-btn:hover { color: var(--gray-700); background: var(--gray-100); }
.tab-btn.active { color: var(--primary); border-left-color: var(--primary); background: #fff; font-weight: 600; }
.tab-btn svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.6; }
.tab-btn.active svg { opacity: 1; }
.form-main { flex: 1; min-width: 0; }
.tab-content { display: none; padding: 1.5rem; }
.tab-content.active { display: block; }
.form-section-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 1.25rem; color: var(--gray-900); }
.form-section-title small { font-weight: 400; color: var(--gray-500); font-size: 0.85rem; }
.form-subsection { font-size: 0.95rem; font-weight: 600; margin: 1.25rem 0 0.75rem; color: var(--gray-700); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; font-size: 0.85rem; color: var(--gray-700); margin-bottom: 0.3rem; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 0.55rem 0.75rem; border: 1px solid var(--gray-300); border-radius: var(--radius); font-size: 0.9rem; font-family: inherit; transition: border-color 0.2s; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }
.form-group input[type="file"] { padding: 0.4rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-actions { padding: 1.25rem 1.5rem; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 0.75rem; width: 100%; }

/* Color input */
.color-input { display: flex; align-items: center; gap: 0.75rem; }
.color-input input[type="color"] { width: 48px; height: 38px; border: 1px solid var(--gray-300); border-radius: var(--radius); cursor: pointer; padding: 2px; }
.color-value { font-size: 0.9rem; color: var(--gray-500); font-family: monospace; }

/* Logo preview */
.logo-preview { margin-top: 0.5rem; }
.logo-preview img { max-width: 150px; max-height: 80px; border-radius: var(--radius); background: var(--gray-50); padding: 0.25rem; }

/* Repeatable items */
.repeatable-container { margin-bottom: 1rem; }
.repeatable-item { position: relative; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1rem; margin-bottom: 0.75rem; }
.btn-remove { position: absolute; top: 0.5rem; right: 0.5rem; background: none; border: none; color: var(--danger); font-size: 1.3rem; cursor: pointer; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.btn-remove:hover { background: #fef2f2; }
.btn-add { margin-top: 0.5rem; }

/* AI Suggest buttons */
.btn-ai-suggest { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.55rem; background: linear-gradient(135deg, #8b5cf6, #6366f1); color: #fff; border: none; border-radius: 12px; font-size: 0.7rem; font-weight: 600; cursor: pointer; transition: all 0.2s; margin-left: 0.4rem; vertical-align: middle; font-family: inherit; }
.btn-ai-suggest:hover { background: linear-gradient(135deg, #7c3aed, #4f46e5); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(99,102,241,0.35); }
.btn-ai-suggest:disabled, .btn-ai-suggest.ai-loading { opacity: 0.6; cursor: wait; transform: none; box-shadow: none; }
.btn-ai-suggest.ai-loading { animation: ai-pulse 1.2s ease-in-out infinite; }
@keyframes ai-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }

/* Char count */
.char-count { font-weight: 400; font-size: 0.8rem; color: var(--gray-500); }

/* FTP Deploy */
.ftp-deploy-container { max-width: 600px; }
.ftp-info { margin-bottom: 1.5rem; color: var(--gray-700); }
.ftp-form { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; margin-bottom: 1.5rem; }
.ftp-progress { margin-bottom: 1.5rem; }
.progress-bar { height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; margin-bottom: 0.5rem; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.5s ease; width: 0; }
.ftp-status { font-size: 0.9rem; color: var(--gray-700); }
.ftp-status.success { color: var(--success); }
.ftp-status.error { color: var(--danger); }
.ftp-log { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.ftp-log h3 { font-size: 0.95rem; margin-bottom: 0.75rem; }
.ftp-log pre { background: var(--gray-900); color: #e2e8f0; padding: 1rem; border-radius: var(--radius); font-size: 0.8rem; overflow-x: auto; max-height: 300px; overflow-y: auto; }

/* Mobile form sidebar toggle */
.form-sidebar-toggle { display: none; align-items: center; gap: 0.5rem; padding: 0.75rem 1rem; background: var(--gray-50); border: none; border-bottom: 1px solid var(--gray-200); width: 100%; font-size: 0.85rem; font-weight: 600; color: var(--gray-700); cursor: pointer; border-radius: var(--radius) var(--radius) 0 0; }
.form-sidebar-toggle svg { width: 18px; height: 18px; }

/* Preview Panel */
.preview-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 50%;
    height: 100vh;
    background: #fff;
    border-left: 2px solid var(--gray-200);
    z-index: 200;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
}
.preview-active .main-content {
    width: 50%;
}
.preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    gap: 0.75rem;
    flex-shrink: 0;
}
.preview-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.preview-toolbar-left strong {
    font-size: 0.85rem;
    color: var(--gray-700);
}
.preview-toolbar-left select {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-family: inherit;
}
.preview-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.preview-iframe-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    background: var(--gray-100);
    overflow: hidden;
}
.preview-iframe-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
    transition: width 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: block; }
    .content-area { padding: 1rem; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .partners-grid { grid-template-columns: 1fr; }
    .dashboard-stats { grid-template-columns: 1fr; }
    .partner-form { flex-direction: column; }
    .form-sidebar { width: 100%; min-width: 100%; position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--gray-200); border-radius: var(--radius) var(--radius) 0 0; padding: 0.5rem 0; display: none; }
    .form-sidebar.open { display: block; }
    .form-sidebar-toggle { display: flex; }
    .tab-btn { border-left: none; border-bottom: none; padding: 0.55rem 1rem; }
    .tab-btn.active { border-left: 3px solid var(--primary); }
    .preview-panel { width: 100%; height: 50vh; position: fixed; bottom: 0; top: auto; left: 0; border-left: none; border-top: 2px solid var(--gray-200); }
    .preview-active .main-content { width: 100%; }
}
