/* ================================================================
   Member Portal — Crane Auth Stylesheet
   DHA Quetta Smart City Portal — v4 Multi-Crane + Light/Dark
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ================================================================
   THEME TOKENS — Dark (default)
   ================================================================ */
:root,
[data-theme="dark"] {
  --bg-root: #090d14;
  --bg-left: linear-gradient(175deg, #0d1320 0%, #0a1018 40%, #0e141e 100%);
  --bg-right: #10131a;
  --border-left: rgba(230,194,0,0.10);
  --glow-bottom: rgba(230,194,0,0.05);

  --text-primary: #f2f2f2;
  --text-secondary: #a0a8b8;
  --text-muted: #5a6478;
  --text-gold: #e6c200;
  --text-gold-dim: rgba(230,194,0,0.7);

  --input-bg: rgba(255,255,255,0.04);
  --input-border: rgba(255,255,255,0.09);
  --input-focus-border: rgba(230,194,0,0.5);
  --input-focus-shadow: rgba(230,194,0,0.07);
  --input-text: #e0e4ec;
  --input-placeholder: #3e4558;

  --btn-bg: linear-gradient(135deg, #d4a800 0%, #e6c200 50%, #d4a800 100%);
  --btn-text: #090d14;
  --btn-shadow: rgba(230,194,0,0.18);
  --btn-hover-shadow: rgba(230,194,0,0.28);

  --divider: rgba(255,255,255,0.06);
  --progress-track: rgba(255,255,255,0.06);
  --progress-fill: linear-gradient(90deg, #048a5c 0%, #e6c200 100%);
  --progress-glow: rgba(230,194,0,0.25);

  --tab-inactive: #4a5268;
  --tab-hover: #7a8298;
  --tab-active: #e6c200;
  --tab-line: rgba(255,255,255,0.06);

  --badge-bg: rgba(10,15,22,0.88);
  --badge-border: rgba(230,194,0,0.15);
  --badge-active-border: rgba(230,194,0,0.4);
  --badge-active-text: #e6c200;
  --badge-dot: #3a3e4a;
  --badge-dot-active: #e6c200;

  --error-bg: rgba(239,68,68,0.08);
  --error-border: rgba(239,68,68,0.2);
  --error-text: #f87171;

  --toggle-bg: rgba(255,255,255,0.06);
  --toggle-border: rgba(255,255,255,0.1);
  --toggle-text: #8a90a0;
  --toggle-hover-bg: rgba(255,255,255,0.1);
}

/* ================================================================
   THEME TOKENS — Light
   ================================================================ */
[data-theme="light"] {
  --bg-root: #f4f6fa;
  --bg-left: linear-gradient(175deg, #e8ecf2 0%, #dfe4ec 40%, #e2e7f0 100%);
  --bg-right: #ffffff;
  --border-left: rgba(0,0,0,0.08);
  --glow-bottom: rgba(230,194,0,0.08);

  --text-primary: #1a1d28;
  --text-secondary: #4a5068;
  --text-muted: #8890a0;
  --text-gold: #b38600;
  --text-gold-dim: rgba(179,134,0,0.8);

  --input-bg: rgba(0,0,0,0.03);
  --input-border: rgba(0,0,0,0.10);
  --input-focus-border: rgba(179,134,0,0.5);
  --input-focus-shadow: rgba(179,134,0,0.1);
  --input-text: #1a1d28;
  --input-placeholder: #b0b8c8;

  --btn-bg: linear-gradient(135deg, #c49800 0%, #d4a800 50%, #c49800 100%);
  --btn-text: #fff;
  --btn-shadow: rgba(196,152,0,0.2);
  --btn-hover-shadow: rgba(196,152,0,0.35);

  --divider: rgba(0,0,0,0.07);
  --progress-track: rgba(0,0,0,0.06);
  --progress-fill: linear-gradient(90deg, #048a5c 0%, #c49800 100%);
  --progress-glow: rgba(196,152,0,0.2);

  --tab-inactive: #8890a0;
  --tab-hover: #5a6278;
  --tab-active: #b38600;
  --tab-line: rgba(0,0,0,0.07);

  --badge-bg: rgba(255,255,255,0.9);
  --badge-border: rgba(0,0,0,0.1);
  --badge-active-border: rgba(179,134,0,0.4);
  --badge-active-text: #9a7400;
  --badge-dot: #c8ccd8;
  --badge-dot-active: #b38600;

  --error-bg: rgba(239,68,68,0.06);
  --error-border: rgba(239,68,68,0.18);
  --error-text: #dc2626;

  --toggle-bg: rgba(0,0,0,0.04);
  --toggle-border: rgba(0,0,0,0.1);
  --toggle-text: #6a7088;
  --toggle-hover-bg: rgba(0,0,0,0.08);
}

/* ================================================================
   BASE RESET
   ================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-root);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background 0.4s ease;
}

/* ================================================================
   ROOT LAYOUT
   ================================================================ */
.crane-auth-root {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-root);
  transition: background 0.4s ease;
}

/* ================================================================
   THEME TOGGLE BUTTON
   ================================================================ */
.crane-theme-toggle {
  position: absolute;
  top: 1.75rem;
  right: 2rem;
  z-index: 30;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--toggle-border);
  background: var(--toggle-bg);
  color: var(--toggle-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
  backdrop-filter: blur(8px);
  padding: 0;
}

.crane-theme-toggle:hover {
  background: var(--toggle-hover-bg);
  transform: scale(1.05);
}

.crane-theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.crane-theme-toggle:hover svg {
  transform: rotate(20deg);
}

/* Icon visibility */
.crane-theme-toggle .icon-sun  { display: none; }
.crane-theme-toggle .icon-moon { display: block; }

[data-theme="dark"] .crane-theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .crane-theme-toggle .icon-moon { display: none; }

/* ================================================================
   LEFT PANEL — Construction Site
   ================================================================ */
.crane-left {
  width: 52%;
  min-height: 100vh;
  background: var(--bg-left);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--border-left);
  flex-shrink: 0;
  transition: background 0.4s ease, border-color 0.4s ease;
}

.crane-left::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 120%;
  height: 60%;
  background: radial-gradient(ellipse at center, var(--glow-bottom) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}

/* --- Branding --- */
.crane-brand {
  position: absolute;
  top: 1.75rem;
  left: 2rem;
  right: 4.5rem;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  pointer-events: none;
}

.crane-logo-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.crane-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: linear-gradient(135deg, #024230 0%, #048a5c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(4,138,92,0.5);
  box-shadow: 0 0 20px rgba(4,138,92,0.3), 0 4px 12px rgba(0,0,0,0.2);
}

.crane-logo-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  transition: color 0.3s;
}

.crane-logo-sub {
  font-size: 10px;
  color: var(--text-gold);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-top: 1px;
  font-weight: 600;
  transition: color 0.3s;
}

/* --- Status Badge --- */
.crane-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  border-radius: 20px;
  background: var(--badge-bg);
  border: 1px solid var(--badge-border);
  font-size: 11px;
  color: var(--text-muted);
  transition: all 0.4s ease;
  width: fit-content;
  backdrop-filter: blur(12px);
  letter-spacing: 0.02em;
  font-weight: 500;
}

.crane-status-badge.active {
  border-color: var(--badge-active-border);
  color: var(--badge-active-text);
}

.crane-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--badge-dot);
  transition: background 0.3s;
  flex-shrink: 0;
}

