/* ============================================================
   WOODCITY GROUP — PRICING PORTAL
   style.css
   ============================================================ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --navy:    #1C3557;
  --steel:   #2D6A9F;
  --lblue:   #D6E4F0;
  --teal:    #00695C;
  --teal-l:  #E0F2F1;
  --teal-m:  #80CBC4;
  --green:   #1B5E20;
  --green-l: #C8E6C9;
  --amber:   #6D4C00;
  --amber-l: #FFF8E1;
  --amber-m: #FFD54F;
  --red:     #B71C1C;
  --red-l:   #FFCDD2;
  --grey:    #F4F6F9;
  --grey-2:  #E8ECF1;
  --border:  #C0CAD4;
  --text:    #1A1A2E;
  --muted:   #5A6A7A;
  --white:   #FFFFFF;
  --shadow:  0 2px 8px rgba(0,0,0,0.10);
  --radius:  6px;
  --font:    'Segoe UI', Arial, sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--text);
       background: var(--grey); min-height: 100vh; display: flex; flex-direction: column; }
a    { color: var(--steel); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  background: var(--navy);
  color: var(--white);
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 56px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo   { height: 38px; width: auto; border-radius: 4px; object-fit: contain; }
.nav-title  { font-size: 16px; font-weight: 700; color: var(--white); }
.nav-sub    { font-size: 11px; color: #90aec6; margin-left: 4px; }
.nav-links  { display: flex; gap: 4px; list-style: none; margin-left: 8px; }
.nav-links a {
  color: #b0c8e0;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  transition: background 0.15s;
}
.nav-links a:hover, .nav-links a.active {
  background: rgba(255,255,255,0.15);
  color: var(--white);
  text-decoration: none;
}
.nav-sync { margin-left: auto; }

/* ── Content ────────────────────────────────────────────────── */
.content-wrapper { flex: 1; padding: 28px 32px; max-width: 1600px; width: 100%; margin: 0 auto; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert { padding: 12px 18px; border-radius: var(--radius); margin-bottom: 16px; font-weight: 500; }
.alert-success { background: var(--green-l); color: var(--green); border-left: 4px solid var(--green); }
.alert-error   { background: var(--red-l);   color: var(--red);   border-left: 4px solid var(--red); }
.alert-info    { background: var(--lblue);   color: var(--steel); border-left: 4px solid var(--steel); }

/* ── Page header ────────────────────────────────────────────── */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; color: var(--navy); font-weight: 700; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.back-link { font-size: 12px; color: var(--muted); display: block; margin-bottom: 6px; }
.section-header {
  font-size: 13px; font-weight: 700; color: var(--navy);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin: 28px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--lblue);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 2px solid transparent; transition: all 0.15s;
  text-decoration: none;
}
.btn-navy    { background: var(--navy);  color: var(--white); }
.btn-navy:hover { background: var(--steel); text-decoration: none; }
.btn-teal    { background: var(--teal);  color: var(--white); }
.btn-teal:hover { background: #004D40; text-decoration: none; }
.btn-outline { background: var(--white); color: var(--navy); border-color: var(--navy); }
.btn-outline:hover { background: var(--grey); text-decoration: none; }
.btn-outline-white { background: transparent; color: var(--white); border-color: rgba(255,255,255,0.5); }
.btn-outline-white:hover { background: rgba(255,255,255,0.15); text-decoration: none; }
.btn-sm  { padding: 5px 12px; font-size: 12px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; }
.btn-xs  { padding: 3px 8px; font-size: 11px; }
.action-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

/* ── Dashboard cards ────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.card {
  background: var(--white); border-radius: var(--radius);
  padding: 20px 16px; text-align: center; box-shadow: var(--shadow);
  border-top: 4px solid var(--border);
}
.card-value { font-size: 36px; font-weight: 800; line-height: 1; }
.card-label { font-size: 11px; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.card-navy    { border-top-color: var(--navy);  } .card-navy    .card-value { color: var(--navy); }
.card-green   { border-top-color: var(--green); } .card-green   .card-value { color: var(--green); }
.card-green-light { border-top-color: #4CAF50; } .card-green-light .card-value { color: #2E7D32; }
.card-red     { border-top-color: var(--red);   } .card-red     .card-value { color: var(--red); }
.card-teal    { border-top-color: var(--teal);  } .card-teal    .card-value { color: var(--teal); }
.card-amber   { border-top-color: #E65100; } .card-amber   .card-value { color: #E65100; }
.card-blue    { border-top-color: var(--steel); } .card-blue    .card-value { color: var(--steel); }

/* ── Group grid (dashboard) ─────────────────────────────────── */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 28px; }
.group-card {
  background: var(--white); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  border-left: 4px solid var(--steel);
  text-decoration: none; color: var(--text);
  transition: transform 0.1s, box-shadow 0.1s;
}
.group-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); text-decoration: none; }
.group-name  { font-size: 13px; font-weight: 600; color: var(--navy); }
.group-count { font-size: 28px; font-weight: 800; color: var(--steel); margin: 4px 0; }
.group-link  { font-size: 11px; color: var(--muted); }

