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

:root {
  --primary: #1a365d;
  --primary-light: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --sidebar-w: 250px;
}

body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--gray-100); color: var(--gray-900); }

/* LOGIN */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); }
.login-box { background: white; padding: 40px; border-radius: 12px; width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-box h1 { text-align: center; color: var(--primary); margin-bottom: 30px; }
.login-box .error { background: #fef2f2; color: var(--danger); padding: 10px; border-radius: 6px; margin-bottom: 15px; display: none; }

/* LAYOUT */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--primary); color: white; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; }
.sidebar-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-header h2 { font-size: 20px; }
.sidebar-nav { padding: 10px 0; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 12px 20px; color: rgba(255,255,255,0.7); text-decoration: none; transition: all 0.2s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,0.1); color: white; }
.sidebar-nav a .icon { width: 20px; text-align: center; }

.main { margin-left: var(--sidebar-w); flex: 1; }
.topbar { background: white; padding: 15px 30px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.topbar .user-info { display: flex; align-items: center; gap: 10px; }
.content { padding: 30px; }

/* CARDS */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: white; padding: 24px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.stat-card .label { font-size: 14px; color: var(--gray-500); margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .value.success { color: var(--success); }
.stat-card .value.warning { color: var(--warning); }

/* TABLES */
.table-container { background: white; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); overflow: hidden; }
.table-toolbar { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--gray-200); flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 16px; background: var(--gray-50); font-size: 13px; color: var(--gray-500); text-transform: uppercase; border-bottom: 1px solid var(--gray-200); }
td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); }
tr:hover { background: var(--gray-50); }

/* BADGES */
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-draft { background: var(--gray-200); color: var(--gray-700); }
.badge-scheduled { background: #dbeafe; color: #1d4ed8; }
.badge-sending { background: #fef3c7; color: #92400e; }
.badge-sent { background: #d1fae5; color: #065f46; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-unsubscribed { background: #fee2e2; color: #991b1b; }
.badge-bounced { background: #fef3c7; color: #92400e; }
.badge-paused { background: #e0e7ff; color: #3730a3; }

/* FORMS */
input, select, textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 14px; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: var(--gray-700); }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px; border: none; border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: var(--primary-light); color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 6px 10px; }

/* MODAL */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal { background: white; border-radius: 12px; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 18px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--gray-500); }

/* TOAST */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; }
.toast { padding: 14px 20px; border-radius: 8px; color: white; margin-bottom: 10px; animation: slideIn 0.3s ease; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary-light); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* PAGINATION */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 16px; }
.pagination button { padding: 8px 14px; border: 1px solid var(--gray-300); background: white; border-radius: 6px; cursor: pointer; }
.pagination button.active { background: var(--primary-light); color: white; border-color: var(--primary-light); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

/* SEARCH */
.search-input { max-width: 300px; }

/* EDITOR */
.template-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; height: 500px; }
.template-editor textarea { height: 100%; font-family: 'Courier New', monospace; font-size: 13px; }
.template-preview { border: 1px solid var(--gray-300); border-radius: 6px; overflow: auto; padding: 10px; background: white; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-500); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }

/* LOADING */
.loading { text-align: center; padding: 40px; color: var(--gray-500); }

/* PROGRESS BAR */
.progress-bar { background: var(--gray-200); border-radius: 4px; height: 8px; overflow: hidden; }
.progress-bar-lg { height: 14px; }
.progress-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.progress-bar-fill.success { background: var(--success); }
.progress-bar-fill.warning { background: var(--warning); }
.progress-bar-fill.danger { background: var(--danger); }
.progress-label { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* FILTER TABS */
.filter-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-tab { padding: 6px 14px; border: 1px solid var(--gray-300); background: white; border-radius: 6px; cursor: pointer; font-size: 13px; transition: all 0.2s; }
.filter-tab:hover { background: var(--gray-100); }
.filter-tab.active { background: var(--primary-light); color: white; border-color: var(--primary-light); }
.filter-tab .count { font-size: 11px; opacity: 0.7; margin-left: 4px; }

/* CAMPAIGN DETAIL HEADER */
.campaign-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.campaign-header h3 { display: flex; align-items: center; gap: 12px; margin: 0; }
.btn-back { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-500); padding: 4px 8px; }
.btn-back:hover { color: var(--gray-900); }
.campaign-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* SECTION TITLES */
.section-title { font-size: 16px; font-weight: 600; margin: 24px 0 12px; color: var(--gray-700); }

/* VALUE COLORS */
.stat-card .value.danger { color: var(--danger); }
.stat-card .value.primary { color: var(--primary-light); }

/* INLINE STATUS */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.sending { background: var(--warning); animation: pulse 1.5s infinite; }
.status-dot.paused { background: #6366f1; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* BTN WARNING */
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-header h2, .sidebar-nav a span { display: none; }
  .main { margin-left: 60px; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .template-editor { grid-template-columns: 1fr; }
}
