/* ============================================
   FIFO Stock Valuation — Professional Stylesheet
   ============================================ */

/* ---------- CSS Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Primary palette */
  --bg-body:        rgb(235, 245, 251);   /* soft sky blue */
  --bg-header:      rgb(15, 52, 96);      /* deep navy */
  --bg-card:        rgb(255, 255, 255);
  --bg-nav:         rgb(240, 248, 255);
  --bg-footer:      rgb(15, 52, 96);

  /* Accent colours */
  --saffron:        rgb(255, 153, 51);
  --saffron-light:  rgb(255, 200, 120);
  --green:          rgb(34, 139, 34);
  --green-light:    rgb(200, 240, 200);
  --red:            rgb(200, 50, 50);
  --red-light:      rgb(255, 220, 220);
  --violet:         rgb(106, 61, 154);
  --violet-light:   rgb(230, 220, 250);
  --light-blue:     rgb(70, 160, 220);
  --light-blue-bg:  rgb(224, 242, 254);

  /* Borders */
  --border-saffron: rgb(255, 153, 51);
  --border-green:   rgb(34, 139, 34);
  --border-violet:  rgb(106, 61, 154);
  --border-blue:    rgb(70, 160, 220);
  --border-red:     rgb(200, 50, 50);

  /* Text */
  --text-dark:      rgb(30, 30, 50);
  --text-white:     rgb(255, 255, 255);
  --text-muted:     rgb(100, 100, 120);

  /* Misc */
  --shadow:         0 4px 20px rgba(0, 0, 0, 0.08);
  --radius:         10px;
  --transition:     0.25s ease;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-body);
  color: var(--text-dark);
  line-height: 1.65;
  min-height: 100vh;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5 {
  font-weight: 800;
  letter-spacing: 0.3px;
}

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, var(--bg-header) 0%, rgb(25, 72, 130) 50%, var(--violet) 100%);
  color: var(--text-white);
  padding: 32px 24px 28px;
  text-align: center;
  border-bottom: 5px solid var(--saffron);
  position: relative;
}

.site-header h1 {
  font-size: 2rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 2px 2px 6px rgba(0,0,0,0.35);
}

.site-header .subtitle {
  font-size: 1.05rem;
  margin-top: 8px;
  font-weight: 600;
  color: var(--saffron-light);
}

/* ---------- Quick-Nav Buttons ---------- */
.quick-nav {
  background: var(--bg-nav);
  border: 2px solid var(--border-blue);
  border-radius: var(--radius);
  margin: 24px auto;
  max-width: 1280px;
  padding: 18px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow);
}

.quick-nav .nav-label {
  font-weight: 800;
  font-size: 1rem;
  color: var(--bg-header);
  margin-right: 6px;
  white-space: nowrap;
}

.quick-nav a.nav-btn {
  display: inline-block;
  padding: 9px 20px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--text-white);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  cursor: pointer;
  border: none;
  text-align: center;
}

.quick-nav a.nav-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}

.nav-btn.btn-saffron  { background: var(--saffron); }
.nav-btn.btn-green    { background: var(--green);   }
.nav-btn.btn-violet   { background: var(--violet);  }
.nav-btn.btn-blue     { background: var(--light-blue); }
.nav-btn.btn-red      { background: var(--red);     }

.nav-btn.btn-saffron:hover  { background: rgb(230, 130, 30);  }
.nav-btn.btn-green:hover    { background: rgb(28, 115, 28);   }
.nav-btn.btn-violet:hover   { background: rgb(86, 45, 134);   }
.nav-btn.btn-blue:hover     { background: rgb(50, 130, 200);  }
.nav-btn.btn-red:hover      { background: rgb(170, 35, 35);   }

/* ---------- Main Container ---------- */
.main-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* ---------- Section Cards ---------- */
.section-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 30px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.06);
}

.section-card .card-header {
  padding: 16px 24px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-white);
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header .icon { font-size: 1.3rem; }

.card-header.hdr-saffron  { background: linear-gradient(90deg, var(--saffron), rgb(240, 170, 70)); border-left: 6px solid rgb(200, 115, 10); }
.card-header.hdr-green    { background: linear-gradient(90deg, var(--green), rgb(60, 170, 60));    border-left: 6px solid rgb(20, 100, 20);  }
.card-header.hdr-violet   { background: linear-gradient(90deg, var(--violet), rgb(140, 90, 190));  border-left: 6px solid rgb(75, 40, 120);  }
.card-header.hdr-blue     { background: linear-gradient(90deg, var(--light-blue), rgb(110, 185, 240)); border-left: 6px solid rgb(40, 120, 180); }
.card-header.hdr-red      { background: linear-gradient(90deg, var(--red), rgb(230, 85, 85));      border-left: 6px solid rgb(150, 30, 30);  }

.card-body {
  padding: 24px;
}

/* ---------- Product Title Badge ---------- */
.product-badge {
  display: inline-block;
  padding: 8px 22px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 18px;
  color: var(--text-white);
  background: var(--bg-header);
  border-left: 5px solid var(--saffron);
}

