/* ═══════════════════════════════════════════════════════════════════════════
   CalSheet Truss Modullar - Cloud Database & Modal Styles
   PT. Wiratama Globalindo Jaya
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── HEADER ACTIONS & BADGES ── */
.header-cloud-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.75rem;
}

.db-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.db-badge::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.db-badge-online {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.db-badge-online::before {
  background: #10B981;
  box-shadow: 0 0 6px #10B981;
}

.db-badge-offline {
  background: rgba(245, 158, 11, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.db-badge-offline::before {
  background: #F59E0B;
}

.db-badge:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
}

.btn-header-db {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(30, 41, 59, 0.7);
  color: #F8FAFC;
}
.btn-header-db:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}
.btn-header-primary {
  background: #0284C7;
  border-color: #38BDF8;
  color: #FFFFFF;
}
.btn-header-primary:hover {
  background: #0369A1;
}

/* ── MODAL BACKDROP & CONTAINER ── */
.db-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.db-modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.db-modal-content {
  background: #0F172A;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.db-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(30, 41, 59, 0.5);
}

.db-modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #F8FAFC;
  display: flex;
  align-items: center;
}

.db-modal-close {
  background: none;
  border: none;
  color: #94A3B8;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  border-radius: 4px;
}
.db-modal-close:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.1);
}

.db-modal-toolbar {
  padding: 0.85rem 1.25rem;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.db-modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.db-modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(30, 41, 59, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

/* ── TABLE STYLES IN MODAL ── */
.db-table-wrapper {
  flex: 1;
  overflow-y: auto;
  max-height: calc(90vh - 220px);
}

.db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.db-table th {
  background: #1E293B;
  color: #94A3B8;
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.db-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #CBD5E1;
  vertical-align: middle;
}

.db-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.project-row-active td {
  background: rgba(14, 165, 233, 0.08) !important;
  border-left: 3px solid #0EA5E9;
}

/* ── NOTICE BOXES ── */
.db-notice-box {
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
}
.db-notice-online {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #A7F3D0;
}
.db-notice-offline {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #FDE68A;
}

/* ── TOAST NOTIFICATION ── */
.db-toast {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 100000;
  padding: 0.9rem 1.35rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: #FFFFFF;
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.65), 0 0 15px rgba(14, 165, 233, 0.2);
  opacity: 0;
  transform: translateY(-20px) scale(0.96);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: normal;
  max-width: 440px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.db-toast.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.db-toast-title {
  font-weight: 800;
  font-size: 0.92rem;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #FFFFFF;
}
.db-toast-message {
  font-size: 0.8rem;
  line-height: 1.45;
  color: #E2E8F0;
}
.db-toast-info {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.97), rgba(30, 41, 59, 0.97));
  border: 1.5px solid #38BDF8;
}
.db-toast-calc {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.97), rgba(30, 58, 138, 0.97));
  border: 1.5px solid #38BDF8;
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.65), 0 0 20px rgba(56, 189, 248, 0.35);
}
.db-toast-success {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.97), rgba(15, 23, 42, 0.97));
  border: 1.5px solid #34D399;
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.65), 0 0 20px rgba(52, 211, 153, 0.3);
}
.db-toast-error {
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.97), rgba(15, 23, 42, 0.97));
  border: 1.5px solid #F87171;
}

/* ── CALCULATION STATUS PILL & ANIMATIONS ── */
.calc-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.35);
  color: #38BDF8;
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: all 0.3s ease;
}
.calc-status-pill.pill-success {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34D399;
}
.calc-status-pill.pill-calculating {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.45);
  color: #FBBF24;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
  animation: pulseDotAnim 1.8s infinite;
}
@keyframes pulseDotAnim {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.highlight-recalculated {
  animation: glowRecalcAnim 1.3s ease-out;
}
@keyframes glowRecalcAnim {
  0% {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.6), 0 0 25px rgba(16, 185, 129, 0.35);
    border-color: #10B981 !important;
  }
  100% {
    box-shadow: none;
  }
}

/* ── STEP 1 QUICK DB BAR ── */
.step-db-quickbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, rgba(30, 58, 138, 0.25) 0%, rgba(15, 23, 42, 0.6) 100%);
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: 8px;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.step-db-quickbar-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.step-db-quickbar-icon {
  font-size: 1.6rem;
}
.step-db-quickbar-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #F8FAFC;
}
.step-db-quickbar-sub {
  font-size: 0.75rem;
  color: #94A3B8;
}

/* ── STEP CONFIRMATION MODAL & ENHANCEMENTS ── */
.scm-backdrop {
  display: none !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 999999 !important;
  background: rgba(10, 15, 29, 0.82) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1.5rem !important;
  overflow-y: auto !important;
}

.scm-backdrop.scm-open {
  display: flex !important;
  animation: scmFadeIn 0.22s ease-out !important;
}

