/**
 * PDFCore Studio — Luxury SaaS Workspace Dashboard Design System
 * Palette: Slate Navy & Obsidian (Dark) + Porcelain & Crisp Slate (Light) + Coral Accents
 * Full Responsive Layouts for Desktop, Tablet, and Mobile
 */

:root, [data-theme="dark"] {
  --bg-dark: #090d16;
  --bg-sidebar: #0d1424;
  --bg-card: #131c31;
  --bg-card-hover: #18233c;
  --bg-input: #070b14;
  --border-card: rgba(148, 163, 184, 0.12);
  --border-light: rgba(148, 163, 184, 0.2);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --coral-main: #e5484d;
  --coral-hover: #d03d42;
  --coral-glow: rgba(229, 72, 77, 0.22);
  --green-main: #10b981;
  --green-bg: rgba(16, 185, 129, 0.12);
  --green-glow: rgba(16, 185, 129, 0.2);
  --blue-main: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.12);
  --blue-glow: rgba(59, 130, 246, 0.2);
  --yellow-main: #f59e0b;
  --yellow-bg: rgba(245, 158, 11, 0.12);
  --yellow-glow: rgba(245, 158, 11, 0.2);
  --red-main: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --sidebar-w: 265px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.45);
  --table-hover: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] {
  --bg-dark: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfcfd;
  --bg-input: #ffffff;
  --border-card: #e2e8f0;
  --border-light: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --coral-main: #e5484d;
  --coral-hover: #d03d42;
  --coral-glow: rgba(229, 72, 77, 0.15);
  --green-main: #059669;
  --green-bg: rgba(5, 150, 105, 0.12);
  --green-glow: rgba(5, 150, 105, 0.15);
  --blue-main: #2563eb;
  --blue-bg: rgba(37, 99, 235, 0.12);
  --blue-glow: rgba(37, 99, 235, 0.15);
  --yellow-main: #d97706;
  --yellow-bg: rgba(217, 119, 6, 0.12);
  --yellow-glow: rgba(217, 119, 6, 0.15);
  --red-main: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.1);
  --sidebar-w: 265px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --table-hover: #f1f5f9;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

/* Dashboard Layout */
.dash-layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar */
.dash-sidebar {
  width: var(--sidebar-w);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-card);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 16px;
  z-index: 100;
  transition: background-color 0.25s ease, border-color 0.25s ease, left 0.3s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 24px;
  padding: 0 8px;
  letter-spacing: -0.3px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.nav-item:hover {
  background-color: rgba(229, 72, 77, 0.08);
  color: var(--coral-main);
  transform: translateX(2px);
}

.nav-item.active {
  background-color: var(--coral-main);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 10px var(--coral-glow);
}

/* Executive User Card in Sidebar Footer */
.dash-user-card {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--coral-main);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.dash-user-info { flex: 1; min-width: 0; }
.dash-user-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-user-role {
  margin-top: 2px;
}
.dash-logout-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.dash-logout-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  transform: scale(1.08);
}

/* Main Area */
.dash-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--bg-dark);
}

.dash-topbar {
  height: 68px;
  border-bottom: 1px solid var(--border-card);
  background-color: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.dash-theme-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s ease;
}
.dash-theme-btn:hover {
  border-color: var(--coral-main);
  color: var(--coral-main);
  transform: scale(1.05);
}

.dash-content {
  padding: 32px;
  flex: 1;
  max-width: 1200px;
}

/* Stat Cards & KPI Grid */
.dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.dash-stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
  position: relative;
  overflow: hidden;
}
.dash-stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(148, 163, 184, 0.25);
}

.dash-stat-green::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--green-main), transparent);
}
.dash-stat-blue::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--blue-main), transparent);
}
.dash-stat-coral::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--coral-main), transparent);
}

.dash-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.6px;
}
.dash-stat-val {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 8px 0;
  letter-spacing: -0.5px;
}
.dash-stat-sub { font-size: 0.82rem; color: var(--text-muted); }

