/* Crown UPVC Enterprise Suite - Premium Stylesheet */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;900&family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap');

/* CSS Variables for Premium Light / Gold Theme */
:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  
  --accent-gold: #1a73e8;
  --accent-gold-hover: #1557b0;
  --accent-gold-glow: rgba(26, 115, 232, 0.15);
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --border-color: #e2e8f0;
  --border-glow: rgba(26, 115, 232, 0.05);
  
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0284c7;

  --sidebar-width: 260px;
  --header-height: 70px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

/* Global resets & scrollbar */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  overflow-x: hidden;
  min-height: 100vh;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

/* App Layout Grid */
.app-container {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  min-width: 0;
}

/* Sidebar Styling */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-section {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.logo-icon {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #1557b0 100%);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px var(--accent-gold-glow);
}

.logo-icon svg {
  fill: #fff;
  width: 24px;
  height: 24px;
}

.logo-text h1 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.logo-text span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent-gold);
  font-weight: 600;
  display: block;
}

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

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition-smooth);
  cursor: pointer;
}

.menu-item svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-secondary);
  fill: none;
  stroke-width: 2;
  transition: var(--transition-smooth);
}

.menu-item:hover, .menu-item.active {
  color: var(--text-primary);
  background: rgba(26, 115, 232, 0.08);
}

.menu-item.active {
  border-left: 3px solid var(--accent-gold);
  box-shadow: inset 8px 0 16px rgba(26, 115, 232, 0.03);
}

.menu-item:hover svg, .menu-item.active svg {
  stroke: var(--accent-gold);
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* Main Dashboard Panel */
.main-panel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  min-width: 0;
}

/* Header Styling */
.app-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-title h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
}

.header-title p {
  font-size: 12px;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.notification-bell {
  position: relative;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 8px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.notification-bell:hover {
  border-color: var(--accent-gold);
  box-shadow: 0 0 10px rgba(26, 115, 232, 0.2);
}

.notification-bell::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: 20px;
  border-left: 1px solid var(--border-color);
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  box-shadow: 0 0 8px rgba(26, 115, 232, 0.2);
}

.user-info span {
  font-size: 13px;
  font-weight: 600;
  display: block;
}

.user-info small {
  font-size: 11px;
  color: var(--text-muted);
}

/* View/Section Layouts */
.content-body {
  padding: 32px;
  flex-grow: 1;
  min-width: 0;
}

.view-section {
  display: none;
  animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dashboard UI Components */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.kpi-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  transition: var(--transition-smooth);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent-gold), transparent);
  opacity: 0;
  transition: var(--transition-smooth);
}

.kpi-card:hover {
  transform: translateY(-4px);
  border-color: rgba(26, 115, 232, 0.35);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-icon {
  background: var(--bg-tertiary);
  border-radius: 12px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
}

.kpi-icon svg {
  stroke: var(--accent-gold);
  width: 24px;
  height: 24px;
  fill: none;
  stroke-width: 2;
}

.kpi-card h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.kpi-number {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.kpi-trend {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-trend.positive {
  color: var(--success);
}
.kpi-trend.negative {
  color: var(--danger);
}

/* Dashboard Columns Layout */
.dashboard-columns {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
}

.card-panel {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.95) 100%);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 26px;
  margin-bottom: 32px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.02), 0 4px 12px -2px rgba(26, 115, 232, 0.03);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: var(--transition-smooth);
  min-width: 0;
}

.card-panel:hover {
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.04), 0 6px 16px -2px rgba(26, 115, 232, 0.06);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  border-bottom: 1.5px solid rgba(26, 115, 232, 0.1);
  padding-bottom: 12px;
}

.card-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

/* Custom Charts */
.performance-chart {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 200px;
  padding-top: 20px;
  border-bottom: 1px solid var(--border-color);
}

.bar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-grow: 1;
}

