/* =========================
   ROOT & RESET
========================= */
:root{
  --gold:#ff9f1c;
  --dark:#0b0b0b;
  --dark2:#111;
  --border:rgba(255,255,255,.08);
}

*{
  margin:0;
  padding:0;
  box-sizing:border-box;
  font-family:Inter,sans-serif;
}

body{
  background:#050505;
  color:#fff;
  min-height:100vh;
  display:flex;
  overflow-x:hidden;
}

/* =========================
   BACKGROUND DOTS (FIXED)
========================= */
.bg-pattern{
  position:fixed;
  inset:0;
  background:
    radial-gradient(rgba(255,159,28,.18) 1px, transparent 1px);
  background-size:6px 6px;
  z-index:-1;              /* 🔥 MOST IMPORTANT */
  pointer-events:none;
}

/* =========================
   SIDEBAR
========================= */
.sidebar{
  width:250px;
  background:linear-gradient(180deg,#2a1408,#0c0603);
  padding:24px;
  display:flex;
  flex-direction:column;
  position:relative;
  z-index:3;
}

.logo{
  width:180px;
  margin-bottom:28px;
}

.sidebar nav a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 14px;
  margin-bottom:8px;
  color:#ccc;
  text-decoration:none;
  border-radius:12px;
  transition:.25s;
}