/* Main Dashboard Card Panels */
.dash-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.dash-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: -0.2px;
  flex-wrap: wrap;
  gap: 10px;
}

/* Danger Zone Card */
.dash-danger-card {
  background-color: var(--bg-card);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
}
.dash-danger-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--red-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Form Controls & Inputs */
.form-group {
  margin-bottom: 20px;
}
.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.form-control {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-control:focus {
  border-color: var(--coral-main);
  box-shadow: 0 0 0 3px var(--coral-glow);
}
.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.badge-pro, .badge-coral { background: rgba(229, 72, 77, 0.12); color: var(--coral-main); border: 1px solid rgba(229, 72, 77, 0.25); }
.badge-green { background: var(--green-bg); color: var(--green-main); border: 1px solid rgba(16, 185, 129, 0.25); }
.badge-blue { background: var(--blue-bg); color: var(--blue-main); border: 1px solid rgba(59, 130, 246, 0.25); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow-main); border: 1px solid rgba(245, 158, 11, 0.25); }
.badge-gray { background: rgba(148, 163, 184, 0.12); color: var(--text-muted); border: 1px solid var(--border-card); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  text-decoration: none;
}
.btn-coral {
  background-color: var(--coral-main);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--coral-glow);
}
.btn-coral:hover {
  background-color: var(--coral-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--coral-glow);
}
.btn-secondary {
  background-color: var(--bg-card);
  border-color: var(--border-card);
  color: var(--text-main);
}
.btn-secondary:hover {
  border-color: var(--coral-main);
  color: var(--coral-main);
  transform: translateY(-1px);
}
.btn-danger {
  background: var(--red-bg);
  color: var(--red-main);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
  background: var(--red-main);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Responsive Table Wrapper */
.dash-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
  min-width: 600px;
}
.dash-table th {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-card);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-sidebar);
}
.dash-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-card);
  color: var(--text-main);
  vertical-align: middle;
}
.dash-table tr:hover td {
  background-color: var(--table-hover);
}

/* Code Snippets */
code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85rem;
  background: rgba(148, 163, 184, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-main);
}

/* ==============================================================================
   RESPONSIVE DRAWER & BREAKPOINTS (TABLET & MOBILE)
   ============================================================================== */
.dash-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  z-index: 98;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.dash-backdrop.active {
  display: block;
  opacity: 1;
}

.mobile-nav-toggle {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s ease;
}
.mobile-nav-toggle:hover {
  border-color: var(--coral-main);
  color: var(--coral-main);
}

@media (max-width: 900px) {
  .mobile-nav-toggle { display: inline-flex; }
  .dash-sidebar {
    position: fixed;
    left: -285px;
    top: 0;
    bottom: 0;
    width: 285px;
    z-index: 99;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.6);
  }
  .dash-sidebar.open { left: 0; }
  .dash-topbar { padding: 0 16px; height: 62px; }
  .dash-content { padding: 20px 16px; }
  .dash-stat-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
}

@media (max-width: 580px) {
  .dash-stat-grid { grid-template-columns: 1fr; }
  .dash-card, .dash-danger-card { padding: 18px 14px; }
  .dash-stat-val { font-size: 1.6rem; }
}

/* Tool Launcher Tiles */
.tool-launcher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.tool-launcher-tile {
  background-color: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
}
.tool-launcher-tile:hover {
  transform: translateY(-2px);
  border-color: var(--coral-main);
  box-shadow: 0 4px 14px var(--coral-glow);
}
.tool-tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.tool-tile-info {
  flex: 1;
  min-width: 0;
}
.tool-tile-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tool-tile-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Privacy Guarantee Card */
.privacy-badge-card {
  background: linear-gradient(135deg, rgba(229, 72, 77, 0.06), rgba(59, 130, 246, 0.04));
  border: 1px dashed rgba(229, 72, 77, 0.28);
  border-radius: var(--radius-md);
  padding: 20px 24px;
}

