/* ==========================================================================
   VENETIA HEIGHTS SOCIETY MANAGEMENT - PROFESSIONAL ENTERPRISE DESIGN SYSTEM
   ========================================================================== */

:root {
  /* Restored Previous Theme Color Palette (Deep HSL Navy & Ambient Glows) */
  --bg-primary: hsl(222, 47%, 7%);
  --bg-secondary: hsl(222, 47%, 11%);
  --surface-card: hsla(222, 47%, 13%, 0.82);
  --surface-hover: hsla(222, 47%, 18%, 0.85);
  --surface-border: hsla(222, 47%, 30%, 0.4);
  --surface-border-focus: hsl(217, 91%, 60%);

  /* Accent & Utility Tokens */
  --primary-brand: hsl(217, 91%, 60%); /* Executive Royal Blue */
  --primary-hover: hsl(217, 91%, 50%);
  --accent-teal: hsl(168, 76%, 36%);
  --danger-crimson: #E11D48;
  --warning-amber: #F59E0B;
  --success-emerald: #10B981;

  /* Text Colors */
  --text-main: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;

  /* Typography */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Elevation & Structure */
  --shadow-lg: 0 20px 45px -10px rgba(0, 0, 0, 0.65), 0 0 1px 1px rgba(148, 163, 184, 0.1);
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 8px;
  --radius-sm: 6px;

  /* Motion */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   AMBIENT GLOW SYSTEM (RESTORED PREVIOUS THEME BACKGROUND)
   ========================================================================== */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  animation: float-glow 20s infinite alternate ease-in-out;
}

.glow-emerald {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, hsl(160, 84%, 39%), transparent 70%);
  top: -100px;
  left: -100px;
}

.glow-azure {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, hsl(217, 91%, 60%), transparent 70%);
  bottom: -120px;
  right: -120px;
  animation-delay: -5s;
}

.glow-amber {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, hsl(38, 92%, 50%), transparent 70%);
  top: 40%;
  right: -80px;
  opacity: 0.15;
  animation-delay: -10s;
}

@keyframes float-glow {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.08); }
  100% { transform: translate(-20px, 30px) scale(0.95); }
}

/* ==========================================================================
   MAIN VIEWPORT & CONTAINERS
   ========================================================================== */
.viewport {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .viewport {
    max-width: 620px;
    padding: 40px 24px;
  }
}

.card {
  background: var(--surface-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-lg);
}

