/*
 * NeoQuote Corporate & Proposal Design System
 * NeomanTech Labs
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-code: 'JetBrains Mono', monospace;

  --brand-primary: #1B5559;
  --brand-primary-hover: #144245;
  --brand-primary-light: rgba(27, 85, 89, 0.08);
  --brand-accent: #4FB5AA;

  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --bg-sidebar: #1B5559;

  --text-heading: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;

  --border-color: #e2e8f0;
  --border-strong: #cbd5e1;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.14), 0 4px 10px -2px rgba(15, 23, 42, 0.05);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px 0 rgba(0, 0, 0, 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-main); background-color: var(--bg-body); color: var(--text-body); line-height: 1.55; min-height: 100vh; }
a { color: var(--brand-primary); text-decoration: none; font-weight: 500; }

/* Admin Layout */
.app-container { display: flex; min-height: 100vh; width: 100%; }
.sidebar { width: 260px; background: var(--bg-sidebar); display: flex; flex-direction: column; padding: 1.5rem 1.25rem; position: fixed; top: 0; bottom: 0; left: 0; z-index: 100; }
.sidebar-brand { display: flex; align-items: center; justify-content: center; gap: 0.75rem; margin-bottom: 1.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.logo-wrapper { background: #ffffff; padding: 10px 16px; border-radius: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); width: 100%; max-width: 215px; margin: 0 auto; }
.logo-wrapper img { max-height: 60px; width: auto; max-width: 100%; object-fit: contain; }
.brand-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--brand-accent); display: flex; align-items: center; justify-content: center; color: #1B5559; font-size: 1.25rem; }
.brand-text h1 { font-size: 1.25rem; font-weight: 800; color: #ffffff; }
.brand-text span { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 1.2px; color: var(--brand-accent); font-weight: 700; display: block; }

.nav-menu { list-style: none; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.nav-link { display: flex; align-items: center; gap: 0.85rem; padding: 0.75rem 1rem; border-radius: var(--radius-sm); color: rgba(255, 255, 255, 0.82); font-weight: 500; font-size: 0.92rem; transition: var(--transition); }
.nav-link i { font-size: 1.05rem; width: 22px; text-align: center; color: rgba(255, 255, 255, 0.65); }
.nav-link:hover { color: #ffffff; background: rgba(255, 255, 255, 0.08); }
.nav-link.active { color: #1B5559; background: var(--brand-accent); font-weight: 700; }
.nav-link.active i { color: #1B5559; }

.user-profile { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, 0.12); display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.user-info h4 { font-size: 0.86rem; font-weight: 700; color: #ffffff; }
.user-info p { font-size: 0.72rem; color: rgba(255, 255, 255, 0.7); word-break: break-all; }

.main-wrapper { margin-left: 260px; flex: 1; display: flex; flex-direction: column; min-width: 0; }
.top-bar { height: 64px; background: #ffffff; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 2rem; position: sticky; top: 0; z-index: 90; box-shadow: var(--shadow-sm); }
.top-bar-actions { display: flex; align-items: center; gap: 0.75rem; }
.page-title { font-size: 1.2rem; font-weight: 700; color: var(--text-heading); }
.content-area { padding: 1.75rem 2rem; flex: 1; }

/* Cards & Stats */
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.35rem; box-shadow: var(--shadow-card); margin-bottom: 1.25rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.15rem; padding-bottom: 0.85rem; border-bottom: 1px solid var(--border-color); }
.card-title { font-size: 1.02rem; font-weight: 700; color: var(--text-heading); display: flex; align-items: center; gap: 0.55rem; }
.card-title i { color: var(--brand-primary); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1.15rem; margin-bottom: 1.25rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.2rem 1.35rem; display: flex; align-items: center; justify-content: space-between; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--brand-primary); }
.stat-card.stat-warning::before { background: #d97706; }
.stat-card.stat-info::before { background: #2563eb; }
.stat-card.stat-success::before { background: #0d9488; }
.stat-info p { font-size: 0.76rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-info h3 { font-size: 1.6rem; font-weight: 800; color: var(--text-heading); margin-top: 0.2rem; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--brand-primary-light); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: var(--brand-primary); }

.search-box-inline { position: relative; min-width: 240px; flex: 1; max-width: 360px; }
.search-box-inline i { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-box-inline .form-control { padding-left: 2.35rem; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.filter-pill { padding: 0.38rem 0.8rem; border-radius: 99px; font-size: 0.78rem; font-weight: 600; border: 1px solid var(--border-color); background: var(--bg-subtle); color: var(--text-body); }
.filter-pill.active { background: var(--brand-primary); border-color: var(--brand-primary); color: #ffffff; }

/* Quote Editor & Totals */
.quote-totals-layout { display: flex; gap: 1.5rem; margin-top: 1.5rem; flex-wrap: wrap; align-items: flex-start; }
.quote-summary-box { min-width: 310px; background: var(--bg-subtle); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.15rem 1.35rem; }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 0.45rem 0; font-size: 0.9rem; }
.summary-grand-total { border-top: 2px solid var(--border-strong); margin-top: 0.5rem; padding-top: 0.75rem; font-size: 1.15rem; color: var(--brand-primary); font-weight: 800; }

/* Public Editorial Proposal View */
.public-quote-body { background: #e2e8f0; }
.public-action-bar { background: #ffffff; border-bottom: 1px solid var(--border-color); padding: 0.85rem 2rem; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 95; box-shadow: var(--shadow-sm); }
.public-quote-wrapper { max-width: 960px; margin: 1.75rem auto; padding: 0 1rem 3rem 1rem; }
.proposal-sheet { background: #ffffff; border-radius: var(--radius-lg); padding: 2.75rem; box-shadow: var(--shadow-lg); border-top: 6px solid var(--brand-primary); }

.proposal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); }
.proposal-brand { display: flex; align-items: center; gap: 1.15rem; flex-wrap: wrap; }
.proposal-logo { max-height: 68px; width: auto; max-width: 180px; object-fit: contain; }
.proposal-brand h1 { font-size: 1.45rem; font-weight: 800; color: var(--brand-primary); }
.proposal-brand p { font-size: 0.88rem; color: var(--text-muted); }
.proposal-agency-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }

.proposal-folio-box { text-align: right; background: var(--bg-subtle); padding: 0.85rem 1.25rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.folio-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 1px; color: var(--text-muted); }
.folio-number { font-family: var(--font-code); font-size: 1.3rem; font-weight: 800; color: var(--brand-primary); }
.folio-dates { font-size: 0.78rem; color: var(--text-body); margin-top: 0.25rem; }

.proposal-client-banner { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; background: rgba(27, 85, 89, 0.04); padding: 1.25rem 1.5rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); margin-top: 1.5rem; }
.mini-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700; color: var(--text-muted); display: block; margin-bottom: 0.2rem; }
.proposal-intro { margin-top: 1.25rem; font-size: 0.94rem; color: var(--text-body); border-left: 3px solid var(--brand-accent); padding-left: 1rem; }

.proposal-bottom-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.5rem; align-items: start; margin-top: 1rem; }
.proposal-terms h4 { font-size: 0.9rem; color: var(--brand-primary); margin-bottom: 0.3rem; }
.proposal-terms p { font-size: 0.86rem; color: var(--text-body); }
.proposal-totals-card { background: var(--bg-subtle); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.25rem; }

.proposal-signature-section { margin-top: 2rem; padding-top: 1.75rem; border-top: 1px solid var(--border-color); }
.signature-pad-wrap { border: 2px dashed var(--border-strong); border-radius: var(--radius-md); background: #ffffff; overflow: hidden; }
#signature-pad-canvas { width: 100%; height: 190px; display: block; cursor: crosshair; touch-action: none; }

.approved-certificate { background: #f0fdf4; border: 1px solid #86efac; border-radius: var(--radius-md); padding: 1.35rem; }
.approved-badge-hdr { color: #166534; font-weight: 800; font-size: 0.98rem; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.approved-body { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.signature-img-box { background: #ffffff; border: 1px solid #bbf7d0; border-radius: var(--radius-sm); padding: 0.5rem; }
.signature-img-box img { max-height: 95px; width: auto; display: block; }
.approved-meta { font-size: 0.88rem; color: #14532d; line-height: 1.6; }

/* Shared Components */
.badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.24rem 0.6rem; border-radius: 6px; font-size: 0.72rem; font-weight: 600; }
.badge-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.badge-info { background: #f0f9ff; color: #075985; border: 1px solid #bae6fd; }
.badge-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.badge-gray { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text-heading); }
.form-control { width: 100%; padding: 0.62rem 0.85rem; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text-heading); font-family: var(--font-main); font-size: 0.88rem; }
.form-control:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(27, 85, 89, 0.14); }

.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1.05rem; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; border: 1px solid transparent; cursor: pointer; transition: var(--transition); }
.btn-sm { padding: 0.38rem 0.72rem; font-size: 0.78rem; }
.btn-primary { background: var(--brand-primary); color: #ffffff; }
.btn-primary:hover { background: var(--brand-primary-hover); color: #ffffff; }
.btn-secondary { background: #ffffff; color: var(--text-body); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg-subtle); }

.table-responsive { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th { padding: 0.75rem 0.85rem; background: #f8fafc; color: var(--text-muted); font-weight: 700; font-size: 0.75rem; text-transform: uppercase; border-bottom: 1px solid var(--border-color); }
.table td { padding: 0.8rem 0.85rem; border-bottom: 1px solid var(--border-color); font-size: 0.86rem; vertical-align: top; }

.alert { padding: 0.9rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1.25rem; display: flex; align-items: center; gap: 0.75rem; font-size: 0.88rem; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: linear-gradient(135deg, #1B5559 0%, #144245 55%, #0f2f32 100%); }
.login-card { width: 100%; max-width: 440px; background: #ffffff; border-radius: var(--radius-lg); padding: 2.25rem; box-shadow: var(--shadow-lg); }
.login-header { text-align: center; margin-bottom: 1.75rem; }
.login-header h2 { font-size: 1.65rem; font-weight: 800; color: var(--brand-primary); }

.quote-modal-overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.65); backdrop-filter: blur(4px); z-index: 9999; align-items: center; justify-content: center; padding: 1.25rem; }
.quote-modal-card { width: 100%; max-height: 92vh; overflow-y: auto; margin-bottom: 0; }

@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; height: auto; }
  .app-container { flex-direction: column; }
  .main-wrapper { margin-left: 0; }
  .content-area { padding: 1.15rem; }
  .proposal-sheet { padding: 1.5rem; }
  .proposal-bottom-grid { grid-template-columns: 1fr; }
}

@media print {
  .no-print { display: none !important; }
  body, .public-quote-body { background: #ffffff !important; }
  .public-quote-wrapper { max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
  .proposal-sheet { box-shadow: none !important; border-radius: 0 !important; padding: 0.5cm !important; }
}