.bar {
  width: 32px;
  background: linear-gradient(180deg, var(--accent-gold) 0%, rgba(26, 115, 232, 0.2) 100%);
  border-radius: 6px 6px 0 0;
  transition: height 1s ease-in-out;
  position: relative;
  box-shadow: 0 0 10px var(--accent-gold-glow);
}

.bar:hover {
  background: linear-gradient(180deg, var(--accent-gold-hover) 0%, rgba(26, 115, 232, 0.4) 100%);
}

.bar-tooltip {
  position: absolute;
  top: -28px;
  background: var(--bg-tertiary);
  border: 1px solid var(--accent-gold);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transform: translateY(5px);
  transition: var(--transition-smooth);
  pointer-events: none;
}

.bar:hover .bar-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.bar-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 10px;
  text-align: center;
  max-width: 70px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Recent Activity & Lists */
.activity-list, .data-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-color);
}

.activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.activity-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.activity-avatar svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent-gold);
  stroke-width: 2;
  fill: none;
}

.activity-info {
  flex-grow: 1;
}

.activity-info p {
  font-size: 13px;
  font-weight: 500;
}

.activity-info span {
  font-size: 11px;
  color: var(--text-muted);
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
}

/* Quote Builder Layout */
.quote-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr;
  gap: 32px;
  min-width: 0;
}

/* Forms styling */
.form-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-group.full-width {
  grid-column: span 2;
}

label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

input, select, textarea {
  width: 100%;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  transition: var(--transition-smooth);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.01);
}

input:hover, select:hover, textarea:hover {
  border-color: rgba(26, 115, 232, 0.4);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 4px var(--accent-gold-glow);
  background: #ffffff;
}

/* Buttons styling */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #1557b0 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(26, 115, 232, 0.25);
  border: 1px solid rgba(26, 115, 232, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-gold-hover) 0%, var(--accent-gold) 100%);
  box-shadow: 0 6px 20px rgba(26, 115, 232, 0.45);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #ffffff;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--accent-gold);
  color: var(--text-primary);
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}

.btn-secondary.active {
  border-color: var(--accent-gold);
  background: rgba(26, 115, 232, 0.08);
  color: var(--accent-gold);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.1);
  font-weight: 700;
}

.color-badge {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  vertical-align: middle;
  margin-right: 8px;
}

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

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

.btn-group {
  display: flex;
  gap: 12px;
}

/* Visualizer Container and Blueprint styling */
.visualizer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.visualizer-canvas {
  width: 100%;
  max-width: 440px;
  height: 320px;
  background: #0f172a;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 4px 20px rgba(0,0,0,0.5);
  margin-bottom: 20px;
}

.visualizer-canvas::before {
  content: "ENGINEERING VIEW";
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-family: monospace;
}

/* Bill of Materials (BOM) styling */
.bom-section {
  width: 100%;
}

.bom-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 13px;
}

.bom-table th {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.bom-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

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

.bom-total {
  border-top: 1px solid var(--accent-gold);
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bom-total h4 {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text-secondary);
}

.bom-total-amount {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-gold);
  text-shadow: 0 0 10px var(--accent-gold-glow);
}

/* Quotation items lists and print view triggers */
.quote-cart-panel {
  margin-top: 32px;
}

.quote-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.quote-items-table th, .quote-items-table td {
  padding: 10px 8px;
}

.quote-items-table th {
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-weight: 600;
}

.quote-items-table td {
  border-bottom: 1px solid var(--border-color);
}

.quote-items-table tr:hover td {
  background: rgba(255,255,255,0.01);
}

.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-approved { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-pending { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-draft { background: rgba(148, 163, 184, 0.1); color: var(--text-secondary); }

/* Fabricator directory layouts */
.directory-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0 16px;
  width: 300px;
}

.search-box svg {
  stroke: var(--text-muted);
  width: 18px;
  height: 18px;
  fill: none;
}

.search-box input {
  background: transparent;
  border: none;
  width: 100%;
}

.search-box input:focus {
  box-shadow: none;
}

.fabricator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.fabricator-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  transition: var(--transition-smooth);
}