.crane-status-badge.active .crane-status-dot {
  background: var(--badge-dot-active);
  box-shadow: 0 0 8px rgba(230,194,0,0.4);
  animation: crane-dot-pulse 1.5s infinite;
}

@keyframes crane-dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.6); }
}

/* --- Canvas --- */
#crane-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 5;
}

/* --- Progress Footer --- */
.crane-progress-footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  padding: 1rem 2rem 1.2rem;
  background: linear-gradient(transparent, rgba(10,15,22,0.96) 40%);
  pointer-events: none;
}

[data-theme="light"] .crane-progress-footer {
  background: linear-gradient(transparent, rgba(228,232,240,0.97) 40%);
}

.crane-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.crane-progress-label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  transition: color 0.3s;
}

.crane-progress-floors {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  transition: color 0.3s;
}

.crane-progress-pct {
  font-size: 12px;
  color: var(--text-gold);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  transition: color 0.3s;
}

.crane-progress-track {
  height: 3px;
  background: var(--progress-track);
  border-radius: 3px;
  overflow: hidden;
  transition: background 0.3s;
}

.crane-progress-fill {
  height: 100%;
  background: var(--progress-fill);
  border-radius: 3px;
  width: 0%;
  transition: width 0.55s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 0 10px var(--progress-glow);
}

