@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #161c2d;
  --bg-tertiary: #1f283e;
  --glass-bg: rgba(22, 28, 45, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  
  --accent-primary: #4f46e5;
  --accent-hover: #6366f1;
  --accent-success: #10b981;
  --accent-error: #f43f5e;
  --accent-warning: #f59e0b;
  --accent-info: #06b6d4;

  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.1) 0px, transparent 50%);
}

h1, h2, h3, h4 {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

/* Auth View Overlay */
#auth-view {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 40px;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  text-align: center;
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.logo-section {
  margin-bottom: 30px;
}

.logo-section svg {
  width: 64px;
  height: 64px;
  color: var(--accent-info);
  margin-bottom: 12px;
}

.logo-title {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, var(--accent-info) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 6px;
}

.auth-methods {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 30px;
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background-color: #ffffff;
  color: #1f2937;
  border: none;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-google:hover {
  background-color: #f3f4f6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 10px 0;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--glass-border);
}

.divider:not(:empty)::before {
  margin-right: .5em;
}

.divider:not(:empty)::after {
  margin-left: .5em;
}

.dev-login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-input {
  background-color: var(--bg-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(79, 70, 229, 0.3);
}

/* App Main Layout */
#app-view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 40px;
  background-color: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: #fff;
}

.nav-brand span {
  background: linear-gradient(135deg, #fff, var(--accent-info));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
  background-color: var(--bg-tertiary);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.tenant-tag {
  font-size: 0.75rem;
  color: var(--accent-info);
  font-weight: 500;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: var(--transition-smooth);
}

.btn-logout:hover {
  background-color: var(--accent-error);
  color: #fff;
  border-color: var(--accent-error);
}

/* Tabs & Layout Body */
.main-container {
  display: flex;
  flex: 1;
}

.sidebar {
  width: 240px;
  background-color: rgba(22, 28, 45, 0.4);
  border-right: 1px solid var(--glass-border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-smooth);
}

.tab-btn:hover {
  background-color: var(--bg-tertiary);
  color: #fff;
}

.tab-btn.active {
  background-color: var(--accent-primary);
  color: #fff;
}

.mode-tab-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  justify-content: center;
  transition: var(--transition-smooth);
}

.mode-tab-btn:hover {
  background-color: var(--bg-tertiary);
  color: #fff;
}

.mode-tab-btn.active {
  background-color: var(--accent-primary);
  color: #fff;
}

.tab-btn svg {
  width: 20px;
  height: 20px;
}

.content-area {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.tab-panel.active {
  display: block;
}

/* Components & Cards */
.panel-header {
  margin-bottom: 28px;
}

.panel-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
}

.panel-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 4px;
}

.grid-dashboard {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.card-glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  margin-bottom: 24px;
}

.card-header {
  margin-bottom: 20px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 12px;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
}

/* Quota Indicator */
.quota-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(79, 70, 229, 0.08);
  border: 1px dashed rgba(79, 70, 229, 0.3);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.quota-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.quota-bar {
  height: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  overflow: hidden;
}

.quota-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-info));
  width: 0%;
  transition: width 0.5s ease-in-out;
}

/* Forms in dashboard */
.grid-form-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--accent-success); }
.badge-error { background: rgba(244, 63, 94, 0.15); color: var(--accent-error); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--accent-warning); }
.badge-info { background: rgba(6, 182, 212, 0.15); color: var(--accent-info); }
.badge-muted { background: rgba(107, 114, 128, 0.15); color: var(--text-secondary); }

/* Table styling */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background-color: rgba(22, 28, 45, 0.2);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

th {
  background-color: rgba(22, 28, 45, 0.6);
  padding: 14px 16px;
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--glass-border);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

/* File Drop Zone */
.dropzone {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  background: rgba(22, 28, 45, 0.2);
}

.dropzone:hover {
  border-color: var(--accent-info);
  background: rgba(6, 182, 212, 0.03);
}

.dropzone svg {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Modal styling */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background-color: var(--bg-tertiary);
}

/* Campaign Panel Layout */
.campaign-workspace {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
}

/* Floating Interactive Mobile Preview container */
.phone-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.smartphone {
  width: 320px;
  height: 560px;
  background-color: #0b141a; /* WhatsApp default dark bg */
  border: 12px solid #2d3748;
  border-radius: 36px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.phone-header {
  background-color: #202c33;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.phone-back {
  color: #8696a0;
  font-size: 1rem;
}

.phone-avatar {
  width: 32px;
  height: 32px;
  background: var(--accent-info);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.8rem;
  color: #fff;
}

.phone-user-info {
  display: flex;
  flex-direction: column;
}

.phone-username {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e9edef;
}

.phone-status {
  font-size: 0.65rem;
  color: #8696a0;
}

.phone-body {
  flex: 1;
  background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
  background-size: cover;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.chat-bubble {
  background-color: #202c33;
  border-radius: 8px;
  padding: 10px 14px;
  color: #e9edef;
  font-size: 0.85rem;
  line-height: 1.4;
  max-width: 85%;
  align-self: flex-start;
  box-shadow: 0 1px 1px rgba(0,0,0,0.2);
  margin-bottom: 10px;
  position: relative;
}

.chat-bubble::before {
  content: '';
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-top-color: #202c33;
  border-right-color: #202c33;
}

.chat-time {
  text-align: right;
  font-size: 0.65rem;
  color: #8696a0;
  margin-top: 4px;
}

/* Footer Section */
.footer-attribution {
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: auto;
}

.footer-attribution a {
  color: var(--accent-info);
  text-decoration: none;
}

.footer-attribution a:hover {
  text-decoration: underline;
}

/* Live indicators */
.pulse-light {
  width: 8px;
  height: 8px;
  background-color: var(--accent-success);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px var(--accent-success);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 12px var(--accent-success); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: center;
}

.metric-num {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 4px;
  font-family: 'Outfit', sans-serif;
}

.metric-lbl {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.spinner {
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top: 3px solid var(--accent-info);
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