.fabricator-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-gold);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

.tier-badge {
  position: absolute;
  top: 20px;
  right: 20px;
}

.tier-platinum {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  color: #1e293b;
  box-shadow: 0 0 10px rgba(226, 232, 240, 0.3);
}

.tier-gold {
  background: linear-gradient(135deg, #ffe066 0%, var(--accent-gold) 100%);
  color: #1e293b;
  box-shadow: 0 0 10px var(--accent-gold-glow);
}

.tier-silver {
  background: linear-gradient(135deg, #94a3b8 0%, #475569 100%);
  color: #ffffff;
}

.fabricator-card h4 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
  padding-right: 70px;
}

.fab-owner {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.fab-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 20px;
}

.fab-details-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.fab-details-item svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
}

.fab-stats {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.fab-stat-box {
  text-align: center;
}

.fab-stat-box span {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
}

.fab-stat-box strong {
  font-size: 16px;
  color: var(--accent-gold);
}

/* Certificate View specific layouts */
.cert-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 32px;
  min-width: 0;
}

.template-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.template-option {
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.template-option:hover {
  border-color: var(--text-secondary);
}

.template-option.active {
  border-color: var(--accent-gold);
  background: rgba(26, 115, 232, 0.08);
}

.template-preview-badge {
  width: 32px;
  height: 20px;
  border-radius: 4px;
  margin: 0 auto 8px auto;
}

.preview-gold { background: linear-gradient(135deg, #eae5d8 0%, #d4af37 100%); }
.preview-titanium { background: linear-gradient(135deg, #cbd5e1 0%, #475569 100%); }
.preview-emerald { background: linear-gradient(135deg, #e8f5e9 0%, #047857 100%); }

.template-option span {
  font-size: 11px;
  font-weight: 600;
  display: block;
}

/* Cert Preview Display Box */
.cert-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.cert-preview-wrapper {
  width: 800px;
  height: 566px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  overflow: hidden;
  position: relative;
  transform-origin: top center;
  transition: var(--transition-smooth);
  flex-shrink: 0;
}

/* Catalog Editor Settings styling */
.catalog-table {
  width: 100%;
  border-collapse: collapse;
}

.catalog-table th, .catalog-table td {
  padding: 12px 20px;
  text-align: left;
}

.catalog-table th {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.catalog-table td {
  border-bottom: 1px solid var(--border-color);
}

.catalog-table input {
  padding: 6px 12px;
  width: 100px;
}

/* Modals overlays styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 600px;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

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

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-tertiary);
}

/* Toast Notifications styling */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent-gold);
  border-top: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.3);
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 280px;
}

.toast.show {
  transform: translateX(0);
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--info); }

.toast svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

/* Printable PDF stylesheet structures */
@media print {
  /* Named page sizes for A4 portrait quotes & A4 landscape certificates */
  @page portrait-page {
    size: A4 portrait;
    margin: 10mm;
  }
  @page landscape-page {
    size: A4 landscape;
    margin: 0;
  }

  html, body {
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Hide all interactive app bars and layouts */
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  
  .app-container {
    display: none !important;
  }
  
  #print-quote-target.print-active {
    display: block !important;
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: auto !important;
  }

  #print-cert-target.print-active {
    display: block !important;
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }

  #print-cert-target.print-active .cert-print-container {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #print-cert-target.print-active .cert-print-container .cert-wrapper {
    width: 100% !important;
    height: 100% !important;
  }
  
  .sidebar, .app-header, .btn-group, .btn, .directory-actions, 
  .form-panel, .visualizer-card, .template-selector, 
  .toast-container, .modal-overlay {
    display: none !important;
  }
  
  .main-panel {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }
  
  .content-body {
    padding: 0 !important;
  }
  
  .view-section {
    display: none !important;
  }
  
  /* Isolated display sections for print targets */
  .view-section.print-active {
    display: none !important;
  }
}

  /* Certificate specific print layouts */
  .cert-print-container {
    page: landscape-page;
    display: block !important;
    width: 297mm !important;  /* A4 Landscape Width */
    height: 210mm !important; /* A4 Landscape Height */
    margin: 0 auto !important;
    padding: 0 !important;
  }
  
  


  .cert-print-container .cert-wrapper {
    width: 297mm !important;
    height: 210mm !important;
  }

  .cert-wrapper {
    border: 8px double #d4af37 !important;
    box-shadow: none !important;
    background: #f7f5ee !important; /* Force nice certificate background tint */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .cert-wrapper.commitment-template {
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Quotation specific print layouts */
  .quote-print-container {
    page: portrait-page;
    display: block !important;
    width: 100% !important;
    max-width: 190mm !important;
    padding: 10px 0 !important;
    margin: 0 auto !important;
    color: #000000 !important;
    background: #ffffff !important;
    box-sizing: border-box;
  }

  .quote-print-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #333;
    padding-bottom: 20px;
    margin-bottom: 20px;
  }

  .quote-print-header h1 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
  }

  .quote-print-body {
    font-size: 12px;
    line-height: 1.5;
  }

  .quote-print-details {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    background: #f8fafc;
    padding: 15px;
    border: 1px solid #e2e8f0;
  }

  .quote-print-details td {
    padding: 4px 8px;
  }

  .quote-print-items {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
  }

  .quote-print-items th, .quote-print-items td {
    border: 1px solid #cbd5e1;
    padding: 10px 12px;
    text-align: left;
  }

  .quote-print-items th {
    background-color: #f1f5f9 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .quote-print-total {
    margin-left: auto;
    width: 300px;
    border-collapse: collapse;
  }

  .quote-print-total td {
    padding: 8px 12px;
    font-size: 13px;
  }

  .quote-print-total tr.grand-total td {
    font-size: 16px;
    font-weight: 700;
    border-top: 2px solid #333;
  }

  .quote-print-footer {
    margin-top: 50px;
    border-top: 1px solid #cbd5e1;
    padding-top: 15px;
    font-size: 10px;
    color: #64748b;
    text-align: center;
  }

  /* Window Makers Print Styles */
  .wm-print-container {
    page: portrait-page;
    width: 100% !important;
    max-width: 190mm !important;
    padding: 5mm 0;
    margin: 0 auto;
    font-family: 'Inter', sans-serif;
    color: #000000;
    background: #ffffff;
    box-sizing: border-box;
    font-size: 10.5px;
    line-height: 1.35;
  }

  .wm-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #000000;
    padding-bottom: 10px;
    margin-bottom: 12px;
  }

  .wm-logo-col {
    display: flex;
    flex-direction: column;
  }

  .wm-logo-row {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .wm-logo-icon {
    width: 32px;
    height: 32px;
    border: 2.5px solid #b91c1c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    color: #b91c1c;
    font-size: 18px;
    font-family: 'Outfit', sans-serif;
  }

  .wm-logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: #000000;
    line-height: 1;
    text-transform: uppercase;
  }

  .wm-logo-subtext {
    font-size: 8px;
    letter-spacing: 1.5px;
    color: #4b5563;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 2px;
    display: block;
  }

  .wm-addr-col {
    text-align: right;
    font-size: 9px;
    color: #374151;
    line-height: 1.35;
    max-width: 350px;
  }

  .wm-client-summary-grid {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 20px;
  }

  .wm-client-info {
    flex-grow: 1;
    line-height: 1.45;
  }

  .wm-brand-box {
    border: 1.5px solid #000000;
    padding: 8px 16px;
    text-align: center;
    min-width: 260px;
    font-family: 'Outfit', sans-serif;
    border-radius: 4px;
  }

  .wm-brand-box div {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: #374151;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .wm-brand-box div:last-child {
    margin-bottom: 0;
  }

  .wm-brand-box strong {
    font-size: 11.5px;
    color: #000000;
    font-weight: 800;
    margin-left: 8px;
  }

  .wm-title-bar {
    text-align: center;
    margin: 12px 0 8px 0;
  }

  .wm-title-bar h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: underline;
    letter-spacing: 0.5px;
    margin: 0;
  }

  .wm-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
    font-size: 9.5px;
  }

  .wm-table th, .wm-table td {
    border: 1px solid #000000;
    padding: 4px 5px;
    text-align: left;
    vertical-align: middle;
  }

  .wm-table th {
    background-color: #f3f4f6 !important;
    font-weight: 700;
    text-align: center;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .wm-table td.center {
    text-align: center;
  }

  .wm-table td.right {
    text-align: right;
  }

  .wm-summary-table {
    width: 380px;
    border-collapse: collapse;
    font-size: 10px;
    margin-left: auto;
    margin-top: 10px;
  }

  .wm-summary-table td {
    border: 1px solid #000000;
    padding: 5px 8px;
  }

  .wm-summary-table td.label-col {
    font-weight: 700;
    text-align: right;
    background-color: #f9fafb !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .wm-summary-table td.val-col {
    text-align: right;
    font-weight: 700;
    width: 90px;
  }

  .wm-summary-table tr.highlight td {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    font-size: 11px;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .wm-terms {
    font-size: 8px;
    line-height: 1.35;
    color: #374151;
    border-top: 1px solid #000000;
    padding-top: 8px;
    margin-top: 15px;
  }

  .wm-terms strong {
    display: block;
    font-size: 8.5px;
    color: #000000;
    margin-bottom: 2px;
  }

/* Verification Portal Styles */
.verify-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 30px;
  margin-top: 20px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
  display: inline-block;
  width: 100%;
  max-width: 500px;
  text-align: left;
  position: relative;
  overflow: hidden;
  border-top: 4px solid var(--accent-gold);
}

.verify-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 20px;
  margin-bottom: 20px;
}