/* ---------- Tables ---------- */
.tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  font-size: 0.92rem;
}

table.data-table thead th {
  font-weight: 800;
  text-align: center;
  padding: 12px 10px;
  color: var(--text-white);
  border: 1px solid rgba(255,255,255,0.25);
  white-space: nowrap;
}

table.data-table thead tr:first-child th {
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Colour-coded column groups in header */
.col-particulars { background: var(--bg-header); }
.col-receipt     { background: var(--green);      }
.col-issue       { background: var(--red);        }
.col-closing     { background: var(--violet);     }

table.data-table tbody td {
  padding: 11px 12px;
  text-align: right;
  font-weight: 700;
  border: 1px solid rgb(210, 215, 225);
  color: var(--text-dark);
}

table.data-table tbody td:first-child {
  text-align: left;
  font-weight: 800;
  color: var(--bg-header);
  background: rgb(248, 250, 255);
}

table.data-table tbody tr:nth-child(even) td {
  background: rgb(245, 248, 255);
}

table.data-table tbody tr:nth-child(even) td:first-child {
  background: rgb(240, 244, 255);
}

table.data-table tbody tr.total-row td {
  background: var(--saffron-light) !important;
  font-weight: 900;
  font-size: 0.95rem;
  border-top: 3px solid var(--saffron);
  border-bottom: 3px solid var(--saffron);
  color: var(--bg-header);
}

/* ---------- FIFO Working Detail Table ---------- */
table.fifo-detail {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.fifo-detail th {
  background: var(--light-blue);
  color: var(--text-white);
  font-weight: 800;
  padding: 10px 12px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.25);
}

table.fifo-detail td {
  padding: 10px 12px;
  font-weight: 700;
  border: 1px solid rgb(210,215,225);
  text-align: right;
}

table.fifo-detail td:first-child {
  text-align: left;
  font-weight: 800;
  color: var(--bg-header);
}

table.fifo-detail tbody tr:nth-child(even) td {
  background: var(--light-blue-bg);
}

table.fifo-detail tfoot td {
  background: var(--green-light) !important;
  font-weight: 900;
  border-top: 3px solid var(--green);
}

/* ---------- Notes / Exceptions List ---------- */
.notes-list {
  list-style: none;
  padding: 0;
}

.notes-list li {
  padding: 12px 16px;
  margin-bottom: 10px;
  border-radius: 6px;
  font-weight: 700;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.55;
}

.notes-list li .bullet {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.8rem;
  color: var(--text-white);
}

.note-warning  { background: rgb(255, 248, 230); border-left: 5px solid var(--saffron); }
.note-warning .bullet { background: var(--saffron); }

.note-info     { background: var(--light-blue-bg); border-left: 5px solid var(--light-blue); }
.note-info .bullet { background: var(--light-blue); }

.note-flag     { background: var(--red-light); border-left: 5px solid var(--red); }
.note-flag .bullet { background: var(--red); }

/* ---------- Assumptions ---------- */
.assumptions-box {
  background: var(--violet-light);
  border: 2px solid var(--violet);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-top: 6px;
}

.assumptions-box h4 {
  color: var(--violet);
  margin-bottom: 10px;
  font-size: 1rem;
}

.assumptions-box ul {
  padding-left: 22px;
}

.assumptions-box li {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-dark);
}

/* ---------- Print / Export Toolbar ---------- */
.export-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
  justify-content: flex-end;
}

.export-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border: 2px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  color: var(--text-white);
}

.export-toolbar button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.16);
}

.btn-export-excel { background: var(--green); border-color: rgb(20,100,20); }
.btn-export-excel:hover { background: rgb(28,115,28); }

.btn-export-pdf { background: var(--red); border-color: rgb(150,30,30); }
.btn-export-pdf:hover { background: rgb(170,35,35); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-footer);
  color: var(--text-white);
  text-align: center;
  padding: 22px 20px;
  font-weight: 700;
  font-size: 0.88rem;
  border-top: 4px solid var(--saffron);
  letter-spacing: 0.3px;
}

.site-footer .disclaimer {
  color: var(--saffron-light);
  font-weight: 800;
  margin-top: 6px;
  font-size: 0.85rem;
}

/* ---------- Back-to-Top ---------- */
#backToTop {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--saffron);
  color: var(--text-white);
  border: none;
  font-size: 1.4rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  display: none;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform var(--transition);
  z-index: 999;
}

#backToTop:hover {
  background: rgb(230, 130, 30);
  transform: scale(1.1);
}

/* ---------- Print Styles ---------- */
@media print {
  body { background: #fff; }
  .quick-nav, .export-toolbar, #backToTop, .site-footer { display: none !important; }
  .section-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
  .site-header { background: var(--bg-header) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.data-table thead th, table.fifo-detail th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .site-header h1 { font-size: 1.35rem; }
  .quick-nav { flex-direction: column; align-items: stretch; }
  .quick-nav a.nav-btn { text-align: center; }
  .export-toolbar { justify-content: center; }
  .card-body { padding: 16px; }
}