.view {
  transition: opacity 0.3s var(--ease-smooth);
  width: 100%;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hidden-view {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

.active-view {
  display: flex;
  opacity: 1;
}

/* ==========================================================================
   VIEW 1: AUTHENTICATION PORTAL
   ========================================================================== */
.brand-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo-container {
  width: 80px;
  height: 80px;
  margin: 0 auto 18px;
  background: #ffffff;
  border-radius: 50%;
  padding: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface-border);
}

.brand-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.brand-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.status-badge {
  display: inline-block;
  margin-top: 14px;
  background: rgba(37, 99, 235, 0.15);
  color: #60A5FA;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(59, 130, 246, 0.35);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ==========================================================================
   FORM CONTROLS & PROFESSIONAL INPUTS
   ========================================================================== */
.input-group {
  margin-bottom: 20px;
}

.label-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.label-header .input-label {
  margin-bottom: 0;
}

.tag-required {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  z-index: 2;
  transition: color 0.2s;
}

.form-input {
  width: 100%;
  background: hsla(222, 47%, 10%, 0.85);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 13px 14px 13px 44px;
  color: var(--text-main);
  font-size: 15px;
  font-family: var(--font-body);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  min-height: 48px;
}

.form-input::placeholder {
  color: #64748B;
}

.form-input:focus {
  border-color: var(--surface-border-focus);
  background: hsla(222, 47%, 8%, 0.95);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-input:focus ~ .input-icon,
.form-input:not(:placeholder-shown) ~ .input-icon {
  color: #CBD5E1;
}

.form-input.error {
  border-color: var(--danger-crimson);
}

.btn-icon {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s;
}

.btn-icon:hover {
  color: var(--text-main);
}

.text-uppercase {
  text-transform: uppercase;
}

.unit-suffix {
  position: absolute;
  right: 14px;
  background: hsla(222, 47%, 18%, 0.9);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  border: 1px solid var(--surface-border);
}

.number-input {
  padding-right: 75px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 17px;
  color: #10B981;
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ==========================================================================
   BUTTONS & ACTIONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  min-height: 48px;
  transition: all 0.2s var(--ease-smooth);
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background-color: var(--primary-brand);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.45);
}

.btn-outline-danger {
  background: transparent;
  color: #F43F5E;
  border: 1px solid rgba(244, 63, 94, 0.35);
  padding: 6px 14px;
  min-height: 36px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-outline-danger:hover {
  background: rgba(244, 63, 94, 0.12);
  border-color: #F43F5E;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   AUTH OPTIONS
   ========================================================================== */
.auth-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 13px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--primary-brand);
  width: 16px;
  height: 16px;
}

.encryption-notice {
  font-size: 12px;
  color: var(--text-muted);
}

.security-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ==========================================================================
   VIEW 2: DASHBOARD & MODULE NAVIGATION
   ========================================================================== */
.navbar {
  position: sticky;
  top: 12px;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  background: hsla(222, 47%, 12%, 0.88);
  backdrop-filter: blur(25px);
  border: 1px solid var(--surface-border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0; /* Allows clean text wrapping on mobile */
  margin-right: 10px;
}

.nav-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #ffffff;
  padding: 3px;
  border: 1px solid var(--surface-border);
  flex-shrink: 0;
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.navbar-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-main);
  line-height: 1.25;
  letter-spacing: -0.2px;
}

.user-name {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  color: var(--primary-brand);
  margin-top: 3px;
}

.header-controls {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* ==========================================================================
   MODULE RIBBON
   ========================================================================== */
.module-ribbon {
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.module-scroller {
  display: flex;
  gap: 8px;
  min-width: max-content;
}

.module-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: hsla(222, 47%, 14%, 0.6);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s var(--ease-smooth);
}

.module-tab.active {
  background: rgba(37, 99, 235, 0.2);
  border-color: var(--primary-brand);
  color: #ffffff;
}

.module-tab.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.mod-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
}

.mod-badge.active-tag {
  background: var(--primary-brand);
  color: #ffffff;
}

/* ==========================================================================
   ELECTRICITY RECORDING MODULE
   ========================================================================== */
.form-card {
  margin-bottom: 24px;
}

.form-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--surface-border);
}

.form-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(37, 99, 235, 0.18);
  color: var(--primary-brand);
  border: 1px solid rgba(37, 99, 235, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.form-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.2;
}

