/* ============ CSS Variables ============ */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #1e2130;
  --bg-hover: #252838;
  --bg-input: #141620;
  --border: #2a2d3e;
  --border-focus: #6366f1;
  --text-primary: #e8eaed;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-bg: rgba(99, 102, 241, 0.1);
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.1);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --orange: #f59e0b;
  --orange-bg: rgba(245, 158, 11, 0.1);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.1);
  --yellow: #eab308;
  --sidebar-width: 240px;
  --topbar-height: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --transition: all 0.2s ease;
}

/* ============ Reset & Base ============ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============ Sidebar ============ */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}

.logo i {
  color: var(--accent);
  font-size: 24px;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 15px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.plan-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--orange-bg);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-sm);
  color: var(--orange);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}

.plan-badge.pro {
  background: var(--accent-bg);
  border-color: rgba(99, 102, 241, 0.2);
  color: var(--accent);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}

.status-dot.connected {
  background: var(--green);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

.status-dot.disconnected {
  background: var(--red);
}

/* ============ Main Content ============ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 50;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: var(--red-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 20px;
  color: var(--red);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

.pulse {
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ============ Pages ============ */
.page {
  display: none;
  padding: 24px;
  flex: 1;
}

.page.active {
  display: block;
}

/* ============ Stats Grid ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-icon.blue { background: var(--blue-bg); color: var(--blue); }
.stat-icon.green { background: var(--green-bg); color: var(--green); }
.stat-icon.red { background: var(--red-bg); color: var(--red); }
.stat-icon.orange { background: var(--orange-bg); color: var(--orange); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ============ Section Header ============ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h2, .section-header h3 {
  font-size: 16px;
  font-weight: 600;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-success {
  background: var(--green);
  color: white;
}

.btn-success:hover {
  background: #16a34a;
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-warning {
  background: var(--orange);
  color: white;
}

.btn-warning:hover {
  background: #d97706;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--red);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============ Cards ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.card-header h2 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header h2 i {
  color: var(--accent);
}

/* ============ Forms ============ */
.campaign-form-card form {
  padding: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.required {
  color: var(--red);
}

.optional {
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
}

.form-group select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-group select option {
  background: var(--bg-input);
  color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.form-group small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ============ Sample CSV Download ============ */
.sample-downloads {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.sample-downloads::before {
  content: 'Samples:';
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.sample-csv-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: underline;
  transition: var(--transition);
}

.sample-csv-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.sample-csv-link i {
  font-size: 11px;
}

/* ============ Import Divider ============ */
.import-divider {
  display: flex;
  align-items: center;
  margin: 14px 0;
  gap: 12px;
}

.import-divider::before,
.import-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.import-divider span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============ Google Sheets Input ============ */
.google-sheet-input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.google-sheet-input label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
}

.google-sheet-input label i {
  color: #34a853;
  font-size: 14px;
}

.google-sheet-input input[type="url"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  transition: var(--transition);
}

.google-sheet-input input[type="url"]:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.google-sheet-input input[type="url"]::placeholder {
  color: var(--text-muted);
}

.google-sheet-input small {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 6px;
}

/* ============ File Upload ============ */
.file-upload {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 28px 20px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
}

.file-upload:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.file-upload input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-upload-content i {
  font-size: 32px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.file-upload-content p {
  font-size: 14px;
  color: var(--text-secondary);
}

.file-upload-content .link {
  color: var(--accent);
  text-decoration: underline;
}

.file-upload-content small {
  color: var(--text-muted);
  font-size: 12px;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-primary);
}

.file-info i {
  color: var(--green);
  font-size: 20px;
}

/* ============ Caption Helpers ============ */
.caption-helpers {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.helper-tag {
  padding: 4px 10px;
  background: var(--accent-bg);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 4px;
  color: var(--accent);
  font-size: 12px;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  transition: var(--transition);
}

.helper-tag:hover {
  background: var(--accent);
  color: white;
}

.helper-info {
  font-size: 12px;
  color: var(--text-muted);
}

.helper-info i {
  margin-right: 4px;
}

/* ============ Active Campaign Cards ============ */
.campaigns-live {
  display: grid;
  gap: 16px;
}

.campaign-live-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}

.campaign-live-card:hover {
  border-color: var(--accent);
}

.campaign-live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.campaign-live-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.campaign-live-progress {
  margin-bottom: 12px;
}

.progress-bar-container {
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--accent), var(--green));
}

.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.campaign-live-stats {
  display: flex;
  gap: 20px;
}

.live-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.live-stat .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.dot.gray { background: var(--text-muted); }
.dot.blue { background: var(--blue); }
.dot.orange { background: var(--orange); }

.campaign-live-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ============ Empty State ============ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  margin-bottom: 16px;
  font-size: 15px;
}

