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

:root {
  /* Light Mode Palette */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-sidebar: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  
  --primary: #0d9488; /* Teal 600 */
  --primary-hover: #0f766e;
  --primary-light: #ccfbf1;
  --primary-glow: rgba(13, 148, 136, 0.15);
  
  --accent: #6366f1; /* Indigo 500 */
  --accent-light: #e0e7ff;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 20px 0 rgba(13, 148, 136, 0.2);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --font-family: 'Outfit', sans-serif;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  /* Dark Mode Palette */
  --bg-primary: #090d16;
  --bg-secondary: #111827;
  --bg-sidebar: #0b0f19;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #4b5563;
  --border-color: #1f2937;
  
  --primary: #2dd4bf; /* Teal 400 */
  --primary-hover: #14b8a6;
  --primary-light: #115e59;
  --primary-glow: rgba(45, 212, 191, 0.2);
  
  --accent: #818cf8; /* Indigo 400 */
  --accent-light: #312e81;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 25px 0 rgba(45, 212, 191, 0.15);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Main Layout Grid */
.app-container {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

@media (max-width: 992px) {
  .app-container {
    grid-template-columns: 1fr;
  }
}

/* Sidebar Styling */
aside.sidebar {
  background-color: var(--bg-sidebar);
  color: #ffffff;
  padding: 24px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
  z-index: 100;
}

@media (max-width: 992px) {
  aside.sidebar {
    display: none; /* In production, we toggle this with a hamburger */
  }
  aside.sidebar.active {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: white;
}

.brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.menu-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: var(--transition);
}

.menu-item.active a,
.menu-item a:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}

.menu-item.active a {
  background: linear-gradient(90deg, var(--primary), rgba(13, 148, 136, 0.2));
  color: #ffffff;
}

.sidebar-footer {
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Main Content Area */
main.main-content {
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 768px) {
  main.main-content {
    padding: 20px;
    gap: 20px;
  }
}

/* Top Navigation Bar */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.nav-title h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.8px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary);
  color: white !important;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

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

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

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

.btn-danger:hover {
  filter: brightness(0.9);
}

/* Theme Toggle Button */
.theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.theme-toggle:hover {
  transform: scale(1.05);
  border-color: var(--primary);
}

/* Dashboard Metrics Row */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.metric-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-glow);
}

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

.metric-value {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -1px;
}

/* Main Cards */
.card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* Charts Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

@media (max-width: 992px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  position: relative;
  width: 100%;
  height: 320px;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

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

th {
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

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

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

tr:hover td {
  background-color: rgba(13, 148, 136, 0.02);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

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

.form-group-full {
  grid-column: 1 / -1;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  font-family: var(--font-family);
  font-size: 0.95rem;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.checkbox-group input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.badge-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.badge-info {
  background-color: rgba(6, 182, 212, 0.1);
  color: var(--info);
}

/* Alert notifications */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 20px;
}

.alert-success {
  background-color: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.alert-danger {
  background-color: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

/* Search bar styling */
.search-form {
  display: flex;
  gap: 12px;
}

/* Login Page specific styles */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(circle at center, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.login-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.login-header .sidebar-logo {
  width: 48px;
  height: 48px;
  font-size: 1.25rem;
}

/* Dynamic rows editor for alternative options */
.dynamic-row {
  display: grid;
  grid-template-columns: 2fr 3fr 1fr auto;
  gap: 16px;
  align-items: center;
}

@media (max-width: 576px) {
  .dynamic-row {
    grid-template-columns: 1fr;
  }
}

/* Document detailed quote layouts */
.document-container {
  background: white;
  color: #1e293b;
  max-width: 900px;
  margin: 0 auto;
  padding: 60px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.document-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #0d9488;
  padding-bottom: 24px;
}

.doc-logo-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-logo {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0d9488;
  letter-spacing: -1px;
}

.doc-meta {
  text-align: right;
  font-size: 0.9rem;
  color: #64748b;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.doc-client-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  background-color: #f8fafc;
  padding: 24px;
  border-radius: var(--radius-md);
}

.client-col h3, .vendor-col h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.client-col p, .vendor-col p {
  font-size: 0.95rem;
  line-height: 1.6;
}

.doc-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
}

.doc-table th {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
  font-size: 0.85rem;
  text-transform: uppercase;
  padding: 12px;
  border-bottom: 2px solid #e2e8f0;
}

.doc-table td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
  font-size: 0.95rem;
}

.doc-table tr:hover td {
  background-color: transparent;
}

.price-summary-box {
  align-self: flex-end;
  width: 320px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}

.summary-row-bold {
  display: flex;
  justify-content: space-between;
  font-size: 1.15rem;
  font-weight: 800;
  color: #0d9488;
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
  margin-top: 4px;
}
