/* ========================================
   Dreamland City WhatsApp CS
   Warna: Merah marun, Putih, Emas
   ======================================== */

:root {
  /* Warna utama - Merah Marun */
  --marun-900: #2D0A10;
  --marun-800: #4A0E1A;
  --marun-700: #6B1D2A;
  --marun-600: #8B2740;
  --marun-500: #A13350;
  --marun-400: #C25570;
  --marun-300: #D88095;
  --marun-200: #EAACBB;
  --marun-100: #F5D6DE;
  --marun-50: #FBF0F3;

  /* Emas */
  --gold-600: #9A7B2C;
  --gold-500: #C9A84C;
  --gold-400: #D4A853;
  --gold-300: #E0C77A;
  --gold-200: #EDDDAB;
  --gold-100: #F6EEDC;
  --gold-50: #FDFAF2;

  /* Netral */
  --gray-900: #111827;
  --gray-800: #1F2937;
  --gray-700: #374151;
  --gray-600: #4B5563;
  --gray-500: #6B7280;
  --gray-400: #9CA3AF;
  --gray-300: #D1D5DB;
  --gray-200: #E5E7EB;
  --gray-100: #F3F4F6;
  --gray-50: #F9FAFB;
  --white: #FFFFFF;

  /* Status */
  --success: #059669;
  --success-bg: #ECFDF5;
  --warning: #D97706;
  --warning-bg: #FFFBEB;
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --info: #2563EB;
  --info-bg: #EFF6FF;

  /* Radius & Shadow */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);

  /* Font */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.4;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--marun-700) 0%, var(--marun-800) 100%);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(107,29,42,0.3);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--marun-600) 0%, var(--marun-700) 100%);
  box-shadow: 0 4px 16px rgba(107,29,42,0.4);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-outline {
  background: transparent;
  color: var(--marun-700);
  border: 1.5px solid var(--marun-300);
}

.btn-outline:hover:not(:disabled) {
  background: var(--marun-50);
  border-color: var(--marun-400);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

/* ── Spinner ── */
.spinner {
  animation: spin 1s linear infinite;
}

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

/* ======================
   LOGIN PAGE
   ====================== */
.login-page {
  background: linear-gradient(135deg, var(--marun-900) 0%, var(--marun-800) 40%, var(--marun-700) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

/* Background pattern */
.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 80%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(212,168,83,0.06) 0%, transparent 70%);
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -20%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(212,168,83,0.04) 0%, transparent 60%);
  pointer-events: none;
}

.login-container {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 40px 36px 32px;
  border-top: 4px solid var(--gold-400);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  margin-bottom: 16px;
  display: inline-block;
}

.login-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--marun-800);
  letter-spacing: -0.02em;
}

.login-header .subtitle {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 4px;
  font-weight: 500;
}

/* Form */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--gray-400);
  pointer-events: none;
  flex-shrink: 0;
}

.input-wrapper input {
  width: 100%;
  padding: 11px 12px 11px 40px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.9rem;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: all 0.2s ease;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--marun-400);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(107,29,42,0.1);
}

.input-wrapper input::placeholder {
  color: var(--gray-400);
}

.toggle-password {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-400);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s;
}

.toggle-password:hover {
  color: var(--gray-600);
}

/* Error message */
.error-message {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  margin-bottom: 20px;
  border-left: 3px solid var(--danger);
  line-height: 1.4;
}

/* Login button */
#login-form .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
  margin-top: 4px;
}

/* Footer */
.login-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-100);
}

.login-footer p {
  font-size: 0.75rem;
  color: var(--gray-400);
  font-weight: 500;
}

/* ======================
   DASHBOARD PAGE
   ====================== */
.dashboard-page {
  background: var(--gray-50);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.topbar-logo svg {
  width: 32px;
  height: 32px;
}

.topbar-title h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--marun-800);
  line-height: 1.2;
}

.topbar-sub {
  font-size: 0.7rem;
  color: var(--gray-500);
  font-weight: 500;
}

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

.admin-name {
  font-size: 0.82rem;
  color: var(--gray-600);
  font-weight: 500;
}

/* Main content */
.main-content {
  flex: 1;
  padding: 32px 24px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

/* WhatsApp Panel */
.wa-panel {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
  border-top: 3px solid var(--gold-400);
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--marun-800);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.panel-title svg {
  color: var(--marun-600);
  flex-shrink: 0;
}

/* Status bar */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--gray-50);
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 8px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gray-400);
  flex-shrink: 0;
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(5,150,105,0.2);
}

.status-dot.waiting {
  background: var(--warning);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.status-dot.disconnected {
  background: var(--gray-400);
}

.status-dot.error {
  background: var(--danger);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
}

.connected-number {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--gray-500);
}

/* QR Area */
.qr-area {
  text-align: center;
  padding: 24px 0;
}

.qr-container {
  display: inline-flex;
  padding: 16px;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.qr-image {
  width: 260px;
  height: 260px;
  display: block;
}

.qr-instructions {
  text-align: left;
  max-width: 360px;
  margin: 0 auto;
}

.qr-instructions p {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.qr-instructions ol {
  padding-left: 20px;
  font-size: 0.82rem;
  color: var(--gray-600);
  line-height: 1.8;
}

/* Connected / Disconnected info */
.connected-info,
.disconnected-info {
  text-align: center;
  padding: 32px 16px;
}

.connected-icon,
.disconnected-icon {
  margin-bottom: 16px;
}

.connected-info h3 {
  font-size: 1.1rem;
  color: var(--success);
  margin-bottom: 6px;
}

.disconnected-info h3 {
  font-size: 1.1rem;
  color: var(--gray-600);
  margin-bottom: 6px;
}

.connected-desc,
.disconnected-desc {
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* Actions */
.panel-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.panel-actions .btn {
  flex: 1;
  min-width: 180px;
}

/* Disclaimer */
.disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 24px;
  padding: 12px 14px;
  background: var(--gold-50);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--gold-400);
}

.disclaimer svg {
  flex-shrink: 0;
  color: var(--gold-600);
  margin-top: 1px;
}

.disclaimer span {
  font-size: 0.75rem;
  color: var(--gray-600);
  line-height: 1.5;
}

/* Footer */
.footer {
  text-align: center;
  padding: 16px;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
}

.footer p {
  font-size: 0.72rem;
  color: var(--gray-400);
}

/* ======================
   RESPONSIVE
   ====================== */
@media (max-width: 480px) {
  .login-card {
    padding: 32px 24px 24px;
  }

  .login-header h1 {
    font-size: 1.3rem;
  }

  .wa-panel {
    padding: 24px 16px;
  }

  .panel-actions {
    flex-direction: column;
  }

  .panel-actions .btn {
    min-width: unset;
  }

  .topbar {
    padding: 0 16px;
  }

  .main-content {
    padding: 20px 16px;
  }

  .admin-name {
    display: none;
  }

  .qr-image {
    width: 220px;
    height: 220px;
  }

  .status-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}
