/* ==========================================================================
   AO COSTING — Offset Printing & Packaging Costing Platform CSS
   Design System, Component Styles, Layout & Print Styles
   ========================================================================== */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Primary Colors */
  --bg-dark: #0f172a;
  --sidebar-bg: #14283f;
  --sidebar-active: #173f72;
  --sidebar-hover: #1e3654;
  --primary: #173f72;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  /* Neutral Surface & Borders */
  --bg-page: #f4f6f8;
  --card-bg: #ffffff;
  --border-color: #dfe4e8;
  --border-light: #edf0f2;
  --text-main: #17202a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

/* Sidebar Dock */
.sidebar {
  width: 250px;
  background-color: var(--sidebar-bg);
  color: #ffffff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #ffffff;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 16px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: #d1d5db;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background-color: var(--sidebar-active);
  color: #ffffff;
  font-weight: 700;
}

.nav-item .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.nav-item.active .nav-badge {
  background-color: var(--accent-cyan);
  color: #0f172a;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 11px;
  color: #64748b;
}

/* Main Viewport */
.main-content {
  flex: 1;
  padding: 28px 36px 48px;
  max-width: 1440px;
  overflow-y: auto;
}

/* Top Bar / Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.btn:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

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

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

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

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

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

/* Cards & Grid Layouts */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Metric Cards */
.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-value {
  font-size: 28px;
  font-weight: 800;
  margin: 6px 0 2px;
  color: var(--text-main);
}

.metric-sub {
  font-size: 11px;
  color: var(--text-light);
}

/* Forms & Input Controls */
.field-group {
  margin-bottom: 14px;
}

.field-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 5px;
}

.input-control, select.input-control, textarea.input-control {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-control:focus, select.input-control:focus, textarea.input-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 63, 114, 0.12);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Wizard Component */
.wizard-progress {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.wizard-track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow-x: auto;
  padding-bottom: 4px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.wizard-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.wizard-step.active .wizard-dot {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.wizard-step.done .wizard-dot {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.wizard-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.wizard-step.active .wizard-name {
  color: var(--primary);
  font-weight: 800;
}

.wizard-line {
  flex: 1;
  height: 2px;
  background-color: #e2e8f0;
  margin: 0 10px;
  min-width: 20px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--card-bg);
}

.data-table th, .data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.data-table th {
  background-color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

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

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.badge-draft { background-color: #f1f5f9; color: #475569; }
.badge-pending { background-color: #fef3c7; color: #92400e; }
.badge-approved { background-color: #d1fae5; color: #065f46; }
.badge-cyan { background-color: #cff4fc; color: #055160; }

/* SVG Canvas Visualizer */
.ups-canvas-container {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: #fafafa;
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: auto;
}

.ups-info-bar {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Summary Table */
.summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.summary-row.grand-total {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  border-top: 2px solid var(--border-color);
  border-bottom: 2px solid var(--border-color);
  padding: 14px 0;
  margin-top: 10px;
}

/* Modal Overlay */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

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

.modal-card {
  background-color: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
}

/* Responsive adjustments */
@media (max-width: 960px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .main-content { padding: 20px; }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .row-2 { grid-template-columns: 1fr; }
}

/* Print Quotation Styles */
@media print {
  body {
    background-color: #ffffff !important;
    color: #000000 !important;
  }
  .sidebar, .page-header, .header-actions, .wizard-progress, .btn, .no-print {
    display: none !important;
  }
  .main-content {
    padding: 0 !important;
    max-width: 100% !important;
  }
  .printable-quote {
    display: block !important;
  }
}

.muted-text {
  font-size: 12px;
  color: var(--text-muted);
}