.sidebar nav a:hover,
.sidebar nav a.active{
  background:linear-gradient(135deg,#ff9f1c,#ff7a00);
  color:#000;
}

/* =========================
   MAIN AREA
========================= */
.main{
  flex:1;
  padding:26px;
  position:relative;
  z-index:2;
}

/* =========================
   GLASS BASE
========================= */
.glass{
  background:linear-gradient(180deg,#121212,#080808);
  border:1px solid var(--border);
  border-radius:20px;
}
.action-buttons {
    display: flex;
    gap: 8px;
}
.btn-icon {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    transition: 0.2s;
}
.btn-icon.edit { color: #2196F3; }
.btn-icon.delete { color: #f44336; }
.btn-icon:hover { transform: scale(1.2); }
/* =========================
   HEADER
========================= */
.header{
  padding:22px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:22px;
}

.header h1{
  font-size:26px;
  letter-spacing:1px;
}

.header p{
  font-size:11px;
  letter-spacing:2px;
  color:var(--gold);
}

.profile{
  display:flex;
  align-items:center;
  gap:12px;
}

.profile img{
  width:44px;
  height:44px;
  border-radius:14px;
  border:2px solid var(--gold);
}

.profile a{
  color:var(--gold);
  text-decoration:none;
  font-size:12px;
  font-weight:700;
}

.profile a:hover{
  text-decoration:underline;
}

.logout-btn{
  display:inline-block;
  margin-top:6px;
  padding:6px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  color:#1a100d !important;
  text-decoration:none !important;
  background:linear-gradient(135deg,#ff9f1c,#ff7a00);
  border:1px solid rgba(255,255,255,.2);
  box-shadow:0 6px 14px rgba(255,122,0,.25);
}

.logout-btn:hover{
  transform:translateY(-1px);
  box-shadow:0 10px 18px rgba(255,122,0,.35);
}

/* =========================
   ACTION BAR (FIXED LOOK)
========================= */
.action-bar{
  padding:16px;
  display:flex;
  gap:14px;
  margin-bottom:22px;
}

.action-bar input,
.action-bar select{
  flex:1;
  background:#0d0d0d;
  border:1px solid var(--border);
  color:#fff;
  padding:12px 14px;
  border-radius:14px;
}

.btn-primary{
  background:linear-gradient(135deg,#ff9f1c,#ff7a00);
  color:#000;
  border:none;
  padding:12px 22px;
  border-radius:16px;
  font-weight:700;
  cursor:pointer;
}

/* =========================
   TABLE CARD (CLEAN)
========================= */
.table-card{
  padding:18px;
  background:linear-gradient(180deg,#101010,#070707);
}

table{
  width:100%;
  border-collapse:collapse;
}

th{
  text-align:left;
  font-size:12px;
  color:#ffcc80;
  padding:14px;
}

td{
  padding:14px;
  font-size:13px;
  border-top:1px solid var(--border);
  color:#ddd;
}

tbody tr:hover{
  background:rgba(255,255,255,.04);
}

/* =========================
   EMPTY STATE
========================= */
tbody td[colspan]{
  text-align:center;
  opacity:.6;
}

/* =========================
   PROJECT MODAL
========================= */
.project-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.75);
  display:none;
  justify-content:center;
  align-items:center;
  z-index:9999;
}

.project-modal.active{
  display:flex;
}

.project-box{
  width:94%;
  max-width:1100px;
  max-height:92vh;
  background:#fff;
  border-radius:22px;
  overflow-y:auto;
}

/* =========================
   MODAL TITLE BAR
========================= */
.project-title-bar{
  background:linear-gradient(135deg,#ff9f1c,#ff7a00);
  padding:20px 26px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  color:#000;
}

.project-title-bar h2{
  font-size:22px;
  font-weight:800;
}

.project-title-bar p{
  font-size:12px;
  letter-spacing:1px;
  opacity:.85;
}

.project-title-bar button{
  background:#000;
  color:#fff;
  border:none;
  width:36px;
  height:36px;
  border-radius:12px;
  font-size:20px;
  cursor:pointer;
}

/* =========================
   FORM BODY
========================= */
#projectForm{
  padding:26px;
}

/* =========================
   SECTIONS
========================= */
.section{
  background:#f9f9f9;
  border:1px solid #eee;
  border-radius:18px;
  padding:22px;
  margin-bottom:20px;
}

.section h4{
  font-size:13px;
  font-weight:700;
  color:#ff7a00;
  margin-bottom:14px;
  text-transform:uppercase;
}

/* =========================
   INPUTS
========================= */
input,select,textarea{
  width:100%;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid #dcdcdc;
  font-size:14px;
  margin-bottom: 10px;
}

input:focus,
select:focus,
textarea:focus{
  outline:none;
  border-color:#ff9f1c;
  box-shadow:0 0 0 3px rgba(255,159,28,.15);
}

textarea{
  resize:none;
  min-height:90px;
}

/* =========================
   GRIDS
========================= */
.grid4{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
}

.grid3{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:14px;
}

/* =========================
   TABLE INSIDE MODAL
========================= */
.section table{
  width:100%;
  border-collapse:collapse;
}

.section th{
  font-size:12px;
  color:#ff9f1c;
  padding-bottom:8px;
}

.section td{
  padding:6px;
}

/* =========================
   FORM ACTIONS
========================= */
.actions{
  display:flex;
  justify-content:flex-end;
  gap:14px;
  margin-top:22px;
}

.actions .save{
  background:linear-gradient(135deg,#ff9f1c,#ff7a00);
  border:none;
  padding:12px 26px;
  border-radius:16px;
  font-weight:800;
  cursor:pointer;
}

.actions .cancel{
  background:#e0e0e0;
  border:none;
  padding:12px 26px;
  border-radius:16px;
  cursor:pointer;
}

/* =========================
   RESPONSIVE
========================= */
@media(max-width:900px){
  .grid4{grid-template-columns:1fr 1fr}
  .grid3{grid-template-columns:1fr}
  .sidebar{display:none}
  body{flex-direction:column}
}

@media(max-width:500px){
  .grid4{grid-template-columns:1fr}
}
/* =========================
   MODAL HARD FIX
========================= */
.project-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.75);
  display:none;
  justify-content:center;
  align-items:center;
  z-index:9999;
}

.project-modal.active{
  display:flex;
}

.project-box{
  width:94%;
  max-width:1100px;
  max-height:92vh;
  background:#ffffff;
  border-radius:22px;
  overflow-y:auto;
  box-shadow:0 40px 120px rgba(0,0,0,.6);
}
.project-modal{
  display:none;
}

.project-modal.active{
  display:flex;
}

.field {
  display: flex;
  flex-direction: column;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: #ff7a00;
  margin-bottom: 6px;
}

.action-btns button{
  background:none;
  border:none;
  color:#ff9f1c;
  margin:0 6px;
  cursor:pointer;
  font-size:14px;
}
.action-btns button.delete{color:#ff4d4d}
.action-btns button.edit{color:#4dabf7}
.action-btns button.view{color:#51cf66}
/* =========================
   MOBILE RESPONSIVE FIX
   (NO STRUCTURE CHANGES)
========================= */

/* ---------- Tablets & Below ---------- */
@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
  }

  .main {
    padding: 18px;
  }

  .header h1 {
    font-size: 22px;
  }
}

/* ---------- Mobile Devices ---------- */
@media (max-width: 768px) {

  body {
    flex-direction: column;
  }

  /* Hide Sidebar on Mobile */
  .sidebar {
    display: none;
  }

  .main {
    padding: 14px;
  }

  /* Header stack */
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .profile {
    align-self: flex-end;
  }

  /* Action bar wrap */
  .action-bar {
    flex-direction: column;
    gap: 10px;
  }

  .action-bar input,
  .action-bar select,
  .action-bar button {
    width: 100%;
  }

  /* Table horizontal scroll */
  .table-card {
    overflow-x: auto;
  }

  table {
    min-width: 750px;
  }

  /* Modal sizing */
  .project-box {
    width: 96%;
    max-height: 90vh;
    border-radius: 18px;
  }

  .project-title-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .project-title-bar button {
    align-self: flex-end;
  }

  /* Form spacing */
  #projectForm {
    padding: 16px;
  }

  /* Grid fixes */
  .grid4 {
    grid-template-columns: 1fr 1fr;
  }

  .grid3 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Small Mobile ---------- */
@media (max-width: 480px) {

  .header h1 {
    font-size: 18px;
  }

  .header p {
    font-size: 10px;
  }

  .grid4 {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }

  .actions button {
    width: 100%;
  }

  /* BOQ table scroll */
  .section table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .btn-primary {
    padding: 12px;
    font-size: 14px;
  }
}
/* =========================
   BOQ MOBILE HARD FIX
========================= */
@media (max-width: 768px) {

  /* BOQ section wrapper */
  .section table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* Force horizontal scrolling */
  .section table thead,
  .section table tbody,
  .section table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
  }

  /* Minimum width so inputs don't collapse */
  .section table {
    min-width: 720px;
  }

  /* Inputs look clean on mobile */
  .section table input,
  .section table select {
    min-width: 110px;
    font-size: 13px;
    padding: 10px;
  }

  /* Remove button spacing */
  .section table button {
    min-width: 36px;
    height: 36px;
  }
}

/* =========================
   SMALL MOBILE EXTRA FIX
========================= */
@media (max-width: 480px) {

  .section table {
    min-width: 680px;
  }

.section h4 {
  font-size: 12px;
}
}

/* =========================
   MODAL UI POLISH
========================= */
.modal-box{
  width:min(1180px,96vw);
}

.project-box{
  border:1px solid #ffd9ad;
}

#projectForm{
  padding:24px;
  display:flex;
  flex-direction:column;
  gap:0;
}

#projectForm .section{
  background:linear-gradient(180deg,#fff,#fcfcfc);
  border:1px solid #ececec;
  border-radius:16px;
  padding:20px;
  margin-bottom:16px;
}

#projectForm input,
#projectForm select,
#projectForm textarea{
  margin-bottom:0;
  height:46px;
  border-radius:14px;
  border:1px solid #d7d7d7;
  background:#fff;
  font-size:15px;
}

#projectForm textarea{
  min-height:96px;
  height:auto;
  padding-top:12px;
}

.field{
  gap:8px;
}

#clientSelect{
  margin-bottom:12px !important;
}

