/* ============================================================
   EmailPro — Feuille de style principale
   Thème : Industriel sombre / Accent orange vif
   Typographie : Syne (titres) + DM Sans (corps)
   ============================================================ */

/* ── Variables ──────────────────────────────────────────── */
:root {
    --bg-base:       #0f1117;
    --bg-panel:      #161b27;
    --bg-card:       #1c2234;
    --bg-card-hover: #212840;
    --bg-input:      #141928;
    --border:        #272f45;
    --border-light:  #1f2840;

    --accent:        #f97316;     /* orange vif */
    --accent-dim:    #c2540f;
    --accent-glow:   rgba(249,115,22,.18);

    --blue:          #3b82f6;
    --indigo:        #6366f1;
    --green:         #22c55e;
    --amber:         #f59e0b;
    --red:           #ef4444;
    --purple:        #a855f7;

    --text-primary:  #e8eaf2;
    --text-secondary:#8b93ab;
    --text-muted:    #4f5972;

    --font-display:  'Syne', sans-serif;
    --font-body:     'DM Sans', sans-serif;

    --radius:        10px;
    --radius-sm:     6px;
    --sidebar-w:     240px;
    --shadow:        0 4px 24px rgba(0,0,0,.45);
}

/* ── Reset de base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    padding: 0;
}

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    overflow-x: hidden;
}

.content-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 36px 32px 80px;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar-logo {
    padding: 28px 24px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    font-size: 22px;
    background: var(--accent);
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.logo-text strong {
    color: var(--accent);
    font-weight: 800;
}

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: .9rem;
    font-weight: 500;
    transition: all .18s;
    text-decoration: none;
}

.nav-item a:hover,
.nav-item.active a {
    background: var(--accent-glow);
    color: var(--accent);
}

.nav-item.active a {
    border-left: 3px solid var(--accent);
    padding-left: 11px;
}

.nav-icon { font-size: 1.1rem; }

.sidebar-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--border);
}

.version {
    font-size: .75rem;
    color: var(--text-muted);
}

/* ── Page header ────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title .icon { font-size: 1.4rem; }

.header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .18s;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-dim);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-card-hover); color: var(--text-primary); text-decoration: none; }

.btn-success  { background: var(--green);  color: #fff; }
.btn-success:hover { opacity: .85; text-decoration: none; }

.btn-warning  { background: var(--amber);  color: #111; }
.btn-warning:hover { opacity: .85; text-decoration: none; }

.btn-danger   { background: var(--red);    color: #fff; }
.btn-danger:hover { opacity: .85; text-decoration: none; }

.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-icon { font-size: 1rem; }

/* ── Stats grid ─────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 20px;
    position: relative;
    overflow: hidden;
    transition: transform .18s, box-shadow .18s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.stat-blue::before   { background: var(--blue); }
.stat-indigo::before { background: var(--indigo); }
.stat-green::before  { background: var(--green); }
.stat-amber::before  { background: var(--amber); }
.stat-red::before    { background: var(--red); }
.stat-purple::before { background: var(--purple); }

.stat-icon {
    font-size: 1.4rem;
    margin-bottom: 10px;
    display: block;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
    transition: color .3s;
}

.stat-label {
    font-size: .78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body { padding: 24px; }

/* ── Section title ──────────────────────────────────────── */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    margin-top: 40px;
}

.section-title h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.link-more {
    font-size: .82rem;
    color: var(--accent);
    font-weight: 500;
}

/* Live indicator */
.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.live-dot {
    width: 7px; height: 7px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%,100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .4; transform: scale(1.5); }
}

/* ── Campaign row (dashboard) ───────────────────────────── */
.campaign-row {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
    transition: border-color .18s;
    flex-wrap: wrap;
}

.campaign-row:hover { border-color: var(--accent); }

.campaign-row-info { flex: 1; min-width: 200px; }

.campaign-row-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
}

.campaign-row-meta {
    display: flex;
    gap: 12px;
    font-size: .78rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.campaign-row-progress { flex: 2; min-width: 200px; }

/* ── Progress bar ───────────────────────────────────────── */
.progress-bar {
    background: var(--bg-base);
    border-radius: 99px;
    height: 7px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #fb923c);
    border-radius: 99px;
    transition: width .5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 30px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.2));
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0%   { transform: translateX(-30px); opacity: 0; }
    50%  { opacity: 1; }
    100% { transform: translateX(10px);  opacity: 0; }
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: .78rem;
    color: var(--text-secondary);
}

.progress-labels strong {
    color: var(--accent);
    font-weight: 700;
}

/* ── Campaign cards (campaigns.php) ────────────────────── */
.campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
}

.campaign-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: all .18s;
    position: relative;
}

.campaign-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.campaign-card.status-running  { border-left: 4px solid var(--green); }
.campaign-card.status-paused   { border-left: 4px solid var(--amber); }
.campaign-card.status-pending  { border-left: 4px solid var(--blue); }
.campaign-card.status-finished { border-left: 4px solid var(--text-muted); opacity: .7; }