.verify-badge-valid {
  background: rgba(5, 150, 105, 0.1);
  color: var(--success);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.verify-badge-invalid {
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.verify-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
  font-size: 13px;
}

.verify-details-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.verify-details-item span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.verify-details-item strong {
  color: var(--text-primary);
  font-size: 14px;
}

/* Printable SVG design thumbnail in items list */
.print-drawing-col {
  width: 100px;
  text-align: center;
  vertical-align: middle;
}

.print-drawing-col svg {
  width: 90px;
  height: 65px;
  display: block;
  margin: 0 auto;
}

/* Print styles for blueprint SVGs inside table */
  .quote-print-items td svg {
    max-width: 90px !important;
    max-height: 65px !important;
  }
  .quote-print-items td svg rect {
    fill: #f8fafc !important;
    stroke: #e2e8f0 !important;
  }

.quote-items-table tr.selected-row td {
  background: rgba(26, 115, 232, 0.08) !important;
  border-color: rgba(26, 115, 232, 0.2) !important;
  font-weight: 500;
}

/* Hide print target elements in screen mode */
#print-quote-target,
#print-cert-target {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 794px;
  height: auto;
  overflow: visible;
}

/* Responsive Table Wrapper Utility */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}
/* Sub-navigation tab container */
.tab-container {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  flex-wrap: wrap;
}