/* ── Filter bar ─────────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--white); padding: 14px 16px; border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.filter-search {
  flex: 1; min-width: 220px; padding: 7px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 13px; outline: none;
}
.filter-search:focus { border-color: var(--steel); }
.filter-select {
  padding: 7px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: 13px; background: var(--white); outline: none;
}
.filter-count { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ── Legend ─────────────────────────────────────────────────── */
.legend { display: flex; gap: 20px; font-size: 12px; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.dot-pgb   { background: var(--amber-l); border: 1px solid var(--amber); }
.dot-son   { background: var(--green-l); border: 1px solid var(--green); }
.dot-cl    { background: var(--red-l);   border: 1px solid var(--red); }
.dot-price { background: var(--teal-l);  border: 1px solid var(--teal); }

/* ── Price table ────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
.price-table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 12.5px; }
.price-table thead th {
  background: var(--navy); color: var(--white);
  padding: 10px 10px; text-align: left; font-size: 11.5px;
  font-weight: 600; white-space: nowrap; position: sticky; top: 0; z-index: 5;
}
.price-table thead th.col-price { background: var(--teal); text-align: right; }
.group-header-row td {
  background: var(--steel); color: var(--white);
  padding: 6px 10px; font-weight: 700; font-size: 12px; letter-spacing: 0.3px;
}
.price-table tbody tr:hover { background: var(--lblue) !important; }
.price-table td { padding: 7px 10px; border-bottom: 1px solid var(--grey-2); vertical-align: middle; }
.row-clearance td { background: #FFF5F5 !important; }
.row-sonae  td { background: #FAFFFE !important; }

.col-code  { width: 180px; }
.col-sup   { width: 90px; text-align: center; }
.col-desc  { max-width: 300px; }
.col-grp   { width: 130px; }
.col-prod  { width: 150px; }
.col-price { width: 120px; text-align: right; }
.col-action{ width: 70px; text-align: center; }

.code-link { font-family: 'Courier New', monospace; font-size: 11.5px; color: var(--steel); }
.code-link:hover { color: var(--navy); }
.text-red  { color: var(--red); }
.cl-badge  { background: var(--red); color: var(--white); font-size: 9px; font-weight: 700;
             padding: 1px 5px; border-radius: 3px; margin-left: 6px; text-transform: uppercase; }

/* ── Supplier badges ────────────────────────────────────────── */
.sup-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 700;
}
.sup-pgb  { background: var(--amber-l); color: var(--amber); }
.sup-son  { background: var(--green-l); color: var(--green); }
.sup-cl   { background: var(--red-l);   color: var(--red); }

