/* ============================================================
   VyapTech Frontend — Global Styles
   app.vyaptech.com
   ============================================================ */

/* ─── CSS Custom Properties ─────────────────────────────────── */
:root {
  --vt-primary:       #1a237e;
  --vt-primary-light: #3949ab;
  --vt-accent:        #00acc1;
  --vt-success:       #2e7d32;
  --vt-warning:       #f57f17;
  --vt-danger:        #c62828;
  --vt-bg:            #f5f6fa;
  --vt-surface:       #ffffff;
  --vt-border:        #e0e0e0;
  --vt-text-primary:  #1a1a2e;
  --vt-text-muted:    #6b7280;
  --vt-sidebar-width: 240px;
  --vt-header-height: 60px;
  --vt-radius:        8px;
  --vt-shadow:        0 2px 8px rgba(0,0,0,0.08);
  --vt-shadow-lg:     0 4px 24px rgba(0,0,0,0.12);
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: var(--vt-bg);
  color: var(--vt-text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--vt-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; }

/* ─── Typography ─────────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.375rem; font-weight: 600; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; }
.text-muted { color: var(--vt-text-muted); font-size: 0.875rem; }
.text-sm    { font-size: 0.875rem; }
.text-xs    { font-size: 0.75rem; }

/* ─── Layout Shell ───────────────────────────────────────────── */
.vt-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────── */
.vt-sidebar {
  width: var(--vt-sidebar-width);
  background: var(--vt-primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}
.vt-sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  gap: 10px;
}
.vt-sidebar-logo .vt-brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}
.vt-sidebar-logo .vt-brand-sub {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.vt-sidebar-section {
  padding: 12px 0 4px 16px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.45);
}
.vt-nav { list-style: none; flex: 1; }
.vt-nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.8);
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}
.vt-nav-item a:hover,
.vt-nav-item.active a {
  background: rgba(255,255,255,0.1);
  color: #fff;
  text-decoration: none;
  border-left-color: var(--vt-accent);
}
.vt-nav-item .vt-nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  opacity: 0.85;
}
/* Role badge in sidebar */
.vt-role-badge {
  margin: 12px 16px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.vt-role-badge.owner  { background: #7b1fa2; color: #fff; }
.vt-role-badge.admin  { background: #0277bd; color: #fff; }
.vt-role-badge.client { background: #2e7d32; color: #fff; }
/* Sidebar bottom actions */
.vt-sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.vt-sidebar-footer .vt-user-info {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vt-logout-btn {
  width: 100%;
  padding: 8px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--vt-radius);
  color: rgba(255,255,255,0.9);
  font-size: 0.8rem;
  transition: background 0.15s;
}
.vt-logout-btn:hover { background: rgba(255,255,255,0.2); }

/* ─── Main Content Area ──────────────────────────────────────── */
.vt-main {
  flex: 1;
  margin-left: var(--vt-sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.vt-topbar {
  height: var(--vt-header-height);
  background: var(--vt-surface);
  border-bottom: 1px solid var(--vt-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--vt-shadow);
}
.vt-topbar-title {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
}
.vt-topbar-actions { display: flex; gap: 8px; align-items: center; }
.vt-mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--vt-text-primary);
  padding: 4px;
}
.vt-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

/* ─── Global Error Banner ─────────────────────────────────────── */
#vt-global-error-banner {
  display: none;
  background: var(--vt-danger);
  color: #fff;
  text-align: center;
  padding: 12px 24px;
  font-size: 0.875rem;
  position: sticky;
  top: var(--vt-header-height);
  z-index: 200;
}

/* ─── Cards ─────────────────────────────────────────────────── */
.vt-card {
  background: var(--vt-surface);
  border: 1px solid var(--vt-border);
  border-radius: var(--vt-radius);
  box-shadow: var(--vt-shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.vt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--vt-border);
}
.vt-card-title { font-size: 1rem; font-weight: 600; }

/* ─── Stat Cards ─────────────────────────────────────────────── */
.vt-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.vt-stat-card {
  background: var(--vt-surface);
  border: 1px solid var(--vt-border);
  border-radius: var(--vt-radius);
  padding: 16px 20px;
  box-shadow: var(--vt-shadow);
}
.vt-stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--vt-text-muted);
  margin-bottom: 6px;
}
.vt-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--vt-primary);
}
.vt-stat-sub {
  font-size: 0.75rem;
  color: var(--vt-text-muted);
  margin-top: 2px;
}
.vt-stat-card.healthy .vt-stat-value  { color: var(--vt-success); }
.vt-stat-card.warning .vt-stat-value  { color: var(--vt-warning); }
.vt-stat-card.critical .vt-stat-value { color: var(--vt-danger); }

