/* ─────────────────────────────────────────────
 * WA Notif - Clean Light Mode
 * ───────────────────────────────────────────── */

:root {
  /* Colors - Tailwind inspired gray & blue palette */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #f1f5f9;
  --secondary-hover: #e2e8f0;
  
  --success: #16a34a;
  --success-bg: #dcfce7;
  --error: #dc2626;
  --error-bg: #fee2e2;
  --warning: #ca8a04;
  --warning-bg: #fef9c3;
  --info: #0284c7;
  --info-bg: #e0f2fe;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  --radius: 8px;
  --radius-sm: 6px;
  
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography & Utilities ── */
h1, h2, h3, h4 { font-weight: 600; color: var(--text-main); line-height: 1.2; }
.hint-text { font-size: 0.75rem; color: var(--text-muted); display: block; margin-top: 4px; }
.req { color: var(--error); }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.p-0 { padding: 0 !important; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

/* ── Login Screen ── */
.login-screen {
  position: fixed; inset: 0;
  background: var(--bg-main);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.login-card {
  background: var(--bg-card);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 400px;
  text-align: center;
}
.login-icon {
  font-size: 40px; margin-bottom: 16px;
}
.login-card h2 { margin-bottom: 8px; font-size: 1.5rem; }
.login-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 24px; }
#loginForm { display: flex; flex-direction: column; gap: 16px; }
#loginPassword {
  width: 100%; padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem; font-family: var(--font-sans);
  transition: border-color 0.2s;
}
#loginPassword:focus { outline: none; border-color: var(--primary); }
.login-error { color: var(--error); font-size: 0.85rem; margin-top: 12px; display: none; }

/* ── Layout ── */
.app-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
}

.header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 32px;
}
.header-brand { display: flex; align-items: center; gap: 8px; }
.header-brand h1 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.header-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.85rem; color: var(--text-muted);
  background: var(--bg-card);
  padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.ok { background: var(--success); }
.status-dot.error { background: var(--error); }
.btn-logout {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: color 0.2s;
}
.btn-logout:hover { color: var(--error); }

/* ── Stats ── */
.stats-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card); padding: 20px;
  border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 4px;
}
.stat-label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 1.75rem; font-weight: 600; color: var(--text-main); }

/* ── Cards & Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  background: #fdfdfd;
}
.card-header.space-between { display: flex; justify-content: space-between; align-items: center; }
.card-header h2 { font-size: 1.05rem; }
.card-body { padding: 20px; }

/* ── Forms ── */
.form-row { display: flex; gap: 16px; }
@media (max-width: 600px) { .form-row { flex-direction: column; gap: 12px; } }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: 0.85rem; font-weight: 500; color: var(--text-main); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text-main);
  font-family: var(--font-sans); font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.input-with-action { display: flex; }
.input-with-action input { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; }
.input-with-action button {
  background: var(--secondary); border: 1px solid var(--border);
  padding: 0 12px; color: var(--text-muted); cursor: pointer;
  border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm);
  transition: background 0.2s;
}
.input-with-action button:hover { background: var(--secondary-hover); }

.day-checkboxes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.day-cb-label {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-main); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 0.85rem; color: var(--text-muted); cursor: pointer;
  user-select: none; transition: all 0.2s;
}
.day-cb-label:hover { background: var(--secondary-hover); }
.day-cb-label:has(input:checked) {
  background: var(--info-bg); border-color: var(--info); color: var(--info);
}

.recipient-input-row { display: flex; gap: 8px; }
.recipients-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.recipient-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-main); padding: 8px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.recipient-item .name { font-size: 0.85rem; font-weight: 500; }
.recipient-item .number { font-size: 0.8rem; color: var(--text-muted); }
.btn-remove { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }
.btn-remove:hover { color: var(--error); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all 0.2s;
  font-family: var(--font-sans);
}
.btn-primary { background: var(--primary); color: white; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--secondary); color: var(--text-main); border-color: var(--border); }
.btn-secondary:hover { background: var(--secondary-hover); }
.btn-outline { background: transparent; color: var(--text-main); border-color: var(--border); }
.btn-outline:hover { background: var(--secondary); }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* ── Schedule List ── */
.tabs { display: flex; gap: 4px; background: var(--bg-main); padding: 4px; border-radius: var(--radius-sm); }
.tab {
  background: transparent; border: none; padding: 6px 12px;
  font-size: 0.8rem; font-weight: 500; color: var(--text-muted);
  border-radius: 4px; cursor: pointer; transition: all 0.2s;
}
.tab:hover { color: var(--text-main); }
.tab.active { background: var(--bg-card); color: var(--text-main); box-shadow: var(--shadow-sm); }

.schedules-list { display: flex; flex-direction: column; max-height: 700px; overflow-y: auto; }
.schedule-item {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
  transition: background 0.2s;
}
.schedule-item:hover { background: var(--bg-main); }
.schedule-item:last-child { border-bottom: none; }
.sched-header { display: flex; justify-content: space-between; align-items: flex-start; }
.sched-title { font-weight: 600; font-size: 0.95rem; }
.sched-time { font-size: 0.75rem; color: var(--text-muted); }
.sched-message { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }
.sched-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.badge { padding: 2px 8px; border-radius: 99px; font-size: 0.7rem; font-weight: 600; border: 1px solid transparent; }
.badge.pending { background: var(--warning-bg); color: var(--warning); border-color: rgba(202,138,4,0.3); }
.badge.sent { background: var(--success-bg); color: var(--success); border-color: rgba(22,163,74,0.3); }
.badge.error { background: var(--error-bg); color: var(--error); border-color: rgba(220,38,38,0.3); }
.badge.recur { background: var(--info-bg); color: var(--info); border-color: rgba(2,132,199,0.3); }
.badge.via { background: var(--secondary); color: var(--text-muted); border-color: var(--border); }
.sched-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chip { font-size: 0.75rem; background: var(--bg-card); border: 1px solid var(--border); padding: 2px 8px; border-radius: 4px; color: var(--text-muted); }
.empty-state { padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* ── Toast & Modal ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px; border-radius: var(--radius-sm);
  background: var(--text-main); color: white;
  font-size: 0.9rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px); opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10000;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--error); }
.toast.success { background: var(--success); }
.toast.info { background: var(--text-main); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
  z-index: 9999; backdrop-filter: blur(2px);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-card); width: 90%; max-width: 400px;
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  overflow: hidden; transform: translateY(20px); transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 1rem; }
.btn-icon { background: none; border: none; font-size: 1.1rem; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 20px; background: #efeae2; }
.wa-bubble {
  background: #d9fdd3; color: #111b21;
  padding: 8px 12px; border-radius: 8px; border-top-left-radius: 0;
  font-size: 0.9rem; box-shadow: 0 1px 1px rgba(0,0,0,0.1);
  white-space: pre-wrap; display: inline-block; max-width: 100%;
}
