/* =============================================
   ROOM RENTAL MANAGEMENT - DESIGN SYSTEM
   Premium Dark Glassmorphism Theme
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-primary: #06091a;
  --bg-secondary: #0d1230;
  --bg-card: rgba(22, 36, 80, 0.4);
  --bg-card-solid: #0d1433;
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-hover: rgba(79, 142, 247, 0.08);

  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(79, 142, 247, 0.4);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);

  --accent-1: #4facfe;
  --accent-2: #00f2fe;
  --accent-blue: #4f8ef7;
  --accent-grad: linear-gradient(135deg, #4f8ef7, #7c5cfc);
  --accent-grad-hover: linear-gradient(135deg, #6aa3ff, #9775ff);

  --success: #00d2ff; /* Cyan-blue success */
  --success-real: #22d3a0;
  --success-bg: rgba(34, 211, 160, 0.08);
  --warning: #f6a820;
  --warning-bg: rgba(246, 168, 32, 0.08);
  --danger: #ff5e7e;
  --danger-bg: rgba(255, 94, 126, 0.08);
  --info: #4f8ef7;
  --info-bg: rgba(79, 142, 247, 0.1);

  --text-primary: #ffffff;
  --text-secondary: #a0aec0;
  --text-muted: #4a5568;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --sidebar-w: 280px;
  --header-h: 72px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
}

img {
  max-width: 100%;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  display: none;
}

* {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Hide scrollbars but keep functionality */
.modal::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  display: none;
}

.modal,
.table-wrap {
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
}

/* =============================================
   ANIMATED BACKGROUND
   ============================================= */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.app-bg::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(79, 142, 247, 0.12) 0%, transparent 70%);
  top: -200px;
  left: -200px;
  animation: orb1 18s ease-in-out infinite;
}

.app-bg::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(124, 92, 252, 0.1) 0%, transparent 70%);
  bottom: -150px;
  right: -100px;
  animation: orb2 22s ease-in-out infinite;
}

@keyframes orb1 {

  0%,
  100% {
    transform: translate(0, 0)
  }

  50% {
    transform: translate(80px, 60px)
  }
}

@keyframes orb2 {

  0%,
  100% {
    transform: translate(0, 0)
  }

  50% {
    transform: translate(-60px, -40px)
  }
}

/* =============================================
   AUTH / LOGIN PAGE
   ============================================= */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  z-index: 1;
}

.auth-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  animation: fadeUp 0.5s ease both;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: var(--accent-grad);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
  box-shadow: 0 8px 24px rgba(79, 142, 247, 0.4);
}

.auth-logo h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.auth-logo p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.role-tabs {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 28px;
}

.role-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.role-tab.active {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 142, 247, 0.3);
}

/* =============================================
   LOCK SCREEN
   ============================================= */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 24px 0;
}

.pin-dots .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px solid var(--glass-border);
  transition: all 0.2s;
}

.pin-dots .dot.filled {
  background: var(--accent-1);
  border-color: var(--accent-1);
  box-shadow: 0 0 10px rgba(79, 142, 247, 0.4);
}

.pin-dots.error {
  animation: shake 0.4s ease-in-out;
}

.pin-dots.error .dot {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  box-shadow: 0 0 10px rgba(240, 92, 122, 0.4) !important;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-8px);
  }

  50% {
    transform: translateX(8px);
  }

  75% {
    transform: translateX(-8px);
  }
}

.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 260px;
  margin: 0 auto;
}

.numpad-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-size: 24px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  transition: all 0.2s;
}

.numpad-btn:hover,
.numpad-btn:active {
  background: var(--bg-hover);
  transform: scale(0.95);
}

.btn-fingerprint {
  color: var(--accent-1) !important;
  background: rgba(79, 142, 247, 0.1) !important;
  border-color: rgba(79, 142, 247, 0.3) !important;
}

/* =============================================
   FORM ELEMENTS
   ============================================= */
.form-group {
  margin-bottom: 18px;
}

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

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 12px 16px;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-1);
  background: var(--bg-hover);
  box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.12);
}

.form-select {
  -webkit-appearance: none;
  appearance: none;
}

.form-select option {
  background: var(--bg-card-solid);
  color: var(--text-primary);
}

.form-textarea {
  resize: vertical;
  min-height: 90px;
}

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

.input-icon-wrap .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.input-icon-wrap .form-input {
  padding-left: 42px;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: var(--transition);
}