.form-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Quick Tower Selection Chips */
.quick-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.chip-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.btn-chip {
  background: hsla(222, 47%, 16%, 0.8);
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-chip:hover, .btn-chip:active {
  background: rgba(37, 99, 235, 0.25);
  border-color: var(--primary-brand);
  color: #ffffff;
}

/* Calendar Theme Control */
.calendar-theme-group {
  position: relative;
}

.btn-pill-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: hsla(222, 47%, 16%, 0.9);
  color: var(--text-secondary);
  border: 1px solid var(--surface-border);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-pill-action:hover {
  background: rgba(37, 99, 235, 0.2);
  border-color: var(--primary-brand);
  color: #ffffff;
}

.date-input {
  cursor: pointer;
  color: var(--text-main);
  font-family: var(--font-body);
  font-weight: 500;
  width: 100%;
}

/* Ensure Native Date Calendar Picker Indicator is bright, clean, and clickable on Desktop Browsers */
.date-input::-webkit-calendar-picker-indicator {
  filter: invert(1);
  opacity: 0.85;
  cursor: pointer;
  padding: 4px;
  margin-right: 2px;
  transition: opacity 0.2s, transform 0.2s;
}

.date-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Professional Calendar Preview Badge (Clickable on desktop) */
.calendar-preview {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: hsla(222, 47%, 9%, 0.7);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  transition: all 0.2s;
}

.calendar-preview.clickable-calendar {
  cursor: pointer;
}

.calendar-preview.clickable-calendar:hover {
  border-color: var(--primary-brand);
  background: hsla(222, 47%, 14%, 0.8);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  transform: translateY(-1px);
}

.calendar-preview.selected {
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(37, 99, 235, 0.08);
}

.cal-sheet-icon {
  width: 48px;
  height: 52px;
  background: #0B1120;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--primary-brand);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.cal-month {
  background: var(--primary-brand);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  padding: 3px 0;
  letter-spacing: 0.5px;
}

.cal-day {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  line-height: 28px;
}

.cal-text {
  display: flex;
  flex-direction: column;
}

.cal-text strong {
  font-size: 14px;
  color: var(--text-main);
}

.cal-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.form-actions {
  margin-top: 28px;
}

.system-status-note {
  margin-top: 16px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* ==========================================================================
   SESSION AUDIT LOG / ACTIVITY FEED
   ========================================================================== */
.history-card {
  padding: 22px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--surface-border);
}

.history-header h3 {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.badge-pill {
  background: hsla(222, 47%, 16%, 0.9);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--surface-border);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.empty-state {
  text-align: center;
  padding: 28px 12px;
  color: var(--text-muted);
}

.empty-icon {
  color: var(--text-muted);
  display: block;
  margin: 0 auto 10px;
  opacity: 0.5;
}

.log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: hsla(222, 47%, 11%, 0.7);
  border: 1px solid var(--surface-border);
  border-left: 4px solid var(--primary-brand);
  border-radius: var(--radius-sm);
  transition: transform 0.2s;
}

.log-details {
  display: flex;
  flex-direction: column;
}

.log-flat {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
}

.log-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.log-unit-pill {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   PROFESSIONAL FOOTER
   ========================================================================== */
.portal-footer {
  margin-top: 48px;
  padding-top: 20px;
}

.footer-divider {
  height: 1px;
  background: var(--surface-border);
  margin-bottom: 24px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

@media (min-width: 640px) {
  .footer-content {
    flex-direction: row;
    text-align: left;
  }
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.developer-credit {
  color: var(--text-secondary);
}

.developer-credit strong {
  color: #ffffff;
  font-weight: 600;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.social-link {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px;
  border-radius: var(--radius-sm);
  background: hsla(222, 47%, 14%, 0.6);
  border: 1px solid var(--surface-border);
  transition: all 0.2s;
  text-decoration: none;
}

.social-link:hover {
  color: #ffffff;
  background: rgba(37, 99, 235, 0.25);
  border-color: var(--primary-brand);
  transform: translateY(-2px);
}

/* ==========================================================================
   ENTERPRISE TOAST NOTIFICATION SYSTEM
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 440px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: hsl(222, 47%, 11%);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.75);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.3s var(--ease-smooth);
}

.toast.removing {
  opacity: 0;
  transform: translateY(10px) scale(0.95);
}

.toast.success { border-left: 4px solid var(--success-emerald); color: #ffffff; }
.toast.error { border-left: 4px solid var(--danger-crimson); color: #ffffff; }
.toast.warning { border-left: 4px solid var(--warning-amber); color: #ffffff; }

.toast-icon-box {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast.success .toast-icon-box { color: var(--success-emerald); }
.toast.error .toast-icon-box { color: var(--danger-crimson); }
.toast.warning .toast-icon-box { color: var(--warning-amber); }

.toast-message {
  flex-grow: 1;
  line-height: 1.4;
}
