/* =========================================================================
   53770 Sombrio Court - Living Lease Agreement & Management Portal
   Professional Styling for High-Fidelity UI and Court-Ready Print PDF
   ========================================================================= */

:root {
  --primary-navy: #0f172a;
  --primary-blue: #1e3a8a;
  --accent-blue: #2563eb;
  --accent-hover: #1d4ed8;
  --emerald-green: #059669;
  --amber-gold: #d97706;
  --danger-crimson: #dc2626;
  --bg-slate: #f8fafc;
  --card-bg: #ffffff;
  --border-slate: #e2e8f0;
  --border-dark: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Georgia', 'Cambria', "Times New Roman", serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-slate);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Header & Top Bar */
.top-header {
  background: linear-gradient(135deg, #091224 0%, #172554 100%);
  color: #ffffff;
  padding: 1.25rem 2rem;
  border-bottom: 3px solid var(--accent-blue);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-badge {
  background: rgba(37, 99, 235, 0.25);
  border: 1px solid rgba(147, 197, 253, 0.4);
  color: #bfdbfe;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  display: inline-block;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 0.15rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent-blue);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-emerald {
  background-color: var(--emerald-green);
  color: #ffffff;
}
.btn-emerald:hover {
  background-color: #047857;
}

.btn-amber {
  background-color: var(--amber-gold);
  color: #ffffff;
}
.btn-amber:hover {
  background-color: #b45309;
}

.btn-danger {
  background-color: var(--danger-crimson);
  color: #ffffff;
}
.btn-danger:hover {
  background-color: #b91c1c;
}

.btn-outline {
  background-color: transparent;
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}
.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.6);
}

.btn-outline-dark {
  background-color: #ffffff;
  border-color: var(--border-dark);
  color: var(--text-main);
}
.btn-outline-dark:hover {
  background-color: #f1f5f9;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
}

/* Nav Tabs */
.nav-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-slate);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 75px;
  z-index: 40;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  overflow-x: auto;
  padding: 0 1.5rem;
}

.nav-tab {
  padding: 0.85rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-tab:hover {
  color: var(--primary-blue);
  background: #f8fafc;
}

.nav-tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  background: #eff6ff;
}

/* Main Layout */
.main-wrapper {
  max-width: 1400px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.5rem;
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* Cards & Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-slate);
  border-radius: 0.5rem;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent-blue);
}

.stat-card.emerald::before { background: var(--emerald-green); }
.stat-card.amber::before { background: var(--amber-gold); }
.stat-card.danger::before { background: var(--danger-crimson); }
.stat-card.navy::before { background: var(--primary-navy); }

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-icon {
  font-size: 1.25rem;
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Banner Alerts */
.alert-banner {
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  border-left: 5px solid;
}

.alert-amber {
  background: #fffbeb;
  border-color: var(--amber-gold);
  color: #92400e;
}

.alert-danger {
  background: #fef2f2;
  border-color: var(--danger-crimson);
  color: #991b1b;
}

.alert-blue {
  background: #eff6ff;
  border-color: var(--accent-blue);
  color: #1e40af;
}

.alert-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.alert-body {
  font-size: 0.875rem;
  line-height: 1.4;
}

/* Living Document View */
.document-container {
  background: #ffffff;
  border: 1px solid var(--border-dark);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-md);
  max-width: 960px;
  margin: 0 auto;
  padding: 3.5rem 3.5rem 4rem;
  font-family: var(--font-serif);
  color: #1a1a1a;
  line-height: 1.7;
}

.doc-header {
  text-align: center;
  border-bottom: 2px solid #000;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.doc-title {
  font-size: 1.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.doc-subtitle {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #333;
}

.doc-property-tag {
  font-family: var(--font-sans);
  margin-top: 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-blue);
  background: #f1f5f9;
  display: inline-block;
  padding: 0.25rem 0.85rem;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
}

.doc-section {
  margin-bottom: 2rem;
}

.doc-section-title {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #000;
  padding-bottom: 0.35rem;
  margin-bottom: 1rem;
  color: #0f172a;
}

.doc-clause {
  margin-bottom: 1.25rem;
  text-align: justify;
  font-size: 0.975rem;
}

.doc-clause strong {
  font-family: var(--font-sans);
  font-weight: 700;
}

.doc-highlight-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 4px solid var(--accent-blue);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.doc-highlight-box.danger {
  background: #fef2f2;
  border-left-color: var(--danger-crimson);
  border-color: #fca5a5;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
}

.doc-table th,
.doc-table td {
  border: 1px solid #cbd5e1;
  padding: 0.65rem 0.85rem;
  text-align: left;
}

