/* Load robust fonts (place at top of file) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Manrope:wght@500;600;700&display=swap');

/* General styles */
.hidden {
  display: none !important;
}

  /* Basic styling for multi-select */
  #elements {
    width: 100%;
    padding: 8px;
    margin: 10px 0;
  }
  .calculate-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
  }
  
  #results {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f5f5f5;
    border-radius: 8px;
  }
  
  .result-item {
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }

  .error-message {
    color: #dc3545;
    font-size: 0.875em;
    display: none;
  }
  
  input.invalid {
    border-color: #dc3545;
  }

/* Modal styles for BOQ export */
.boq-modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.3);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.boq-modal[style*="display: flex"] {
  display: flex !important;
}
.boq-modal-content {
  background: #fff;
  padding: 2em;
  border-radius: 8px;
  min-width: 250px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.boq-modal-btn {
  margin: 0.5em;
  padding: 0.7em 1.5em;
  border: none;
  border-radius: 4px;
  background: #2196F3;
  color: #fff;
  cursor: pointer;
  font-size: 1em;
}
.boq-modal-btn.cancel {
  background: #aaa;
  color: #fff;
}

/* Project Details Modal Styles */
#project-details-modal {
  display: none;
  position: fixed;
  z-index: 1100;
  left: 0; top: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.35);
  align-items: center;
  justify-content: center;
}

#project-details-modal[style*="display: flex"] {
  display: flex !important;
}

/* Add this new rule */
#project-details-modal .modal-content {
  max-height: 85vh; /* Limit height to 85% of viewport */
  overflow-y: auto; /* Enable scrolling */
}

#project-details-modal .modal-content {
  background: #fff;
  padding: 2em 2.5em;
  border-radius: 10px;
  min-width: 320px;
  max-width: 95vw;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  text-align: left;
}

#project-details-modal h3 {
  margin-top: 0;
  margin-bottom: 1em;
  font-size: 1.3em;
  color: #2196F3;
}

#project-details-modal label {
  display: block;
  margin-bottom: 0.9em;
  font-weight: 500;
  color: #222;
}

#project-details-modal input,
#project-details-modal textarea {
  width: 100%;
  padding: 0.5em 0.7em;
  margin-top: 0.3em;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 1em;
  box-sizing: border-box;
  resize: vertical;
}

#project-details-modal textarea {
  min-height: 48px;
  max-height: 120px;
}

#save-project-details {
  margin-top: 1em;
  padding: 0.7em 2em;
  background: #2196F3;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
}

#save-project-details:hover {
  background: #1769aa;
}

/* Add to your style.css */
/* .modal-content button {
  display: inline-block;
  margin: 8px 4px 0 0;
} */

#project-details-modal .modal-content button {
  display: inline-block;
  margin: 8px 4px 0 0;
  padding: 0.7em 2em;
  background: #2196F3;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.2s;
}

#project-details-modal .modal-content button:hover {
  background: #1769aa;
}

.loading-spinner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.spinner {
  border: 4px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top: 4px solid #2196F3;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Add to your CSS */
#project-details-modal {
  z-index: 1100; /* Ensure it's above other content */
}

#project-details-modal .modal-content {
  max-width: 90vw; /* Responsive width */
  max-height: 90vh; /* Prevent taking full screen height */
  overflow-y: auto; /* Enable scrolling for tall content */
  padding: 20px; /* Add some padding */
}

/* Button container styling */
.button-container {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  justify-content: flex-end;
}

/* Make buttons more visible */
#save-project-details,
#save-and-continue-project-details {
  padding: 12px 25px;
  font-size: 16px;
  font-weight: bold;
}

.project-item.incomplete {
  background: #fff3cd;
  border-left: 5px solid #ffc107;
  color: #856404;
  position: relative;
}
.project-item.incomplete::after {
  content: "Incomplete";
  position: absolute;
  top: 10px;
  right: 15px;
  background: #ffc107;
  color: #fff;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.85em;
  font-weight: bold;
}

.fallback-message {
    font-size: 14px;
    line-height: 1.4;
    border-radius: 4px;
}


/* ============== Teammate Home Styling (scoped, non-breaking) ============== */
:root {
  --ex-primary: #2196F3;
  --ex-primary-dark: #1769aa;
  --ex-bg: #0b1220;
  --ex-surface: rgba(255,255,255,0.06);
  --ex-text: #e9eef6;
  --ex-muted: #b9c3d1;
  --ex-border: rgba(255,255,255,0.14);
}

/* Only affect the home page */
body.home {
  position: relative;
  min-height: 100vh;
  background-color: #0b1220; /* fallback */
  color: #e9eef6; /* readable over dark bg */
}
body.home::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(11,18,32,0.80), rgba(11,18,32,0.80)),
    url("/teammate/uploads/bg-image.webp") center/cover no-repeat fixed;
  z-index: -1;
}