/* Quote Surcharges & Invoice Print settings grid */
.quote-surcharges-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr;
  gap: 32px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  min-width: 0;
}

/* Responsive Layout Media Queries */
@media (max-width: 992px) {
  /* Sidebar to horizontal top header */
  .app-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }

  .sidebar {
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
  }

  .logo-section {
    padding: 0;
    border-bottom: none;
  }

  .sidebar-menu {
    flex-direction: row;
    padding: 0;
    gap: 16px;
    flex-grow: 0;
    flex-wrap: wrap;
    justify-content: center;
  }

  .menu-item {
    padding: 8px 16px;
  }

  .menu-item.active {
    border-left: none;
    border-bottom: 3px solid var(--accent-gold);
    box-shadow: inset 0 -4px 12px rgba(26, 115, 232, 0.03);
  }

  .sidebar-footer {
    display: none; /* Hide footer on mobile sidebar */
  }

  .main-panel {
    height: auto;
    overflow-y: visible;
  }

  .app-header {
    padding: 0 24px;
    position: relative;
  }

  .content-body {
    padding: 24px 16px;
  }

  /* Stack multi-column grids */
  .dashboard-columns,
  .quote-grid,
  .cert-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  /* Form row elements on tablets */
  .form-row {
    gap: 16px;
  }
}