.boq-table-wrap{
  width:100%;
  overflow-x:auto;
  border:1px solid #eee;
  border-radius:14px;
  background:#fff;
}

#boqTable{
  min-width:980px;
  border-collapse:separate;
  border-spacing:0;
}

#boqTable thead th{
  position:sticky;
  top:0;
  background:#fff8f0;
  color:#cc6d00;
  font-weight:700;
  font-size:12px;
  border-bottom:1px solid #f3dcc2;
  padding:10px 12px;
}

#boqTable tbody td{
  padding:8px 10px;
  border-top:1px solid #f4f4f4;
  vertical-align:middle;
}

#boqTable tbody td input,
#boqTable tbody td select{
  height:42px;
  font-size:14px;
}

#boqTable .removeRow{
  width:34px;
  height:34px;
  border-radius:10px;
  border:1px solid #ffd3d3;
  background:#fff6f6;
  color:#b42318;
  font-weight:700;
  cursor:pointer;
}

.boq-add-btn{
  margin-top:10px;
  border:none;
  border-radius:10px;
  padding:9px 14px;
  background:linear-gradient(135deg,#ffb24e,#ff8d08);
  color:#201206;
  font-weight:700;
  cursor:pointer;
}

.actions .save{
  min-width:180px;
}

/* =========================
   RESPONSIVE FORM TUNING
========================= */
@media (max-width: 992px){
  #projectForm{
    padding:16px;
  }

  #projectForm .section{
    padding:14px;
  }

  .grid4{
    grid-template-columns:1fr 1fr;
  }
}