/* ── Price cells (inline editing) ───────────────────────────── */
.price-cell {
  cursor: pointer; text-align: right;
  background: var(--teal-l);
  font-weight: 600; color: var(--teal);
  transition: background 0.1s;
  position: relative;
}
.price-cell:hover { background: var(--teal-m) !important; }
.price-cell.editing { background: #FFF9C4 !important; outline: 2px solid #F9A825; }
.price-cell.saving  { opacity: 0.6; }
.price-cell.saved   { background: var(--green-l) !important; }
.price-cell.error   { background: var(--red-l)   !important; }
.price-cl { background: #FFE8E8 !important; color: var(--red) !important; }
.no-price  { color: var(--border); font-style: italic; font-weight: 400; }
.inline-input {
  border: 2px solid #F9A825; border-radius: 3px;
  padding: 4px 8px; font-size: 13px;
  font-family: var(--font); z-index: 200; background: #FFFDE7;
}

/* ── Detail page ────────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-card {
  background: var(--white); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.detail-card-title { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 14px; }
.unit { font-weight: 400; font-size: 12px; color: var(--muted); }
.detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.detail-table th { color: var(--muted); font-weight: 500; padding: 7px 10px 7px 0; width: 140px; }
.detail-table td { padding: 7px 10px 7px 0; border-bottom: 1px solid var(--grey-2); }
.price-edit-table th { background: var(--grey); padding: 8px 10px; text-align: left; }
.price-edit-table td { padding: 8px 10px; border-bottom: 1px solid var(--grey-2); }
.current-price { color: var(--teal); font-weight: 600; }
.price-meta { display: block; font-size: 10px; color: var(--muted); font-weight: 400; }
.price-input {
  width: 150px; padding: 7px 10px; border: 1.5px solid var(--border);
  border-radius: var(--radius); font-size: 13px; outline: none;
}
.price-input:focus { border-color: var(--steel); }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.save-status { font-size: 13px; }
.save-status.success { color: var(--green); font-weight: 600; }
.save-status.error   { color: var(--red);   font-weight: 600; }
.save-status.saving  { color: var(--muted); }
.save-status.info    { color: var(--muted); }

/* ── Export page ────────────────────────────────────────────── */
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.import-path { background: var(--grey); padding: 10px 14px; border-radius: var(--radius);
               font-family: 'Courier New', monospace; font-size: 12px; color: var(--navy);
               margin: 12px 0; }
.export-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0; }
.export-note { background: var(--amber-l); border-left: 4px solid var(--amber-m);
               padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0;
               font-size: 12px; color: var(--amber); }
.changed-list { max-height: 400px; overflow-y: auto; }
.badge { background: var(--steel); color: var(--white); font-size: 11px; font-weight: 700;
         padding: 2px 8px; border-radius: 10px; margin-left: 8px; }
.instructions { background: var(--white); border-radius: var(--radius); padding: 20px;
                box-shadow: var(--shadow); }
.instructions ol { padding-left: 20px; }
.instructions li { margin-bottom: 8px; line-height: 1.5; }
.instructions ul { padding-left: 20px; margin-top: 6px; }
.instruction-note { background: var(--lblue); padding: 12px 16px; border-radius: var(--radius);
                    margin-top: 16px; font-size: 12.5px; color: var(--navy); }
code { background: var(--grey); padding: 2px 6px; border-radius: 3px; font-size: 12px; }

/* ── History table ──────────────────────────────────────────── */
.history-table { width: 100%; border-collapse: collapse; background: var(--white);
                 font-size: 12.5px; border-radius: var(--radius); box-shadow: var(--shadow); }
.history-table.full-width { border-radius: 0; }
.history-table thead th { background: var(--navy); color: var(--white); padding: 9px 12px; text-align: left; font-size: 11.5px; }
.history-table tbody td { padding: 7px 12px; border-bottom: 1px solid var(--grey-2); }
.history-table tbody tr:hover td { background: var(--lblue); }
.col-date { color: var(--muted); white-space: nowrap; font-size: 11.5px; }
.price-old { color: var(--muted); }
.price-new { color: var(--teal); font-weight: 600; }
.pagination-bar { display: flex; justify-content: space-between; align-items: center;
                  margin-bottom: 12px; }
.page-links { display: flex; align-items: center; gap: 10px; }
.page-info  { font-size: 12px; color: var(--muted); }

/* ── Misc ───────────────────────────────────────────────────── */
.empty-state { padding: 40px; text-align: center; color: var(--muted); font-style: italic; }
.full-width  { width: 100%; }

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  background: var(--navy); color: rgba(255,255,255,0.5);
  padding: 12px 32px; font-size: 11px;
  display: flex; gap: 24px; justify-content: space-between;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .detail-grid  { grid-template-columns: 1fr; }
  .export-grid  { grid-template-columns: 1fr; }
  .navbar       { padding: 0 12px; }
  .content-wrapper { padding: 16px; }
}

/* ── Login page ─────────────────────────────────────────────── */
body.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--grey);
}
.login-card {
  background: var(--white);
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(28,53,87,0.14);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
}
.login-header { text-align: center; margin-bottom: 1.75rem; }
.login-logo   { height: 72px; width: auto; object-fit: contain; margin-bottom: 0.5rem; }
.login-header h1 { font-size: 1.2rem; font-weight: 700; color: var(--navy);
                   margin: 0.4rem 0 0.2rem; }
.login-header p  { color: var(--muted); font-size: 0.875rem; }
.login-form label { display: block; font-size: 0.875rem; font-weight: 600;
                    color: var(--navy); margin: 1rem 0 0.3rem; }
.login-form input { width: 100%; padding: 0.55rem 0.75rem;
                    border: 1px solid var(--border); border-radius: var(--radius);
                    font-size: 0.95rem; }
.login-form input:focus { outline: none; border-color: var(--steel);
                          box-shadow: 0 0 0 3px rgba(45,106,159,0.15); }
.btn-block { display: block; width: 100%; margin-top: 1.5rem; padding: 0.65rem; }
.login-alert { width: 100%; max-width: 380px; margin-bottom: 1rem;
               padding: 0.65rem 1rem; border-radius: var(--radius);
               font-size: 0.875rem; }
.login-alert-error   { background: var(--red-l);   color: var(--red); }
.login-alert-success { background: var(--green-l); color: var(--green); }

/* ── Nav user / sign out ────────────────────────────────────── */
.nav-user { display: flex; align-items: center; gap: 0.75rem; margin-left: 8px; }
.nav-username { color: rgba(255,255,255,0.80); font-size: 0.85rem; white-space: nowrap; }