@keyframes scmFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scmCardPop {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.scm-card {
  position: relative !important;
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  border-radius: 16px !important;
  max-width: 680px !important;
  width: 100% !important;
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.85), 0 0 35px rgba(56, 189, 248, 0.15) !important;
  padding: 1.75rem !important;
  color: #f8fafc !important;
  animation: scmCardPop 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.scm-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  margin-bottom: 1rem !important;
  gap: 1rem !important;
}

.scm-header-left {
  display: flex !important;
  align-items: center !important;
  gap: 0.85rem !important;
}

.scm-step-badge {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  border-radius: 8px !important;
  padding: 0.35rem 0.65rem !important;
  text-align: center !important;
  color: #ffffff !important;
  flex-shrink: 0 !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35) !important;
}

.scm-step-label {
  display: block !important;
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em !important;
  opacity: 0.9 !important;
}

.scm-step-num {
  display: block !important;
  font-size: 1.25rem !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  font-family: var(--font-mono, monospace) !important;
}

.scm-icon-row {
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
}

.scm-icon {
  font-size: 1.25rem !important;
}

.scm-title {
  font-size: 1.15rem !important;
  font-weight: 700 !important;
  color: #f8fafc !important;
  margin: 0 !important;
}

.scm-subtitle {
  font-size: 0.82rem !important;
  color: #94a3b8 !important;
  margin: 0.25rem 0 0 0 !important;
}

.scm-btn-close {
  background: transparent !important;
  border: none !important;
  color: #64748b !important;
  font-size: 1.25rem !important;
  cursor: pointer !important;
  padding: 0.25rem 0.5rem !important;
  border-radius: 6px !important;
  line-height: 1 !important;
  transition: all 0.2s ease !important;
}

.scm-btn-close:hover {
  color: #f8fafc !important;
  background: rgba(255, 255, 255, 0.1) !important;
}

.scm-notice {
  background: rgba(14, 165, 233, 0.1) !important;
  border-left: 4px solid #38bdf8 !important;
  border-radius: 8px !important;
  padding: 0.75rem 1rem !important;
  margin: 1rem 0 !important;
  font-size: 0.84rem !important;
  color: #cbd5e1 !important;
  display: flex !important;
  align-items: flex-start !important;
  gap: 0.65rem !important;
  line-height: 1.45 !important;
}

.scm-notice-icon {
  font-size: 1.1rem !important;
  flex-shrink: 0 !important;
}

.scm-table-wrapper {
  background: #090d16 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px !important;
  max-height: 240px !important;
  overflow-y: auto !important;
  margin-bottom: 1.15rem !important;
}

.scm-table {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 0.84rem !important;
}

.scm-table thead th {
  background: #131b2e !important;
  color: #38bdf8 !important;
  text-align: left !important;
  padding: 0.55rem 0.85rem !important;
  font-weight: 600 !important;
  font-size: 0.72rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 1 !important;
}

.scm-table tbody td {
  padding: 0.5rem 0.85rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.scm-table tbody tr:last-child td {
  border-bottom: none !important;
}

.scm-lbl {
  color: #94a3b8 !important;
  font-weight: 500 !important;
  width: 45% !important;
}

.scm-val {
  color: #f1f5f9 !important;
  font-weight: 600 !important;
  text-align: right !important;
  font-family: var(--font-mono, monospace) !important;
}

.scm-question {
  background: rgba(34, 197, 94, 0.08) !important;
  border: 1px solid rgba(34, 197, 94, 0.25) !important;
  border-radius: 8px !important;
  padding: 0.7rem 0.95rem !important;
  color: #86efac !important;
  font-size: 0.85rem !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.6rem !important;
  margin-bottom: 1.25rem !important;
}

.scm-question-icon {
  font-size: 1.1rem !important;
}

.scm-actions {
  display: flex !important;
  gap: 0.75rem !important;
  justify-content: flex-end !important;
  align-items: center !important;
}

.scm-btn {
  padding: 0.65rem 1.2rem !important;
  border-radius: 8px !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  border: none !important;
}

.scm-btn-secondary {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #94a3b8 !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.scm-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #ffffff !important;
}

.scm-btn-primary {
  background: linear-gradient(135deg, #0284c7, #2563eb) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35) !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
}

.scm-btn-primary:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8) !important;
  transform: translateY(-1px) !important;
}

.scm-next-label {
  font-weight: 700 !important;
  color: #fef08a !important;
}

.scm-footer-note {
  margin-top: 0.85rem !important;
  font-size: 0.74rem !important;
  color: #64748b !important;
  text-align: center !important;
}

.scm-footer-note kbd {
  background: rgba(255, 255, 255, 0.1) !important;
  padding: 1px 5px !important;
  border-radius: 4px !important;
  color: #cbd5e1 !important;
}

.step-tooltip {
  display: none !important;
}