/* ============ Tables ============ */
.campaigns-table-wrapper, .messages-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}

.campaigns-table, .messages-table {
  width: 100%;
  border-collapse: collapse;
}

.campaigns-table th, .messages-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.campaigns-table td, .messages-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.campaigns-table tr:last-child td,
.messages-table tr:last-child td {
  border-bottom: none;
}

.campaigns-table tr:hover td,
.messages-table tr:hover td {
  background: var(--bg-hover);
}

.empty-row td {
  text-align: center;
  color: var(--text-muted);
  padding: 32px;
}

/* ============ Status Badges ============ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.draft { background: var(--bg-hover); color: var(--text-muted); }
.status-badge.running { background: var(--green-bg); color: var(--green); }
.status-badge.paused { background: var(--orange-bg); color: var(--orange); }
.status-badge.completed { background: var(--blue-bg); color: var(--blue); }
.status-badge.stopped { background: var(--red-bg); color: var(--red); }
.status-badge.error { background: var(--red-bg); color: var(--red); }
.status-badge.sent { background: var(--green-bg); color: var(--green); }
.status-badge.failed { background: var(--red-bg); color: var(--red); }
.status-badge.pending { background: var(--bg-hover); color: var(--text-muted); }
.status-badge.sending { background: var(--orange-bg); color: var(--orange); }

/* ============ Campaign Detail ============ */
.campaign-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.campaign-detail-header h2 {
  flex: 1;
  font-size: 20px;
}

.campaign-actions {
  display: flex;
  gap: 8px;
}

.detail-stats-grid {
  display: grid;
  grid-template-columns: 160px 200px 1fr;
  gap: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.detail-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.detail-stat-circle {
  position: relative;
  width: 120px;
  height: 120px;
}

.detail-stat-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.detail-stat-circle .bg {
  fill: none;
  stroke: var(--bg-input);
  stroke-width: 8;
}

.detail-stat-circle .progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 0.5s ease;
}

.detail-stat-percent {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
}

.detail-stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

.detail-stat-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.detail-stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.detail-stat-row strong {
  margin-left: auto;
  font-size: 18px;
}

.detail-campaign-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-row {
  display: flex;
  gap: 8px;
  font-size: 14px;
}

.info-row label {
  color: var(--text-muted);
  font-weight: 600;
  min-width: 70px;
}

.caption-preview {
  padding: 10px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 13px;
  white-space: pre-wrap;
  color: var(--text-secondary);
  max-height: 100px;
  overflow-y: auto;
  margin-top: 4px;
}

/* ============ Filter Buttons ============ */
.filter-group {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.filter-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  color: var(--text-primary);
}

.filter-btn.active {
  background: var(--accent);
  color: white;
}

/* ============ Settings ============ */
.settings-section {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-section h3 i {
  color: var(--accent);
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group input {
  flex: 1;
}

/* ============ Pro Section ============ */
.pro-section {
  padding: 24px;
}

.pro-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.pro-plan {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
}

.pro-plan.featured {
  border-color: var(--accent);
  position: relative;
  background: var(--accent-bg);
}

.pro-badge {
  position: absolute;
  top: -10px;
  right: 16px;
  padding: 4px 12px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 20px;
  letter-spacing: 1px;
}

.pro-plan h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
}

.pro-plan ul {
  list-style: none;
}

.pro-plan li {
  padding: 6px 0;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.pro-plan li i {
  color: var(--green);
  font-size: 13px;
}

.pro-activate {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.success-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--green-bg);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius-sm);
  color: var(--green);
  font-weight: 600;
}

.success-badge i {
  font-size: 20px;
}

/* ============ Modal ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 480px;
  box-shadow: var(--shadow);
}

.modal-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h2 i {
  color: var(--orange);
}

.modal-body {
  padding: 20px;
}

.modal-body p {
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ============ Toast Notifications ============ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 420px;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  position: relative;
  overflow: hidden;
}

.toast::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255,255,255,0.3);
  animation: toastTimer 4s linear forwards;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

@keyframes toastTimer {
  from { width: 100%; }
  to { width: 0%; }
}

.toast.success {
  background: #065f46;
  color: #d1fae5;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.toast.error {
  background: #7f1d1d;
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.toast.info {
  background: #1e3a5f;
  color: #bfdbfe;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.toast.warning {
  background: #78350f;
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ============ Utility ============ */
.mt-4 { margin-top: 24px; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }

/* Highlight new message rows */
.messages-table tr.new-row {
  animation: highlightRow 2s ease;
}

@keyframes highlightRow {
  0% { background: var(--accent-bg); }
  100% { background: transparent; }
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-stats-grid {
    grid-template-columns: 1fr;
  }

  .pro-comparison {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