/* ================================================================
   RIGHT PANEL — Forms
   ================================================================ */
.crane-right {
  flex: 1;
  background: var(--bg-right);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  overflow-y: auto;
  min-height: 100vh;
  transition: background 0.4s ease;
}

.crane-right-inner {
  width: 100%;
  max-width: 370px;
}

/* ================================================================
   TOP FORM PROGRESS
   ================================================================ */
.crane-form-progress {
  height: 3px;
  background: var(--progress-track);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.crane-form-progress-fill {
  height: 100%;
  background: var(--progress-fill);
  border-radius: 3px;
  width: 0%;
  transition: width 0.55s cubic-bezier(0.4,0,0.2,1);
  box-shadow: 0 0 10px var(--progress-glow);
}

/* ================================================================
   TABS
   ================================================================ */
.crane-tabs {
  display: flex;
  border-bottom: 1px solid var(--tab-line);
  margin-bottom: 1.5rem;
}

.crane-tab {
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--tab-inactive);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
  user-select: none;
}

.crane-tab:hover { color: var(--tab-hover); }

.crane-tab.active {
  color: var(--tab-active);
  border-bottom-color: var(--tab-active);
  font-weight: 600;
}

/* ================================================================
   PANELS
   ================================================================ */
.crane-panel { display: none; }

.crane-panel.active {
  display: block;
  animation: crane-panel-in 0.3s ease;
}

@keyframes crane-panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* ================================================================
   PANEL HEADER
   ================================================================ */
.crane-panel-header { margin-bottom: 1.5rem; }

.crane-panel-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 4px;
  transition: color 0.3s;
}

.crane-panel-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  transition: color 0.3s;
}

/* ================================================================
   FORM FIELDS
   ================================================================ */
.crane-field { margin-bottom: 0.9rem; }

.crane-label {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 0.3s;
}

.crane-input-wrap { position: relative; }

.crane-input-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  z-index: 1;
  transition: color 0.3s;
}

.crane-input {
  width: 100%;
  padding: 11px 14px 11px 36px;
  font-size: 14px;
  border-radius: 9px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  outline: none;
  transition: all 0.2s;
  font-family: 'DM Sans', system-ui, sans-serif;
  -webkit-appearance: none;
}

.crane-input::placeholder { color: var(--input-placeholder); }

.crane-input:focus {
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px var(--input-focus-shadow);
}

.crane-input.filled { border-color: rgba(4,138,92,0.4); }
.crane-input.no-icon { padding-left: 14px; }

.crane-input-toggle {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  opacity: 0.6;
  transition: opacity 0.2s, color 0.2s;
}

.crane-input-toggle:hover,
.crane-input-toggle.shown {
  opacity: 1;
  color: var(--text-gold);
}

select.crane-input {
  padding-left: 14px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-color: var(--input-bg);
  padding-right: 34px;
}

select.crane-input option {
  background: var(--bg-right);
  color: var(--input-text);
}

.crane-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 0.9rem;
}

.crane-fields-grid .crane-field { margin-bottom: 0; }

.crane-forgot {
  text-align: right;
  margin-top: -0.3rem;
  margin-bottom: 1rem;
}

.crane-forgot a {
  font-size: 12px;
  color: var(--text-gold);
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.15s;
  cursor: pointer;
  font-weight: 500;
}

.crane-forgot a:hover { opacity: 1; }

/* ================================================================
   BUTTONS
   ================================================================ */
.crane-btn {
  width: 100%;
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 9px;
  border: none;
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
  font-family: 'DM Sans', system-ui, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px var(--btn-shadow);
}

.crane-btn:hover {
  box-shadow: 0 6px 24px var(--btn-hover-shadow);
  transform: translateY(-1px);
}

.crane-btn:active { transform: scale(0.99); }

.crane-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.crane-btn-secondary {
  background: transparent;
  border: 1px solid var(--divider);
  color: var(--text-secondary);
  margin-top: 8px;
  box-shadow: none;
}

.crane-btn-secondary:hover {
  background: var(--input-bg);
  color: var(--text-primary);
  box-shadow: none;
}

/* ================================================================
   DIVIDER + FOOTER LINK
   ================================================================ */
.crane-divider {
  height: 1px;
  background: var(--divider);
  margin: 1.1rem 0;
}

.crane-footer-link {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
  transition: color 0.3s;
}

