/* assets/style.css — ColdEmail SaaS global styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f9fafb;
    color: #111827;
    font-size: 14px;
    line-height: 1.5;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */

.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 64px;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.topbar-brand {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    text-decoration: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-username {
    font-size: 14px;
    color: #4b5563;
}

.topbar-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: #111827;
    color: white;
    border-radius: 10px;
    margin-left: 6px;
}

.impersonate-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    color: #92400e;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 64px;
    bottom: 0;
    width: 256px;
    background: white;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
}

.sidebar-nav {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    font-size: 14px;
    transition: background 0.15s;
    position: relative;
}

.nav-link:hover  { background: #f3f4f6; }
.nav-link.active { background: #111827; color: white; }

.nav-link svg { width: 20px; height: 20px; flex-shrink: 0; }

.nav-badge {
    position: absolute;
    right: 16px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

.nav-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 8px 0;
}

.main-content {
    margin-left: 256px;
    margin-top: 64px;
    padding: 32px;
    min-height: calc(100vh - 64px);
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.btn-dark   { background: #111827; color: white; }
.btn-dark:hover { background: #10b981; color: white; }

.btn-green  { background: #10b981; color: white; }
.btn-green:hover { background: #059669; }

.btn-white  { background: white; color: #374151; border: 1px solid #d1d5db; }
.btn-white:hover { background: #f3f4f6; }

.btn-red    { background: none; color: #dc2626; border: none; padding: 6px 8px; }
.btn-red:hover { background: #fee2e2; }

.btn-icon   { padding: 6px 8px; background: none; border: none; cursor: pointer; border-radius: 6px; display: inline-flex; align-items: center; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */

.card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
}

.card-green {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

/* ── Page header ─────────────────────────────────────────────────────────────── */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title    { font-size: 24px; font-weight: 600; color: #111827; }
.page-subtitle { font-size: 14px; color: #6b7280; margin-top: 4px; }

.page-actions  { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Status badges ─────────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-active    { background: #d1fae5; color: #065f46; }
.badge-paused    { background: #fef3c7; color: #92400e; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-draft     { background: #f3f4f6; color: #374151; }
.badge-admin     { background: #111827; color: white; }
.badge-user      { background: #f3f4f6; color: #374151; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */

.table-wrap {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead { background: #f9fafb; }
thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

tbody tr { border-top: 1px solid #e5e7eb; }
tbody tr:hover { background: #fafafa; }
tbody td { padding: 12px 16px; vertical-align: top; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */

.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 6px; }
.form-hint   { font-size: 11px; color: #6b7280; margin-top: 4px; }
.form-hint-blue { font-size: 12px; color: #3b82f6; margin-top: 4px; }

.input, .select, .textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: white;
    outline: none;
    transition: border-color 0.15s;
    font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus { border-color: #111827; }
.input[readonly], .textarea[readonly] { background: #f9fafb; color: #6b7280; cursor: default; }

.input-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Modals ─────────────────────────────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }

.modal {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 520px;
    max-width: 92%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-title { font-size: 20px; font-weight: 600; margin-bottom: 16px; }

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ── Alerts ─────────────────────────────────────────────────────────────────── */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-warning { background: #fef3c7; border: 1px solid #f59e0b; color: #92400e; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* ── Progress bar ─────────────────────────────────────────────────────────── */

.progress-wrap {
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}
.progress-active    { background: #10b981; }
.progress-paused    { background: #f59e0b; }
.progress-completed { background: #6b7280; }
.progress-draft     { background: #d1d5db; }

/* ── Stats grid ─────────────────────────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.stat-label { font-size: 11px; color: #6b7280; }
.stat-value { font-size: 16px; font-weight: 600; margin-top: 2px; }

/* ── Pagination ─────────────────────────────────────────────────────────────── */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.pagination-info { font-size: 13px; color: #6b7280; }

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-btn {
    padding: 4px 9px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: white;
    color: #374151;
    cursor: pointer;
    min-width: 30px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}
.page-btn:hover   { background: #f3f4f6; }
.page-btn.active  { background: #111827; color: white; border-color: #111827; font-weight: 600; }
.page-btn:disabled, .page-btn.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.page-size-btns { display: flex; align-items: center; gap: 6px; }

/* ── Misc ─────────────────────────────────────────────────────────────────── */

.text-muted  { color: #6b7280; }
.text-small  { font-size: 12px; }
.text-green  { color: #10b981; }
.text-red    { color: #dc2626; }
.text-amber  { color: #d97706; }
.text-purple { color: #8b5cf6; }
.text-cyan   { color: #06b6d4; }
.text-blue   { color: #3b82f6; }

.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.gap-16      { gap: 16px; }

.empty-state {
    text-align: center;
    padding: 48px;
    color: #9ca3af;
}

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

.spinner {
    width: 32px; height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #111827;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}