/* ─── Status Badges ──────────────────────────────────────────── */
.vt-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.vt-badge.active,
.vt-badge.connected,
.vt-badge.success,
.vt-badge.paid     { background: #e8f5e9; color: #2e7d32; }
.vt-badge.pending,
.vt-badge.queued   { background: #fff8e1; color: #f57f17; }
.vt-badge.failed,
.vt-badge.critical,
.vt-badge.error    { background: #ffebee; color: #c62828; }
.vt-badge.running,
.vt-badge.in-progress { background: #e3f2fd; color: #1565c0; }
.vt-badge.unknown,
.vt-badge.draft    { background: #f5f5f5; color: #757575; }
.vt-badge.blocked  { background: #fce4ec; color: #880e4f; }

/* ─── Tables ─────────────────────────────────────────────────── */
.vt-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.vt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.vt-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--vt-text-muted);
  border-bottom: 2px solid var(--vt-border);
  white-space: nowrap;
  background: #fafafa;
}
.vt-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--vt-border);
  vertical-align: middle;
}
.vt-table tr:last-child td { border-bottom: none; }
.vt-table tr:hover td { background: #f8f9ff; }

/* ─── Empty State ────────────────────────────────────────────── */
.vt-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--vt-text-muted);
}
.vt-empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.vt-empty-title { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.vt-empty-sub { font-size: 0.875rem; }

/* ─── Skeleton Loader ────────────────────────────────────────── */
.vt-skeleton {
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200% 100%;
  animation: vt-shimmer 1.4s infinite;
  border-radius: 4px;
  display: block;
}
@keyframes vt-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.vt-skeleton-row { height: 40px; margin-bottom: 8px; }
.vt-skeleton-card { height: 120px; }
.vt-skeleton-stat { height: 80px; border-radius: var(--vt-radius); }

/* ─── Buttons ────────────────────────────────────────────────── */
.vt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--vt-radius);
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}
.vt-btn:hover { opacity: 0.9; }
.vt-btn:active { transform: scale(0.98); }
.vt-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.vt-btn-primary   { background: var(--vt-primary); color: #fff; }
.vt-btn-accent    { background: var(--vt-accent); color: #fff; }
.vt-btn-ghost     { background: transparent; border: 1px solid var(--vt-border); color: var(--vt-text-primary); }
.vt-btn-danger    { background: var(--vt-danger); color: #fff; }
.vt-btn-sm        { padding: 5px 12px; font-size: 0.8rem; }
.vt-btn-full      { width: 100%; justify-content: center; }

/* ─── Forms ──────────────────────────────────────────────────── */
.vt-form-group { margin-bottom: 16px; }
.vt-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 6px; }
.vt-input, .vt-textarea, .vt-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--vt-border);
  border-radius: var(--vt-radius);
  font-size: 0.875rem;
  background: var(--vt-surface);
  color: var(--vt-text-primary);
  transition: border-color 0.15s;
}
.vt-input:focus,
.vt-textarea:focus,
.vt-select:focus {
  outline: none;
  border-color: var(--vt-primary-light);
  box-shadow: 0 0 0 3px rgba(57,73,171,0.12);
}
.vt-textarea { min-height: 100px; resize: vertical; }

/* ─── Pagination ─────────────────────────────────────────────── */
.vt-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}
.vt-pagination .vt-btn-sm { min-width: 36px; justify-content: center; }
.vt-pagination .vt-page-info { font-size: 0.8rem; color: var(--vt-text-muted); }