.crane-footer-link a {
  color: var(--text-gold);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s;
}

.crane-footer-link a:hover {
  opacity: 0.85;
  text-decoration: underline;
}

/* ================================================================
   ERROR BOX
   ================================================================ */
.crane-error {
  display: none;
  margin-top: 0.6rem;
  padding: 9px 14px;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--error-text);
  line-height: 1.45;
}

.crane-error.visible { display: block; }

/* ================================================================
   URL LIST
   ================================================================ */
.crane-url-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0.25rem;
}

.crane-url-btn {
  display: flex;
  width: 100%;
  padding: 13px 18px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  text-align: left;
  transition: all 0.2s;
  cursor: pointer;
  font-family: 'DM Sans', system-ui, sans-serif;
  align-items: center;
  justify-content: space-between;
}

.crane-url-btn::after {
  content: '→';
  font-size: 15px;
  color: var(--text-muted);
  transition: color 0.2s, transform 0.2s;
}

.crane-url-btn:hover {
  border-color: var(--input-focus-border);
  color: var(--text-gold);
}

.crane-url-btn:hover::after {
  color: var(--text-gold);
  transform: translateX(3px);
}

/* ================================================================
   2FA / INFO
   ================================================================ */
.crane-info-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.65;
  border-left: 2px solid var(--divider);
  padding-left: 12px;
}

input.crane-otp {
  padding-left: 14px;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.3em;
  font-family: 'JetBrains Mono', monospace;
}

.crane-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.9rem;
}

.crane-checkbox-row input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--text-gold);
  cursor: pointer;
  flex-shrink: 0;
}

.crane-checkbox-row label {
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (min-width: 1600px) { .crane-left { width: 58%; } }
@media (min-width: 1400px) and (max-width: 1599px) { .crane-left { width: 55%; } .crane-right-inner { max-width: 390px; } }
@media (max-width: 1200px) { .crane-left { width: 48%; } }

@media (max-width: 900px) {
  .crane-left { width: 44%; }
  .crane-brand { top: 1.25rem; left: 1.25rem; right: 3.5rem; }
  .crane-right { padding: 2rem 1.5rem; }
  .crane-theme-toggle { top: 1.25rem; right: 1.25rem; }
}

@media (max-width: 768px) {
  html, body { overflow: auto; }

  .crane-auth-root {
    flex-direction: column;
    min-height: 100vh;
  }

  .crane-left {
    width: 100%;
    height: 300px;
    min-height: 300px;
    border-right: none;
    border-bottom: 1px solid var(--border-left);
  }

  .crane-right {
    flex: 1;
    min-height: unset;
    padding: 1.75rem 1.5rem;
    align-items: flex-start;
  }

  .crane-right-inner { max-width: 100%; }
  .crane-brand { top: 0.85rem; left: 1rem; right: 3.5rem; }
  .crane-theme-toggle { top: 0.85rem; right: 1rem; width: 34px; height: 34px; }
  .crane-progress-footer { padding: 0.5rem 1rem 0.7rem; }
  .crane-panel-title { font-size: 19px; }
}

@media (max-width: 480px) {
  .crane-left { height: 260px; min-height: 260px; }
  .crane-right { padding: 1.5rem 1.15rem; }
  .crane-panel-title { font-size: 18px; }
  .crane-btn { padding: 11px 14px; font-size: 12.5px; }
  .crane-input { padding: 10px 12px 10px 32px; font-size: 13.5px; }
  .crane-logo-icon { width: 36px; height: 36px; }
  .crane-logo-name { font-size: 14px; }
}

@media (max-width: 400px) {
  .crane-fields-grid { grid-template-columns: 1fr; }
  .crane-tab { padding: 8px 14px; font-size: 12.5px; }
  .crane-left { height: 240px; min-height: 240px; }
}

@media (max-width: 350px) {
  .crane-left { height: 220px; min-height: 220px; }
  .crane-brand { top: 0.5rem; left: 0.75rem; right: 3rem; gap: 0.3rem; }
  .crane-logo-icon { width: 30px; height: 30px; }
  .crane-theme-toggle { top: 0.5rem; right: 0.75rem; width: 30px; height: 30px; }
}

@media (max-width: 768px) and (orientation: landscape) {
  .crane-left { height: 220px; min-height: 220px; }
  .crane-right { padding: 1.25rem 2rem; }
}