/* Header + Navbar */
.ex-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: saturate(120%) blur(8px);
  background: rgba(11,18,32,0.55);
  border-bottom: 1px solid var(--ex-border);
}
.ex-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ex-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ex-text);
  font-weight: 600;
  letter-spacing: 0.2px;
}
.ex-logo { width: 28px; height: 28px; }
.ex-brand-text { font-size: 1.05rem; }

.ex-nav { display: flex; align-items: center; gap: 20px; }
.ex-nav-link {
  color: var(--ex-text);
  text-decoration: none;
  font-weight: 500;
  opacity: 0.9;
}
.ex-nav-link:hover { opacity: 1; }
.ex-nav-cta {
  color: #fff;
  background: var(--ex-primary);
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.ex-nav-cta:hover { background: var(--ex-primary-dark); }

.ex-nav-toggle {
  display: none;
  width: 40px;
  height: 36px;
  border: 1px solid var(--ex-border);
  background: var(--ex-surface);
  border-radius: 8px;
}
.ex-nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ex-text);
  margin: 5px auto;
}

/* Hero */
.ex-hero {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 32px 16px;
}
.ex-hero-content {
  max-width: 820px;
  margin: 0 auto;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  border: 1px solid var(--ex-border);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.ex-hero h1 {
  margin: 0 0 12px;
  font-size: 2.4rem;
  line-height: 1.2;
  color: #fff;
}
.ex-hero p { color: var(--ex-muted); font-size: 1.05rem; }

/* Style your existing /login link as CTA without changing href */
.ex-hero a[href="/login"],
.ex-cta {
  display: inline-block;
  margin-top: 14px;
  background: var(--ex-primary);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.ex-hero a[href="/login"]:hover,
.ex-cta:hover { background: var(--ex-primary-dark); }

/* Footer */
.ex-footer {
  border-top: 1px solid var(--ex-border);
  background: rgba(11,18,32,0.6);
}
.ex-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ex-muted);
  font-size: 0.95rem;
}
.ex-footer a {
  color: var(--ex-text);
  text-decoration: none;
  opacity: 0.9;
}
.ex-footer a:hover { opacity: 1; }
.ex-footer-links { display: flex; gap: 16px; }

/* Responsive nav */
@media (max-width: 880px) {
  .ex-nav-toggle { display: inline-block; }
  .ex-nav {
    position: absolute;
    top: 64px;
    right: 16px;
    left: 16px;
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    background: rgba(11,18,32,0.9);
    border: 1px solid var(--ex-border);
    border-radius: 12px;
  }
  .ex-nav.open { display: flex; }
}

/* Accessibility utility */
.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden; clip: rect(1px,1px,1px,1px);
  white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* Dashboard layout */
.dashboard-container {
  max-width: 1240px;
  margin: 24px auto;
  padding: 0 16px 32px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.dashboard-sidebar {
  position: sticky;
  top: 72px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.profile-summary {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 0;
}
.role-badges .badge {
  display: inline-block;
  margin-right: 6px;
  margin-top: 6px;
}

/* Cards and grids */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.tool-card, .action-card, .subscription-status, .activity-feed {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 14px;
  margin: 12px 0;
}
.tool-card { cursor: pointer; transition: transform .1s ease, box-shadow .15s ease; }
.tool-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.tool-card h4 { margin: 0 0 6px; }
.actions-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-quick { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }

/* New dashboard structure */
.quick-actions-row {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.quick-actions-row h3 {
  margin: 0;
  font-size: 1rem;
}
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}
.quick-actions button {
  width: 100%;
  justify-content: center;
}
.quick-actions-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.middle-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}
.panel-card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 14px;
}
.projects-area {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.project-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.search-input {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}
.project-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid #eef2f7;
}
.project-row:last-child {
  border-bottom: none;
}
.project-link {
  color: #111827;
  text-decoration: none;
  font-weight: 600;
  flex: 1 1 auto;
}
.project-link:hover {
  text-decoration: underline;
}
.project-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.project-create-row {
  margin: 0;
  display: flex;
  justify-content: flex-end;
}

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

  .dashboard-sidebar {
    position: static;
  }

  .middle-panels {
    grid-template-columns: 1fr;
  }
}