.campaign-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.campaign-card-header h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
}

.campaign-meta {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 16px;
    font-size: .8rem;
}

.meta-item { display: flex; gap: 8px; }
.meta-label {
    color: var(--text-muted);
    min-width: 70px;
    font-weight: 500;
}

.progress-wrap { margin-bottom: 14px; }

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: .75rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

.prog-pct { color: var(--accent); font-weight: 700; }

.failed-notice {
    font-size: .78rem;
    color: var(--amber);
    margin-bottom: 12px;
}

.campaign-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
    margin-top: 4px;
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge-running  { background: rgba(34,197,94,.15);  color: var(--green); }
.badge-pending  { background: rgba(59,130,246,.15); color: var(--blue); }
.badge-paused   { background: rgba(245,158,11,.15); color: var(--amber); }
.badge-finished { background: rgba(79,89,114,.15);  color: var(--text-muted); }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

.data-table th {
    background: var(--bg-base);
    color: var(--text-muted);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: var(--bg-card-hover); }

.log-row-success td { border-left: none; }
.log-row-failed  td:first-child { border-left: 2px solid var(--red); }

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 99px;
}

.status-success { background: rgba(34,197,94,.12);  color: var(--green); }
.status-failed  { background: rgba(239,68,68,.12);  color: var(--red); }

.td-id    { color: var(--text-muted); font-size: .78rem; }
.td-date  { white-space: nowrap; font-size: .78rem; }
.td-error { color: var(--red); font-size: .78rem; max-width: 200px; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group {
    margin-bottom: 18px;
    flex: 1;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-row .form-group { min-width: 220px; }

label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.required { color: var(--accent); }

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: .9rem;
    transition: border-color .18s, box-shadow .18s;
    outline: none;
    -webkit-appearance: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea.form-control {
    resize: vertical;
    min-height: 160px;
    font-family: 'DM Mono', monospace, var(--font-body);
    font-size: .85rem;
    line-height: 1.6;
}

select.form-control option { background: var(--bg-card); }

.form-hint {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    margin-top: 8px;
    border-top: 1px solid var(--border-light);
}

/* Tag helpers */
.tag-helpers {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: .75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.tag-btn {
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: var(--radius-sm);
    padding: 2px 9px;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    font-family: monospace;
}

.tag-btn:hover {
    background: var(--accent);
    color: #fff;
}

/* ── Drop zone ──────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    position: relative;
    background: var(--bg-input);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.drop-zone-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.drop-zone-icon { font-size: 2.5rem; margin-bottom: 10px; }

.drop-zone-text {
    font-size: .95rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.drop-zone-hint {
    font-size: .78rem;
    color: var(--text-muted);
}

.drop-zone-filename {
    margin-top: 12px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--accent);
    min-height: 20px;
}

/* ── Code block ─────────────────────────────────────────── */
.code-block {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: .82rem;
    color: var(--green);
    white-space: pre;
    overflow-x: auto;
    margin: 12px 0;
    line-height: 1.7;
}

.hint {
    font-size: .8rem;
    color: var(--text-muted);
}

code {
    background: var(--bg-base);
    padding: 1px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: .88em;
    color: var(--accent);
}

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: .88rem;
    border-left: 4px solid;
}

.alert-success { background: rgba(34,197,94,.1);  border-color: var(--green); color: var(--green); }
.alert-error   { background: rgba(239,68,68,.1);  border-color: var(--red);   color: #f87171; }
.alert-warning { background: rgba(245,158,11,.1); border-color: var(--amber); color: var(--amber); }

.error-list {
    margin-top: 8px;
    padding-left: 18px;
    font-size: .82rem;
    opacity: .85;
}

.error-list li { margin-bottom: 2px; }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.open {
    display: flex;
    animation: fadeIn .2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp .22s ease;
}

.modal-lg { max-width: 760px; }

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all .15s;
}

.modal-close:hover { background: var(--bg-base); color: var(--text-primary); }

.modal-body { padding: 24px; }

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state p { margin-bottom: 20px; }

.empty-state-sm {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: .85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 28px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 7px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: .83rem;
    font-weight: 500;
    transition: all .15s;
    text-decoration: none;
}

.page-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Filter bar ─────────────────────────────────────────── */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 99px;
    color: var(--text-secondary);
    font-size: .82rem;
    font-weight: 600;
    transition: all .15s;
    text-decoration: none;
}

.filter-btn:hover  { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Stat pill ──────────────────────────────────────────── */
.stat-pill {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 5px 14px;
    border-radius: 99px;
    font-size: .78rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* ── Utilities ──────────────────────────────────────────── */
.mt-4 { margin-top: 24px; }
.mt-6 { margin-top: 40px; }
.text-muted { color: var(--text-muted); }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .content-inner { padding: 20px 16px 60px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .campaigns-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .modal { max-height: 95vh; }
}