.btn:hover::after {
  background: rgba(255, 255, 255, 0.08);
}

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 4px 16px rgba(79, 142, 247, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 8px 24px rgba(79, 142, 247, 0.5);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-success {
  background: linear-gradient(135deg, #1db88a, #22d3a0);
  color: #fff;
  box-shadow: 0 4px 12px rgba(34, 211, 160, 0.3);
}

.btn-success:hover {
  box-shadow: 0 8px 20px rgba(34, 211, 160, 0.5);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #e04060, #f05c7a);
  color: #fff;
}

.btn-danger:hover {
  transform: translateY(-1px);
}

.btn-warning {
  background: linear-gradient(135deg, #d4900a, #f6a820);
  color: #fff;
}

.btn-warning:hover {
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: #a0aec0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
}

.btn-lg {
  padding: 15px 32px;
  font-size: 16px;
}

.btn-full {
  width: 100%;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Razorpay button */
.btn-pay {
  background: linear-gradient(135deg, #097eff, #0052cc);
  color: #fff;
  box-shadow: 0 4px 16px rgba(9, 126, 255, 0.4);
}

.btn-pay:hover {
  box-shadow: 0 8px 24px rgba(9, 126, 255, 0.6);
  transform: translateY(-1px);
}

/* =============================================
   LAYOUT - SIDEBAR + MAIN
   ============================================= */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: rgba(10, 15, 40, 0.7);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid var(--glass-border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 42px;
  height: 42px;
  background: var(--accent-grad);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(79, 142, 247, 0.35);
}

.sidebar-logo h2 {
  font-size: 16px;
  font-weight: 700;
}

.sidebar-logo span {
  font-size: 11px;
  color: var(--text-secondary);
  display: block;
}

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-info .name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info .role {
  font-size: 11px;
  color: var(--text-secondary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 8px 20px 4px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: var(--transition);
  border-radius: 0;
  position: relative;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  color: var(--accent-1);
  background: rgba(79, 142, 247, 0.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--accent-grad);
  border-radius: 0 3px 3px 0;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  background: var(--danger);
  color: #fff;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--glass-border);
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* TOP HEADER */
.top-header {
  height: var(--header-h);
  background: rgba(6, 9, 26, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  flex: 1;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* PAGE CONTENT */
.page-content {
  padding: 28px;
  flex: 1;
  animation: fadeUp 0.35s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =============================================
   CARDS
   ============================================= */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.card:hover {
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow-card), 0 0 20px rgba(79, 142, 247, 0.08);
}

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

.card-title {
  font-size: 16px;
  font-weight: 700;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* STAT CARDS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  animation: slideUp 0.5s ease backwards;
}

.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.2s; }
.stat-card:nth-child(4) { animation-delay: 0.3s; }
.stat-card:nth-child(5) { animation-delay: 0.4s; }

.stat-card:hover {
  transform: translateY(-5px);
  border-color: var(--glass-border-hover);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.stat-card .stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 24px;
  background: var(--bg-input);
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.05);
}

.stat-card .stat-value {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.stat-card .stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.stat-card .stat-change {
  font-size: 11px;
  margin-top: 8px;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.07;
}

.stat-blue .stat-icon {
  background: var(--info-bg);
  color: var(--info);
}

.stat-blue::after {
  background: var(--accent-1);
}

.stat-green .stat-icon {
  background: var(--success-bg);
  color: var(--success);
}

.stat-green::after {
  background: var(--success);
}

.stat-yellow .stat-icon {
  background: var(--warning-bg);
  color: var(--warning);
}

.stat-yellow::after {
  background: var(--warning);
}

.stat-red .stat-icon {
  background: var(--danger-bg);
  color: var(--danger);
}

.stat-red::after {
  background: var(--danger);
}

/* =============================================
   TABLES
   ============================================= */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: rgba(79, 142, 247, 0.08);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-hover);
}

/* =============================================
   BADGES & STATUS
   ============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
}

.badge-muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

/* =============================================
   MODAL
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none; /* Changed from display: flex to none */
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: var(--transition);
}

.modal-overlay.open {
  display: flex; /* Show when open */
  opacity: 1;
}

.modal {
  background: var(--bg-card-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  transform: scale(0.95) translateY(20px);
  transition: var(--transition);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px;
  border-bottom: 1px solid var(--glass-border);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: var(--bg-input);
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.modal-body {
  padding: 28px;
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 20px 28px;
  border-top: 1px solid var(--glass-border);
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */
#toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card-solid);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 500;
  width: 300px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-card);
  animation: toastIn 0.3s ease;
  pointer-events: all;
}

.toast.hide {
  animation: toastOut 0.3s ease forwards;
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-error {
  border-left: 3px solid var(--danger);
}

.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast-info {
  border-left: 3px solid var(--info);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* =============================================
   GRIDS & HELPERS
   ============================================= */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.mb-1 {
  margin-bottom: 8px;
}

.mb-2 {
  margin-bottom: 16px;
}

.mb-3 {
  margin-bottom: 24px;
}

.mb-4 {
  margin-bottom: 32px;
}

.mt-2 {
  margin-top: 16px;
}

.text-sm {
  font-size: 12px;
}

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

.text-right {
  text-align: right;
}

.font-bold {
  font-weight: 700;
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.text-accent {
  color: var(--accent-1);
}

.text-lg {
  font-size: 18px;
}

.text-xl {
  font-size: 22px;
}

/* DIVIDER */
.divider {
  height: 1px;
  background: var(--glass-border);
  margin: 20px 0;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 14px;
  max-width: 300px;
  margin: 0 auto;
}

/* BILL DETAIL BOX */
.bill-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 14px;
}

.bill-line:last-child {
  border-bottom: none;
}

.bill-total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-1);
  border-top: 2px solid var(--glass-border);
  margin-top: 8px;
}

/* CREDENTIAL BOX (shown after adding tenant) */
.credential-box {
  background: rgba(34, 211, 160, 0.07);
  border: 1px solid rgba(34, 211, 160, 0.25);
  border-radius: var(--radius-md);
  padding: 20px;
}

.credential-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

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

.credential-value {
  font-family: monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--success);
  background: var(--success-bg);
  padding: 4px 12px;
  border-radius: 6px;
}

/* RECEIPT */
.receipt-paper {
  background: #fff;
  color: #111;
  border-radius: var(--radius-md);
  padding: 28px;
  font-size: 13px;
  line-height: 1.8;
}

.receipt-paper h2 {
  font-size: 18px;
  text-align: center;
  margin-bottom: 4px;
}

.receipt-paper .receipt-sub {
  text-align: center;
  color: #555;
  font-size: 12px;
  margin-bottom: 16px;
}

.receipt-paper hr {
  border: none;
  border-top: 1px dashed #ccc;
  margin: 12px 0;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
}

.receipt-total {
  font-weight: 700;
  font-size: 16px;
  border-top: 2px solid #111;
  padding-top: 8px;
  margin-top: 4px;
}

.receipt-footer {
  text-align: center;
  color: #888;
  font-size: 11px;
  margin-top: 12px;
}

/* PAGE HIDE/SHOW */
.page {
  display: none;
}

.page.active {
  display: block;
}

.app-section {
  display: none;
}

.app-section.active {
  display: flex;
}

/* =============================================
   RESPONSIVE
   ============================================= */
.mobile-only {
  display: none;
}

.btn-menu {
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.btn-menu:hover {
  color: var(--accent-1);
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    border-right: 1px solid var(--glass-border);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  /* No changes needed for stats-grid here as handled above */

  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }

  .mobile-only {
    display: flex !important;
  }

  .top-header {
    padding: 0 16px;
    height: 70px;
  }

  /* Header alignment fixes for mobile */
  .flex.justify-between.items-center {
    flex-wrap: wrap;
    gap: 12px;
  }

  .search-bar {
    flex: 1;
    min-width: 200px;
    height: 44px;
  }

  .btn-primary {
    white-space: nowrap;
    padding: 10px 16px;
    height: 44px; /* Align with search bar height */
  }
}

@media (max-width: 768px) {
  /* PREMIUM MOBILE TABLE CARDS */
  table, thead, tbody, th, td, tr {
    display: block;
    width: 100%;
  }

  thead { display: none; }

  tr {
    margin-bottom: 20px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 8px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }

  td {
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    position: relative;
    padding: 12px 16px 12px 42%;
    text-align: right;
    min-height: 46px;
    font-size: 13px;
  }

  td:last-child { border-bottom: none; }

  td::before {
    content: attr(data-label);
    position: absolute;
    left: 16px;
    top: 12px;
    width: 35%;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  td .flex.gap-2 {
    justify-content: flex-end;
  }

  .btn-sm {
    padding: 6px 10px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 32px 20px;
    border-radius: var(--radius-lg);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-card .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
    margin-bottom: 12px;
  }

  .stat-card .stat-value {
    font-size: 20px;
  }

  .page-content {
    padding: 16px;
  }

  .top-header {
    height: 64px;
  }

  .page-title {
    font-size: 18px;
  }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* MODAL REFINEMENTS */
@media (max-width: 600px) {
  .modal {
    margin: 0;
    max-height: 95vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    position: fixed;
    bottom: 0;
    transform: translateY(100%);
  }

  .modal-overlay.open .modal {
    transform: translateY(0);
  }

  .modal-header {
    padding: 16px 20px;
  }

  .modal-body {
    padding: 20px;
  }

  .modal-footer {
    padding: 16px 20px;
    display: flex;
    flex-direction: row; /* Horizontal side-by-side */
    gap: 12px;
  }

  .modal-footer .btn {
    flex: 1; /* Equal width */
    justify-content: center;
  }
}

/* Touch Target Improvements */
.btn, .nav-item, .modal-close {
  min-height: 44px;
}

select, input, textarea {
  font-size: 16px !important; /* Prevents iOS auto-zoom and better for Android */
}

/* Auth Card Polishing */
.auth-container {
  padding: 16px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

/* LOADING SPINNER */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

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

/* PROGRESS BAR */
.progress-bar-wrap {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 20px;
  height: 8px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 20px;
  background: var(--accent-grad);
  transition: width 0.6s ease;
}

/* TABS */
.tab-bar {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn.active {
  background: var(--accent-grad);
  color: #fff;
}

.tab-btn svg {
  width: 14px;
  height: 14px;
}

/* SEARCH BAR */
.search-bar {
  position: relative;
  max-width: 300px;
}

.search-bar svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.search-bar input {
  padding-left: 38px;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 10px 16px 10px 38px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}

.search-bar input:focus {
  border-color: var(--accent-1);
}