@media (max-width: 640px){
  .project-box{
    width:98%;
    max-height:94vh;
    border-radius:14px;
  }

  .project-title-bar{
    padding:14px 16px;
  }

  #projectForm input,
  #projectForm select,
  #projectForm textarea{
    font-size:14px;
  }

  .grid4{
    grid-template-columns:1fr;
  }

  #boqTable{
    min-width:860px;
  }
}

/* =========================
   FULL FORM UX POLISH
========================= */
.project-title-bar{
  background:linear-gradient(135deg,#ffb44f 0%, #ff8a00 60%, #f26a00 100%);
}

.project-title-bar h2{
  letter-spacing:.3px;
}

#projectForm .section h4{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:14px;
  color:#cf6b00;
  margin-bottom:14px;
}

#projectForm .section h4::before{
  content:"";
  width:4px;
  height:14px;
  border-radius:999px;
  background:linear-gradient(180deg,#ffb24d,#ff8500);
}

.grid-basic{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:14px;
}

#projectForm .field label{
  font-size:12px;
  font-weight:700;
  color:#9a5a08;
  letter-spacing:.02em;
}

#projectForm input[readonly],
#projectForm textarea[readonly]{
  background:#f7f7f8;
  color:#525b67;
}

#projectForm input::placeholder,
#projectForm textarea::placeholder{
  color:#8a94a4;
}

#projectForm .actions{
  margin-top:8px;
}

#projectForm .actions .save{
  min-width:210px;
  min-height:48px;
  border-radius:14px;
  font-size:15px;
  letter-spacing:.2px;
  box-shadow:0 10px 24px rgba(255,137,0,.25);
}

#projectForm .actions .save:hover{
  transform:translateY(-1px);
  box-shadow:0 16px 28px rgba(255,137,0,.32);
}

#boqTable td:last-child{
  text-align:center;
}

#boqTable .qty,
#boqTable .rate,
#boqTable .total{
  text-align:right;
}

@media (max-width: 1200px){
  .grid-basic{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
}

@media (max-width: 900px){
  .grid-basic{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width: 640px){
  .grid-basic{
    grid-template-columns:1fr;
  }

  #projectForm .actions{
    justify-content:stretch;
  }

  #projectForm .actions .save{
    width:100%;
    min-width:0;
  }
}

/* Final device QA overrides */
@media (max-width: 768px){
  .table-card{
    overflow-x:auto;
  }

  .table-card table{
    min-width:760px;
  }
}

@media (max-width: 390px){
  .main{
    padding:12px;
  }

  .header{
    padding:14px;
    border-radius:16px;
  }

  .action-bar{
    padding:12px;
  }

  .action-bar input,
  .action-bar select,
  .action-bar .btn-primary{
    width:100%;
  }

  #projectForm{
    padding:12px;
  }

  #projectForm .section{
    padding:12px;
    border-radius:14px;
  }
}