.doc-table th {
  background: #f1f5f9;
  font-weight: 700;
}

/* Signatures */
.signature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2.5rem;
  margin-top: 3rem;
  font-family: var(--font-sans);
}

.signature-block {
  border-top: 1px solid #000;
  padding-top: 0.75rem;
}

.sig-name {
  font-weight: 700;
  font-size: 1rem;
}

.sig-role {
  font-size: 0.85rem;
  color: #475569;
}

.sig-date-line {
  margin-top: 1.5rem;
  border-top: 1px dashed #94a3b8;
  padding-top: 0.35rem;
  font-size: 0.8rem;
  color: #64748b;
}

/* Tables for Management UI */
.panel-card {
  background: var(--card-bg);
  border: 1px solid var(--border-slate);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.data-table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border-slate);
}

.data-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-slate);
  vertical-align: middle;
}

.data-table tr:hover {
  background-color: #f8fafc;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-green { background: #dcfce7; color: #15803d; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-slate { background: #f1f5f9; color: #475569; }

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 1.5rem;
  backdrop-filter: blur(2px);
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: #ffffff;
  border-radius: 0.75rem;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-slate);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-close-btn:hover { color: var(--text-main); }

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-dark);
  border-radius: 0.375rem;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-slate);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Notice 24-hr Print Ready Sheet */
.notice-sheet {
  background: #ffffff;
  border: 2px solid #000;
  padding: 3rem;
  margin: 1.5rem 0;
  font-family: var(--font-serif);
  line-height: 1.6;
}

/* Print Specific Rules */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .top-header,
  .nav-bar,
  .header-actions,
  .no-print,
  .btn,
  .modal-backdrop {
    display: none !important;
  }

  .main-wrapper {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .tab-pane {
    display: none !important;
  }

  .tab-pane.print-active {
    display: block !important;
  }

  .document-container {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
    font-size: 11pt !important;
  }

  .doc-section {
    page-break-inside: avoid;
  }

  .signature-grid {
    page-break-inside: avoid;
  }

  /* Receipt Printing Mode */
  body.printing-receipt .modal-backdrop {
    display: block !important;
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
  }
  body.printing-receipt .modal-box {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    padding: 0 !important;
  }
  body.printing-receipt #printable-deposit-slip {
    margin: 0 !important;
    padding: 2rem !important;
    border: 2px solid #000 !important;
    page-break-inside: avoid;
  }
  body.printing-receipt .main-wrapper,
  body.printing-receipt .nav-bar,
  body.printing-receipt .top-header,
  body.printing-receipt .modal-header,
  body.printing-receipt .modal-footer {
    display: none !important;
  }
}

/* Role Visibility Controls */
body.role-tenant .landlord-only {
  display: none !important;
}
body.role-admin .tenant-only {
  display: none !important;
}

/* Notification Drawer & Electronic Documents */
.notif-item {
  padding: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  background: #f8fafc;
  transition: background 0.2s ease;
}
.notif-item.unread {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
}
.notif-item:hover {
  background: #f1f5f9;
}
.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.25rem;
}
.notif-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: #0f172a;
}
.notif-time {
  font-size: 0.7rem;
  color: #64748b;
}
.notif-body {
  font-size: 0.8rem;
  color: #334155;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}
.notif-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: #64748b;
}

/* =========================================================================
   AUTHENTICATION GATE SCREEN (STRICT PRIVACY / ZERO PUBLIC EXPOSURE)
   ========================================================================= */
#auth-gate-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 20%, #172554 0%, #0b1329 70%, #020617 100%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
}

.auth-gate-card {
  width: 100%;
  max-width: 440px;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 14px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 40px rgba(14, 165, 233, 0.08);
  padding: 2.25rem 2rem;
  color: #f8fafc;
}

.auth-gate-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.auth-gate-title {
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.auth-gate-subtitle {
  font-size: 0.85rem;
  color: #94a3b8;
  text-align: center;
  margin-bottom: 1.75rem;
  line-height: 1.4;
}

.auth-gate-card .form-group {
  margin-bottom: 1.25rem;
}

.auth-gate-card label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-gate-card .form-control {
  background: #1e293b;
  border: 1px solid #334155;
  color: #ffffff;
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  width: 100%;
  transition: all 0.2s ease;
}

.auth-gate-card .form-control:focus {
  border-color: #38bdf8;
  background: #0f172a;
  outline: none;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.auth-gate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 8px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}
.auth-gate-btn:hover {
  background: #1d4ed8;
}
.auth-gate-btn:active {
  transform: translateY(1px);
}

.auth-gate-footer {
  margin-top: 1.75rem;
  text-align: center;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.4;
}