@media (max-width: 768px) {
  .app-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    min-height: 100vh;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    height: auto;
    padding: 16px 20px;
    gap: 12px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
  }

  .user-profile {
    border-left: none;
    padding-left: 0;
  }

  .header-logo-mobile {
    display: block !important;
  }

  /* Make sidebar a beautiful bottom navigation bar */
  .sidebar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 64px !important;
    background: #ffffff !important;
    border-top: 1px solid var(--border-color) !important;
    border-right: none !important;
    border-bottom: none !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-around !important;
    padding: 0 4px !important;
    z-index: 1000 !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08) !important;
    top: auto !important;
  }

  .logo-section {
    display: none !important;
  }

  .sidebar-menu {
    flex-direction: row !important;
    width: 100% !important;
    justify-content: space-around !important;
    padding: 0 !important;
    gap: 4px !important;
    margin: 0 !important;
    flex-wrap: nowrap !important;
  }

  .menu-item {
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    padding: 8px 4px !important;
    font-size: 9px !important;
    border-radius: 8px !important;
    color: var(--text-muted) !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    flex: 1 !important;
    text-align: center !important;
    min-width: 0 !important;
  }

  .menu-item.active {
    color: var(--accent-gold) !important;
    border-left: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
  }

  .menu-item svg {
    width: 20px !important;
    height: 20px !important;
  }

  .sidebar-footer {
    display: none !important;
  }

  .main-panel {
    height: auto !important;
    overflow-y: visible !important;
    padding-bottom: 74px !important; /* Spacing for bottom navigation bar */
  }

  .content-body {
    padding: 16px 12px !important;
  }

  .quote-surcharges-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 576px) {
  /* Stack form row columns on mobile screens */
  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

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

  .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
  }

  .tab-container {
    flex-direction: column;
    gap: 8px;
  }
}

/* Quote Preview Display Box */
.quote-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  margin-bottom: 20px;
}

.quote-preview-wrapper {
  width: 794px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  overflow: hidden;
  position: relative;
  transform-origin: top center;
  transition: var(--transition-smooth);
}

/* Responsive Surcharges & Taxes Layout */
.surcharge-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.surcharge-row input[type="checkbox"] {
  flex-shrink: 0;
}

.surcharge-row label {
  margin-bottom: 0 !important;
  flex: 1 1 auto;
  min-width: 150px;
}

.surcharge-row .surcharge-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Detailed Invoice Totals Summary */
.summary-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  font-size: 14px;
  font-family: var(--font-display);
  width: 100%;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 300px;
  box-sizing: border-box;
}

.summary-row.grand-total-row {
  font-size: 20px;
  font-weight: 700;
  border-top: 1.5px solid var(--accent-gold);
  padding-top: 10px;
  margin-top: 5px;
  max-width: 300px;
}

/* Certificate download grid */
.cert-download-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

@media (max-width: 480px) {
  .surcharge-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .surcharge-row label {
    width: 100%;
  }
  .surcharge-row .surcharge-inputs {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
  .cert-download-grid {
    grid-template-columns: 1fr;
  }
}