/* ─── System Health Indicator ────────────────────────────────── */
.vt-health-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}
.vt-health-dot.healthy  { background: var(--vt-success); }
.vt-health-dot.degraded { background: var(--vt-warning); }
.vt-health-dot.critical { background: var(--vt-danger); animation: vt-pulse 1.2s infinite; }
@keyframes vt-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ─── Alerts / Error Banners ─────────────────────────────────── */
.vt-alert {
  padding: 12px 16px;
  border-radius: var(--vt-radius);
  font-size: 0.875rem;
  margin-bottom: 16px;
  display: none;
}
.vt-alert.show { display: block; }
.vt-alert-error   { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.vt-alert-warn    { background: #fff8e1; color: #e65100; border: 1px solid #ffe082; }
.vt-alert-info    { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }
.vt-alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }

/* ─── Login Page ─────────────────────────────────────────────── */
.vt-auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--vt-primary) 0%, #283593 60%, #00838f 100%);
  padding: 24px;
}
.vt-auth-card {
  background: var(--vt-surface);
  border-radius: 12px;
  box-shadow: var(--vt-shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
}
.vt-auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.vt-auth-logo .vt-brand-name {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--vt-primary);
  letter-spacing: -0.02em;
}
.vt-auth-logo .vt-brand-tagline {
  font-size: 0.75rem;
  color: var(--vt-text-muted);
  margin-top: 2px;
}
.vt-auth-card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 24px;
  text-align: center;
  color: var(--vt-text-muted);
}
.vt-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--vt-text-muted);
  font-size: 0.75rem;
}
.vt-divider::before, .vt-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--vt-border);
}
.vt-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--vt-border);
  border-radius: var(--vt-radius);
  background: var(--vt-surface);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--vt-text-primary);
  cursor: pointer;
  transition: background 0.15s;
}
.vt-google-btn:hover { background: #f8f9ff; }
.vt-google-btn img { width: 18px; height: 18px; }
.vt-forgot-link {
  font-size: 0.8rem;
  text-align: right;
  margin-top: 6px;
}

/* Pending Binding Screen */
#vt-pending-binding {
  display: none;
  text-align: center;
}
.vt-pending-icon { font-size: 3rem; margin-bottom: 16px; }
.vt-pending-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--vt-warning);
  margin-bottom: 10px;
}
.vt-pending-body {
  font-size: 0.875rem;
  color: var(--vt-text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}
.vt-pending-action {
  font-size: 0.875rem;
  color: var(--vt-text-muted);
}
/* Login spinner */
#vt-login-spinner {
  display: none;
  text-align: center;
  margin: 12px 0;
  color: var(--vt-text-muted);
  font-size: 0.8rem;
}

/* ─── Portal Layout ──────────────────────────────────────────── */
.vt-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.vt-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ─── Blocked State (social/ads) ─────────────────────────────── */
.vt-blocked-banner {
  background: #fff3e0;
  border: 1px solid #ffe0b2;
  border-radius: var(--vt-radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: #e65100;
  margin-bottom: 16px;
}

/* ─── Coming Soon ────────────────────────────────────────────── */
.vt-coming-soon {
  text-align: center;
  padding: 60px 24px;
  color: var(--vt-text-muted);
}
.vt-coming-soon-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.3; }
.vt-coming-soon-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--vt-text-primary);
  margin-bottom: 8px;
}
.vt-coming-soon-sub { font-size: 0.875rem; }

/* ─── Mobile Sidebar Overlay ─────────────────────────────────── */
.vt-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 90;
}
.vt-sidebar-overlay.active { display: block; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .vt-sidebar {
    transform: translateX(-100%);
  }
  .vt-sidebar.open {
    transform: translateX(0);
  }
  .vt-main {
    margin-left: 0;
  }
  .vt-mobile-toggle {
    display: block;
  }
  .vt-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .vt-two-col {
    grid-template-columns: 1fr;
  }
  .vt-content {
    padding: 16px;
  }
  .vt-auth-card {
    padding: 28px 20px;
  }
}

@media (max-width: 480px) {
  .vt-stat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .vt-stat-value { font-size: 1.4rem; }
  h1 { font-size: 1.375rem; }
}

/* ─── Print ──────────────────────────────────────────────────── */
@media print {
  .vt-sidebar, .vt-topbar, .vt-mobile-toggle { display: none !important; }
  .vt-main { margin-left: 0 !important; }
}
