/* ==========================================================
   Aparaitech Software - Component Library Stylesheet
   ========================================================== */

/* Typography & Headers */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.view-title-group h1 {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.view-title-group p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed !important;
}

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

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
}

.btn-primary {
  background: var(--brand-sapphire);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-sapphire-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--text-muted);
}

.btn-outline {
  background: #ffffff;
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-subtle);
  border-color: var(--border-dark);
  color: var(--text-primary);
}

.app-header .btn-outline,
.admin-header .btn-outline,
.landing-hero .btn-outline {
  background: transparent;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.app-header .btn-outline:hover:not(:disabled),
.admin-header .btn-outline:hover:not(:disabled),
.landing-hero .btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: #ffffff;
  color: #ffffff;
}

.btn-danger {
  background: var(--color-danger);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-success {
  background: var(--color-success);
  color: #ffffff;
}

.btn-success:hover:not(:disabled) {
  background: #047857;
}

.btn-warning {
  background: var(--color-warning);
  color: #ffffff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* Cards & Surfaces */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: 24px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand-sapphire);
}

.kpi-card.kpi-green::before { background: var(--color-success); }
.kpi-card.kpi-amber::before { background: var(--color-warning); }
.kpi-card.kpi-purple::before { background: var(--brand-violet); }

.kpi-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--brand-sapphire);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-green .kpi-icon-box { background: var(--color-success-bg); color: var(--color-success); }
.kpi-amber .kpi-icon-box { background: var(--color-warning-bg); color: var(--color-warning); }
.kpi-purple .kpi-icon-box { background: #f5f3ff; color: var(--brand-violet); }

.kpi-data {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin-top: 2px;
  font-family: var(--font-heading);
}

.kpi-subtext {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* Toolbar & Filters */
.toolbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  background: #ffffff;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  min-width: 280px;
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  font-size: 0.88rem;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease;
}

.search-box input:focus {
  border-color: var(--brand-sapphire);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.88rem;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand-sapphire);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* Badges & Status Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: capitalize;
}

.badge-sent, .badge-active, .badge-delivered, .badge-completed {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid var(--color-success-border);
}

.badge-failed {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid var(--color-danger-border);
}

.badge-pending, .badge-draft {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge-in_progress {
  background: #eff6ff;
  color: var(--brand-sapphire);
  border: 1px solid #bfdbfe;
}

.badge-paused {
  background: var(--color-warning-bg);
  color: var(--color-warning);
  border: 1px solid var(--color-warning-border);
}

/* Data Tables */
.table-container {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow-x: auto;
  box-shadow: var(--shadow-xs);
}

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

.data-table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: #f8fafc;
}

.table-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--brand-sapphire);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #ffffff;
  border-top: 1px solid var(--border-light);
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Variable Pills Toolbar */
.variables-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: #f8fafc;
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.variables-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-right: 4px;
}

.var-pill {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: var(--brand-sapphire);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.var-pill:hover {
  background: #eff6ff;
  border-color: var(--brand-sapphire);
  transform: translateY(-1px);
}

/* Dual Split Composer Layout */
.composer-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 1100px) {
  .composer-split {
    grid-template-columns: 1fr;
  }
}

.preview-pane {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xs);
  height: calc(100vh - 200px);
  position: sticky;
  top: 88px;
}

.preview-header {
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}

.preview-body-frame {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: #f1f5f9;
}

.preview-rendered-box {
  background: #ffffff;
  box-shadow: var(--shadow-md);
  border-radius: 8px;
  max-width: 600px;
  margin: 0 auto;
  overflow: hidden;
}

/* WYSIWYG Editor Toolbar */
.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  border-bottom: none;
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
}

.editor-btn {
  background: transparent;
  border: 1px solid transparent;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.editor-btn:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.editor-content-area {
  min-height: 280px;
  padding: 16px;
  border: 1px solid var(--border-medium);
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  background: #ffffff;
  outline: none;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.6;
}

.editor-content-area:focus {
  border-color: var(--brand-sapphire);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Bulk Upload Dropzone */
.dropzone-container {
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-md);
  padding: 48px 24px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropzone-container:hover, .dropzone-container.drag-over {
  border-color: var(--brand-sapphire);
  background: #eff6ff;
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  color: var(--brand-sapphire);
  margin-bottom: 12px;
}

/* Real-time Live Blast Monitor */
.blast-monitor-card {
  background: #0f172a;
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-xl);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.blast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.blast-progress-wrapper {
  margin: 20px 0;
}

.progress-track {
  height: 16px;
  background: #1e293b;
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb 0%, #38bdf8 50%, #22c55e 100%);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: var(--radius-full);
}

.blast-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.blast-stat-item {
  background: #1e293b;
  padding: 14px;
  border-radius: var(--radius-sm);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.blast-stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
  font-family: var(--font-mono);
}

.blast-stat-lbl {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.live-log-terminal {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  height: 320px;
  overflow-y: auto;
  color: #94a3b8;
}

.log-entry {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  gap: 10px;
}

.log-time { color: #64748b; }
.log-success { color: #22c55e; font-weight: 600; }
.log-error { color: #ef4444; font-weight: 600; }

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-light);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text-primary);
}

/* ==========================================================
   Admin Portal & Subscription Component Styles
   ========================================================== */
.tabs-nav .tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: -2px;
}

.tabs-nav .tab-btn:hover {
  color: var(--brand-sapphire);
  background: rgba(37, 99, 235, 0.04);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tabs-nav .tab-btn.active {
  color: var(--brand-sapphire);
  border-bottom-color: var(--brand-sapphire);
}

.plan-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.plan-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.current-plan-card {
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%);
}

.badge-primary {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.badge-info {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.badge-success {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.badge-warning {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.badge-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.badge-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.user-profile-pill:hover {
  background: rgba(255, 255, 255, 0.16) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

