/* ==========================================================================
   Responsive Business Proposal UI
   Rai Creo White Theme (Outfit Font & #0f1115 Text Color)
   ========================================================================== */

:root {
  --font-primary: 'Outfit', sans-serif;
  --font-handwritten: 'Caveat', cursive;

  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  
  /* Text color updated as requested */
  --text-dark: #0f1115;
  --text-body: #0f1115;
  --text-muted: #475569;
  
  --border-color: #e2e8f0;
  --border-dark: #cbd5e1;
  
  --btn-dark: #0f1115;
  --btn-dark-hover: #1e2430;
  
  --radius: 8px;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.6;
  padding-bottom: 4rem;
  -webkit-font-smoothing: antialiased;
}

.proposal-wrapper {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Header Bar */
.proposal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--border-color);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.brand-logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-primary);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

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

.btn-outline {
  background-color: #ffffff;
  color: var(--text-dark);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background-color: #f1f5f9;
  border-color: var(--border-dark);
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn-text-sm {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.btn-text-sm:hover {
  color: #dc2626;
}

/* Main Grid Layout */
.proposal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 2rem;
  align-items: start;
}

/* Main Proposal Paper */
.proposal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 3rem 3.5rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.doc-main-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 2.25rem;
  letter-spacing: -0.02em;
}

/* Document Sections */
.proposal-section {
  margin-bottom: 2.25rem;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.proposal-section p {
  color: var(--text-body);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.sub-heading {
  font-weight: 700;
  color: var(--text-dark) !important;
  margin-bottom: 0.4rem;
}

.bullet-list {
  list-style-type: disc;
  padding-left: 1.25rem;
  color: var(--text-body);
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.item-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.item-stack p {
  margin-bottom: 0;
}

.timeline-phase {
  margin-bottom: 1.15rem;
}

.phase-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 0.35rem;
}

.scope-box {
  background-color: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}

.scope-box p {
  margin: 0;
}

/* Proposal Tables */
.proposal-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  background-color: #ffffff;
  border: 1px solid var(--border-color);
}

.proposal-table th, .proposal-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.proposal-table th {
  background-color: #f1f5f9;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--text-dark);
}

.proposal-table tfoot td {
  background-color: #f1f5f9;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-dark);
}

.text-right {
  text-align: right !important;
}

.amc-tier {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  background-color: #fafafa;
}

.amc-heading {
  font-weight: 700;
  color: var(--text-dark) !important;
  margin-bottom: 0.4rem;
}

/* Signature Grid */
.signature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.signature-card {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.15rem;
}

.sig-party {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
}

.sig-display {
  height: 90px;
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  background-color: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.sig-handwritten {
  font-family: var(--font-handwritten);
  font-size: 2.3rem;
  color: #0f1115;
}

.sig-meta p {
  font-size: 0.85rem;
  margin-bottom: 0.15rem;
}

/* Signature Inputs */
.sig-tab-bar {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.sig-tab {
  flex: 1;
  padding: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: #ffffff;
  color: var(--text-muted);
  cursor: pointer;
}

.sig-tab.active {
  background-color: var(--btn-dark);
  color: #ffffff;
  border-color: var(--btn-dark);
}

.canvas-wrapper {
  position: relative;
  border: 1px dashed var(--border-color);
  border-radius: 4px;
  background-color: #fafafa;
}

#signature-canvas {
  width: 100%;
  height: 90px;
  display: block;
  cursor: crosshair;
}

#clear-canvas-btn {
  position: absolute;
  top: 4px;
  right: 4px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dark);
}

.form-control {
  font-family: var(--font-primary);
  font-size: 0.88rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  outline: none;
}

.form-control:focus {
  border-color: var(--btn-dark);
}

.signed-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background-color: #ecfdf5;
  border: 1px solid #059669;
  color: #065f46;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  margin-top: 0.85rem;
}

.signed-banner i {
  font-size: 1.4rem;
  color: #059669;
}

.signed-banner h4 {
  font-size: 0.95rem;
  color: #065f46;
}

.signed-banner p {
  margin: 0;
  font-size: 0.82rem;
  color: #047857;
}

.hidden {
  display: none !important;
}

.footer-summary-section {
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--text-dark);
}

.mt-1 { margin-top: 0.35rem; }
.mt-2 { margin-top: 0.75rem; }

/* Right Sidebar Metadata Box */
.proposal-sidebar {
  position: sticky;
  top: 2rem;
}

.info-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.info-line {
  display: flex;
  flex-direction: column;
}

.lbl {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
}

.total-line {
  margin-top: 0.35rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-color);
}

.total-val {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-dark);
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 1000;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background-color: var(--text-dark);
  color: #ffffff;
  padding: 0.75rem 1.15rem;
  border-radius: 6px;
  font-size: 0.88rem;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

/* Responsive Breakdown */
@media (max-width: 860px) {
  .proposal-layout {
    grid-template-columns: 1fr;
  }
  
  .proposal-sidebar {
    position: static;
    order: -1;
  }
  
  .proposal-card {
    padding: 1.75rem;
  }
}

@media (max-width: 580px) {
  .proposal-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .header-actions {
    width: 100%;
  }
  
  .header-actions button {
    flex: 1;
  }

  .proposal-card {
    padding: 1.15rem;
  }

  .doc-main-title {
    font-size: 1.45rem;
  }
}

/* Print Rules */
@media print {
  body {
    background: white !important;
  }

  .header-actions, .sig-tab-bar, #clear-canvas-btn, #accept-sign-submit {
    display: none !important;
  }

  .proposal-wrapper {
    padding: 0;
    max-width: 100%;
  }

  .proposal-layout {
    grid-template-columns: 1fr;
  }

  .info-card {
    border: none;
    padding: 0;
  }

  .proposal-card {
    box-shadow: none;
    border: none;
    padding: 0;
  }
}
