/* ============================================================
   WoofISP – Blue Professional Theme
   ============================================================ */
:root {
  --sidebar-w: 240px;
  --primary:       #1a3a6b;
  --primary-dark:  #0f2347;
  --primary-light: #2563eb;
  --accent:        #38bdf8;
  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --success:       #10b981;
  --danger:        #ef4444;
  --warning:       #f59e0b;
  --info:          #3b82f6;
  --radius:        10px;
  --shadow:        0 1px 4px rgba(0,0,0,0.08);
}

/* ── Reset ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  font-size: 14px;
}

/* ── App shell ──────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(175deg, var(--primary-dark) 0%, var(--primary) 100%);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 1.25rem 1.25rem 1rem;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: .3px;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand .brand-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-nav { flex: 1; padding: .75rem 0; }

.sidebar-section {
  padding: .6rem 1.25rem .3rem;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: rgba(255,255,255,.35);
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1.25rem;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: .88rem;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.sidebar-link svg { flex-shrink: 0; }
.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(255,255,255,.1);
  color: #fff;
  border-left-color: var(--accent);
}

.sidebar-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .8rem;
  color: rgba(255,255,255,.5);
}
.sidebar-footer .user-name {
  color: rgba(255,255,255,.85);
  font-weight: 600;
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-footer .btn-signout {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.7);
  border: none;
  padding: .35rem .85rem;
  border-radius: 6px;
  font-size: .78rem;
  cursor: pointer;
  margin-top: .4rem;
  width: 100%;
  transition: background .15s;
}
.sidebar-footer .btn-signout:hover {
  background: rgba(255,255,255,.2);
  color: #fff;
}

/* ── Main content ───────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.top-bar-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.top-bar-sub {
  font-size: .78rem;
  color: var(--text-muted);
}

.content-area { padding: 1.5rem 1.75rem; }

/* ── Stat cards ─────────────────────────────── */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform .2s;
  height: 100%;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .9rem;
}
.stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .2rem;
}
.stat-badge {
  display: inline-block;
  font-size: .72rem;
  padding: .2rem .55rem;
  border-radius: 20px;
  margin-top: .5rem;
  font-weight: 500;
}

/* ── Panel / chart cards ─────────────────────── */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.panel-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.panel-header h5 {
  margin: 0;
  font-size: .9rem;
  font-weight: 600;
}
.panel-body { padding: 1.25rem 1.5rem; }

/* ── Data table ─────────────────────────────── */
.panel table { margin: 0; width: 100%; font-size: .88rem; }
.panel thead th {
  background: #f8fafc;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  font-weight: 600;
  padding: .7rem 1.25rem;
  border-bottom: 1px solid var(--border);
  border-top: none;
}
.panel tbody td {
  padding: .8rem 1.25rem;
  vertical-align: middle;
  border-top: 1px solid var(--border);
}
.panel tbody tr:first-child td { border-top: none; }
.panel tbody tr:hover td { background: #f8fafc; }

/* ── Status badges ──────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .7rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s;
  white-space: nowrap;
  user-select: none;
}
.status-badge:hover { filter: brightness(.92); }
.status-badge::after { content: ' ▾'; font-size: .65rem; opacity: .7; }

.s-EnquiryReceived        { background:#dbeafe; color:#1d4ed8; }
.s-ContactAttempted       { background:#e0e7ff; color:#4338ca; }
.s-AwaitingCustomerResponse { background:#fef9c3; color:#854d0e; }
.s-SiteSurveyScheduled    { background:#dcfce7; color:#166534; }
.s-SiteSurveyComplete     { background:#a7f3d0; color:#065f46; }
.s-Quoted                 { background:#ffedd5; color:#9a3412; }
.s-AwaitingAcceptance     { background:#fef9c3; color:#854d0e; }
.s-ApprovedForInstallation { background:#d1fae5; color:#065f46; }
.s-InstallationScheduled  { background:#bfdbfe; color:#1e40af; }
.s-InstallationInProgress { background:#93c5fd; color:#1e3a8a; }
.s-Active                 { background:#bbf7d0; color:#14532d; }
.s-Suspended              { background:#fee2e2; color:#991b1b; }
.s-CancellationRequested  { background:#fde68a; color:#78350f; }
.s-Canceled               { background:#fecaca; color:#7f1d1d; }
.s-RejectedLost           { background:#f1f5f9; color:#475569; }

/* ── Action buttons ─────────────────────────── */
.btn-primary,
.btn-primary:focus {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-generate {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff !important;
  border: none;
  padding: .5rem 1.1rem;
  border-radius: 7px;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  text-decoration: none;
  transition: opacity .15s;
}
.btn-generate:hover { opacity: .88; }

/* ── Link copy box ──────────────────────────── */
.link-copy-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 7px;
  padding: .65rem 1rem;
  font-family: monospace;
  font-size: .78rem;
  word-break: break-all;
  color: #0369a1;
}

/* ── Misc helpers ───────────────────────────── */
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.section-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: .75rem;
}
.text-primary-custom { color: var(--primary); }

/* ── Customer portal (unauthenticated) ──────── */
.portal-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.portal-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 680px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.portal-card .portal-brand {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: .25rem;
}
.portal-card .portal-subtitle {
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: 2rem;
}

/* ── Responsive ─────────────────────────────── */
/* Hamburger button */
.hamburger-btn {
  background: none;
  border: none;
  padding: .3rem .4rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 32px;
  height: 24px;
  flex-shrink: 0;
}
.hamburger-btn span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: all .2s;
}

/* Sidebar overlay (mobile backdrop) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
}
.sidebar-overlay.active { display: block; }

@media (max-width: 767.98px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 200;
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
  }
  .main-content { margin-left: 0; }
  .content-area { padding: .85rem; }

  /* Make panel tables horizontally scrollable */
  .panel { overflow-x: auto; }
  .panel table { min-width: 540px; }

  /* Stack stat cards vertically but keep 2-col on sm */
  .stat-value { font-size: 1.5rem; }

  /* Portal card padding */
  .portal-card { padding: 1.5rem 1rem; }

  /* Top bar tighter on mobile */
  .top-bar { padding: .6rem 1rem; }
}

@media (min-width: 768px) {
  .hamburger-btn { display: none !important; }
  .sidebar-overlay { display: none !important; }
  html { font-size: 16px; }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

html, body {
    height: 100%;
}

.auth-body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(13, 110, 253, 0.18), transparent 30%),
        radial-gradient(circle at bottom right, rgba(111, 66, 193, 0.18), transparent 30%),
        linear-gradient(135deg, #0f172a 0%, #111827 45%, #1e293b 100%);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 24px;
    padding: 36px 32px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.auth-brand {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd, #6f42c1);
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(13, 110, 253, 0.25);
}

.auth-brand h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
}

.auth-brand p {
    margin: 8px 0 0;
    color: #64748b;
    font-size: 0.98rem;
}

.auth-form h2 {
    margin-bottom: 8px;
    text-align: center;
    font-weight: 700;
    color: #0f172a;
}

.auth-subtitle {
    text-align: center;
    color: #64748b;
    margin-bottom: 24px;
}

.auth-form .form-control {
    border-radius: 14px;
    min-height: 58px;
    border: 1px solid #dbe2ea;
    box-shadow: none;
}

.auth-form .form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.auth-form .form-floating > label {
    color: #64748b;
}

.auth-btn {
    border-radius: 14px;
    padding: 14px 18px;
    font-weight: 600;
}

@media (max-width: 576px) {
    .auth-card {
        padding: 28px 20px;
        border-radius: 20px;
    }

    .auth-brand h1 {
        font-size: 1.7rem;
    }
}