/* Buttons */
button, .button, .boq-modal-btn {
  background: #2196F3;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .15s;
}
button:hover, .button:hover, .boq-modal-btn:hover { background: #1769aa; }
button.primary { background:#2196F3; }
button.primary:hover { background:#1769aa; }

/* Dashboard theming (scoped) */

/* Improve skeleton look on light card */
@keyframes skeleton-shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}
.skeleton .skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: #eef1f5;
  background-image: linear-gradient(90deg, #eef1f5 0px, #f6f8fb 40px, #eef1f5 80px);
  background-size: 200px 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}



/* === Calculation page UX refinements === */
body.calc-page { font-size: 14px; line-height: 1.5; }
body.calc-page .container { display:flex; flex-wrap:wrap; gap:14px; padding:16px 3%; align-items:flex-start; }

/* Columns: left (selector/utilities), right (inputs/results) */
body.calc-page .left-section {
  flex: 1 1 240px; max-width: 300px;
  display:flex; flex-direction:column; gap:8px;
  position: sticky; top: 8px;
  max-height: calc(100vh - 24px);
  overflow: hidden;
}
body.calc-page .right-section {
  flex: 1 1 520px; max-width: 960px;
  /* flat — no outer card wrapper */
}

/* Component selector card */
body.calc-page .component-selector {
  background:#fff; border-radius:8px; padding:8px;
  border:1px solid #e2e8f0; box-shadow:0 1px 4px rgba(0,0,0,0.04);
  border-left:3px solid var(--primary-color, #0073e6);
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
body.calc-page .component-selector-header {
  background:#f0f6ff; border:1px solid #e0eaf5; border-radius:5px;
  padding:5px 8px; margin:0 0 6px;
  display:flex; justify-content:space-between; align-items:center;
  flex-shrink: 0;
}
body.calc-page .component-selector-title { font-weight:600; color:#1e293b; font-size:0.82rem; }
body.calc-page .component-selector-hint { font-size:0.7rem; color:#64748b; }
body.calc-page #elements {
  width:100%; flex:1 1 auto; min-height:120px;
  padding:4px; border-radius:5px; border:1px solid #e2e8f0;
  font-size:13px; overflow-y:auto;
}

/* Utility cards — flat */
body.calc-page #currency-controls,
body.calc-page #location-fields {
  background:#fff; border-radius:6px; padding:8px 10px;
  border:1px solid #e2e8f0; box-shadow:0 1px 4px rgba(0,0,0,0.04);
}

/* Small save status label near Save/Update buttons */
body.calc-page .save-status {
  margin-left: 10px;
  font-size: 11px;
  opacity: 0.85;
}
body.calc-page #currency-controls select,
body.calc-page #location-fields select { width:100%; padding:7px 10px; font-size:13px; }

/* Slim controls overall */
body.calc-page input[type="number"],
body.calc-page input[type="text"],
body.calc-page select,
body.calc-page textarea { padding:7px 10px; border-radius:5px; font-size:13.5px; }
body.calc-page button,
body.calc-page .boq-modal-btn { padding:6px 12px; border-radius:5px; font-size:13px; }

/* Fieldsets — flat inline, no nested card feel */
body.calc-page fieldset {
  margin:0 0 14px; padding:12px 14px 10px; border-radius:8px;
  border:none; border-left:3px solid #e2e8f0;
  background:#fff; box-shadow:0 1px 4px rgba(0,0,0,0.04);
}
body.calc-page fieldset:focus-within {
  border-left-color: var(--primary-color, #0073e6);
  box-shadow: 0 2px 8px rgba(0,115,230,0.08);
}
body.calc-page #results {
  margin-top:14px; padding:14px; background:#fff; border-radius:8px;
  border:1px solid #e2e8f0; box-shadow:0 1px 4px rgba(0,0,0,0.04);
}

/* Modal basic layout if missing */
body.calc-page .boq-modal { position:fixed; inset:0; background:rgba(0,0,0,0.45); display:none; align-items:center; justify-content:center; z-index:1000; }
body.calc-page .boq-modal-content { background:#fff; border-radius:8px; padding:16px; width:min(480px,92%); box-shadow:0 8px 24px rgba(0,0,0,0.15); }

@media (max-width: 768px) {
  body.calc-page .container { flex-direction:column; }
  body.calc-page .left-section, body.calc-page .right-section { max-width:100%; }
  body.calc-page .left-section { position:static; max-height:none; }
  body.calc-page .component-selector { position:static; }
}


/* --- Rates banners --- */
#rates-banner {
  position: sticky;
  top: 0;
  z-index: 1100;
}

.rates-delta-pill {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
}

.rates-delta-prompt {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  font-size: 0.82rem;
}

.rates-delta-prompt .rates-delta-action,
.rates-delta-prompt .rates-delta-dismiss {
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.78rem;
}

.rates-delta-prompt .rates-delta-action {
  background: #1e3a8a;
  color: #fff;
}

.rates-delta-prompt .rates-delta-dismiss {
  background: #e2e8f0;
  color: #334155;
}

/* --- Calculate overlay spinner --- */
.calc-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.65);
  display: none; /* shown via JS */
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 1200;
}
.calc-loading-overlay .spinner {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 3px solid #cbd5e1;
  border-top-color: #0073e6;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


.result-item { position: relative; }
.result-item .remove-result-btn {
  position: absolute; top: 8px; right: 8px;
  background: #fee2e2; color: #991b1b;
  border: 1px solid #fecaca; border-radius: 4px;
  font-size: 12px; padding: 2px 6px; cursor: pointer;
}

/* Calc overlay: fade in/out */
.calc-loading-overlay {
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease;
  pointer-events: auto; /* block clicks while visible */
}

