/* 925 Tenant Portal - Main Styles */
/* Based on 925 brand styling guide */

/* ============================================================================
   CSS VARIABLE DEFINITIONS - LIGHT MODE
   ============================================================================ */

:root {
  /* 925 Brand Colors */
  --brand-black-coffee: 340 51% 13%;     /* #32101B - Deep coffee brown */
  --brand-lava-lamp: 20 100% 50%;        /* #FF5500 - Vibrant orange */
  --brand-eggshell: 38 49% 89%;          /* #F1E7D6 - Warm beige/cream */
  --brand-lightbulb: 46 100% 65%;        /* #FFD64E - Bright yellow */
  --brand-blue-sky: 209 81% 74%;         /* #88BEF2 - Light blue */

  /* Background Colors */
  --background: 38 49% 89%;              /* #F1E7D6 - Main page background (eggshell) */
  --foreground: 340 51% 13%;             /* #32101B - Main text color (coffee) */

  /* Card Colors */
  --card: 0 0% 98%;                      /* #FAFAFA - Card background (nearly white) */
  --card-foreground: 340 51% 13%;        /* #32101B - Card text */
  --card-border: 38 30% 88%;             /* #E8DCC8 - Card border */

  /* Sidebar Colors */
  --sidebar: 38 40% 85%;                 /* #E0D1BB - Sidebar background */
  --sidebar-foreground: 340 51% 13%;     /* #32101B - Sidebar text */
  --sidebar-border: 38 30% 75%;          /* #C9B69A - Sidebar border */
  --sidebar-primary: 340 51% 13%;        /* #32101B - Active sidebar item */
  --sidebar-primary-foreground: 38 49% 89%; /* #F1E7D6 - Active text */
  --sidebar-accent: 38 30% 80%;          /* #D6C5A9 - Sidebar hover */
  --sidebar-accent-foreground: 340 51% 13%; /* #32101B - Hover text */
  --sidebar-ring: 340 51% 13%;           /* #32101B - Focus ring */

  /* Primary Action Colors (Orange/Lava) */
  --primary: 20 100% 50%;                /* #FF5500 - Primary button */
  --primary-foreground: 0 0% 100%;       /* #FFFFFF - Primary button text */

  /* Secondary Colors */
  --secondary: 38 30% 85%;               /* #E0D1BB - Secondary buttons */
  --secondary-foreground: 340 51% 13%;   /* #32101B - Secondary text */

  /* Muted Colors */
  --muted: 38 30% 88%;                   /* #E8DCC8 - Muted backgrounds */
  --muted-foreground: 340 30% 45%;       /* #7A4A56 - Muted text */

  /* Accent Colors (Yellow/Lightbulb) */
  --accent: 46 100% 65%;                 /* #FFD64E - Accent highlights */
  --accent-foreground: 340 51% 13%;      /* #32101B - Accent text */

  /* Destructive/Error Colors */
  --destructive: 0 70% 50%;              /* #D93025 - Error/danger */
  --destructive-foreground: 0 0% 98%;    /* #FAFAFA - Error text */

  /* Input & Border Colors */
  --input: 210 15% 75%;                  /* #B3B8BD - Input borders */
  --border: 38 30% 80%;                  /* #D6C5A9 - General borders */
  --ring: 220 85% 15%;                   /* #061938 - Focus ring color */

  /* Elevation & Interaction */
  --button-outline: rgba(0, 0, 0, 0.10);
  --elevate-1: rgba(0, 0, 0, 0.03);
  --elevate-2: rgba(0, 0, 0, 0.08);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: Georgia, serif;
  --font-mono: Menlo, Monaco, 'Courier New', monospace;

  /* Font Sizes */
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1rem;       /* 16px */
  --font-size-lg: 1.125rem;     /* 18px */
  --font-size-xl: 1.25rem;      /* 20px */
  --font-size-2xl: 1.5rem;      /* 24px */
  --font-size-3xl: 1.875rem;    /* 30px */
  --font-size-4xl: 2.25rem;     /* 36px */
  --font-size-5xl: 3rem;        /* 48px */

  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* Spacing */
  --spacing-1: 0.25rem;         /* 4px */
  --spacing-2: 0.5rem;          /* 8px */
  --spacing-3: 0.75rem;         /* 12px */
  --spacing-4: 1rem;            /* 16px */
  --spacing-5: 1.25rem;         /* 20px */
  --spacing-6: 1.5rem;          /* 24px */
  --spacing-8: 2rem;            /* 32px */
  --spacing-10: 2.5rem;         /* 40px */
  --spacing-12: 3rem;           /* 48px */
  --spacing-16: 4rem;           /* 64px */
  --spacing-20: 5rem;           /* 80px */
  --spacing-24: 6rem;           /* 96px */

  /* Border Radius */
  --radius-sm: 0.1875rem;       /* 3px */
  --radius-md: 0.375rem;        /* 6px */
  --radius-lg: 0.5625rem;       /* 9px */
  --radius-xl: 1rem;            /* 16px */
  --radius-2xl: 1.5rem;         /* 24px */
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0px 1px 3px 0px rgba(0, 0, 0, 0.1), 0px 1px 2px 0px rgba(0, 0, 0, 0.06);
  --shadow-sm: 0px 2px 4px -1px rgba(0, 0, 0, 0.06), 0px 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0px 6px 16px -4px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0px 10px 24px -4px rgba(0, 0, 0, 0.1), 0px 8px 16px -6px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0px 20px 32px -8px rgba(0, 0, 0, 0.12), 0px 12px 24px -6px rgba(0, 0, 0, 0.08);

  /* Transitions */
  --transition-fast: 150ms;
  --transition-base: 250ms;
  --transition-slow: 350ms;
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */

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

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: hsl(var(--foreground));
  background-color: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: hsl(var(--foreground));
  margin-bottom: 1rem;
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

/* Page Title - Standardized class for all main page headings */
.page-title {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-2);
  color: hsl(var(--foreground));
  text-transform: capitalize;
}

a {
  color: hsl(var(--primary));
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: hsl(var(--brand-lava-lamp));
  text-decoration: underline;
}

/* ============================================================================
   LAYOUT COMPONENTS
   ============================================================================ */

.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--spacing-4);
  padding-right: var(--spacing-4);
}

.container-narrow {
  max-width: 800px;
}

.container-wide {
  max-width: 1400px;
}

/* ============================================================================
   HEADER & NAVIGATION
   ============================================================================ */

.site-header {
  background-color: hsl(var(--background));
  border-bottom: 1px solid hsl(var(--border));
  padding: var(--spacing-4) 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-4);
}

.site-logo {
  display: inline-block;
  text-decoration: none;
  transition: opacity var(--transition-base);
}

.site-logo:hover {
  opacity: 0.8;
  text-decoration: none;
}

.logo-image {
  height: 36px;
  width: auto;
  display: block;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: var(--spacing-6);
}

.nav-link {
  color: hsl(var(--foreground));
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  padding: var(--spacing-2) var(--spacing-3);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.nav-link:hover {
  color: hsl(var(--primary));
  background-color: rgba(255, 87, 0, 0.1);
  text-decoration: none;
}

.nav-link.active {
  color: hsl(var(--primary));
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  white-space: nowrap;
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  text-decoration: none;
  border: 1px solid transparent;
  padding: 0.625rem 1.25rem;
  min-height: 2.5rem;
  line-height: 1.5;
}

.btn:hover {
  text-decoration: none;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 87, 0, 0.1);
}

.btn-sm {
  min-height: 2rem;
  padding: 0.5rem 1rem;
  font-size: var(--font-size-xs);
}

.btn-lg {
  min-height: 2.75rem;
  padding: 0.75rem 1.5rem;
  font-size: var(--font-size-base);
}

.btn-primary {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}

.btn-primary:hover {
  background-color: hsl(20 100% 45%);
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-color: hsl(var(--secondary));
}

.btn-secondary:hover {
  background-color: hsl(38 30% 80%);
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
}

.btn-outline:hover {
  background-color: hsl(var(--muted));
  border-color: hsl(var(--foreground));
}

.btn-outline.btn-primary-outline {
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
}

.btn-outline.btn-primary-outline:hover {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================================
   CARDS
   ============================================================================ */

.card {
  border-radius: var(--radius-xl);
  border: 1px solid hsl(var(--card-border));
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: var(--spacing-6);
}

.card-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  margin-bottom: 0;
}

.card-description {
  font-size: var(--font-size-sm);
  color: hsl(var(--muted-foreground));
}

.card-content {
  padding: var(--spacing-6);
  overflow: hidden; /* Prevent content from overflowing card bounds */
}

.card-footer {
  display: flex;
  align-items: center;
  padding: var(--spacing-6);
  padding-top: 0;
  gap: var(--spacing-3);
}

/* ============================================================================
   FORM ELEMENTS
   ============================================================================ */

.form-group {
  margin-bottom: var(--spacing-6);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
}

.form-label,
.form-group label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--spacing-2);
  color: hsl(var(--foreground));
}

.form-group label.checkbox-label {
  display: flex;
  font-weight: var(--font-weight-normal);
  margin-bottom: 0;
}

.form-input,
.form-textarea,
.form-select,
.form-control,
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  height: 2.5rem;
  border-radius: var(--radius-md);
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--card));
  background: white;
  padding: 0.5rem 0.75rem;
  font-size: var(--font-size-base);
  line-height: 1.5;
  font-family: var(--font-sans);
  color: hsl(var(--foreground));
  transition: all var(--transition-base);
}

.form-select,
.form-group select,
select.form-control {
  padding-left: 0.5rem;
  padding-right: 2rem;
}

.form-textarea,
.form-group textarea {
  min-height: 5rem;
  resize: vertical;
  height: auto;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus,
.form-control:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px rgba(255, 87, 0, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder,
.form-control::placeholder,
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: hsl(var(--muted-foreground));
}

/* Help Text */
.form-text {
  display: block;
  margin-top: var(--spacing-2);
  font-size: var(--font-size-sm);
  line-height: 1.4;
}

.form-text.text-muted {
  color: hsl(var(--muted-foreground));
}

/* Error Messages */
.error-message {
  color: hsl(var(--destructive));
  font-size: var(--font-size-sm);
  margin-top: var(--spacing-2);
  display: block;
  font-weight: 500;
}

/* Toggle Link - Used for switching between form modes */
.toggle-link {
  margin-left: 1rem;
  font-size: 0.875rem;
  background: none;
  border: none;
  color: hsl(var(--primary));
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.toggle-link::before {
  content: '⇄';
  font-size: 1rem;
  font-weight: bold;
}

.toggle-link:hover {
  background-color: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.toggle-link:active {
  background-color: hsl(var(--primary) / 0.2);
  transform: scale(0.98);
}

.toggle-link:focus {
  outline: 2px solid hsl(var(--primary) / 0.3);
  outline-offset: 2px;
}

/* ============================================================================
   SIDEBAR
   ============================================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 16rem;
  background-color: hsl(var(--sidebar));
  border-right: 1px solid hsl(var(--sidebar-border));
  padding: var(--spacing-6);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: hsl(var(--brand-lava-lamp));
  margin-bottom: var(--spacing-8);
  text-decoration: none;
  display: block;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  /* gap: var(--spacing-2); */
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-3) var(--spacing-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: hsl(var(--sidebar-foreground));
  text-decoration: none;
  transition: all var(--transition-base);
}

.sidebar-nav-item:hover {
  background-color: hsl(var(--sidebar-accent));
  color: hsl(var(--sidebar-accent-foreground));
  text-decoration: none;
}

.sidebar-nav-item.active {
  background-color: transparent;
  color: hsl(var(--sidebar-primary));
  font-weight: var(--font-weight-semibold);
}

.sidebar-nav-item svg,
.sidebar-nav-item i {
  width: 1.25rem;
  height: 1.25rem;
}

.main-content {
  margin-left: 16rem;
  flex: 1;
  padding: var(--spacing-8);
  width: calc(100% - 16rem);
  overflow-x: hidden; /* Prevent content from causing horizontal scroll */
}

/* ============================================================================
   GRID SYSTEM
   ============================================================================ */

.grid {
  display: grid;
  gap: var(--spacing-6);
}

/* Prevent grid children from overflowing their column */
.grid > * {
  min-width: 0;
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

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

.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }

.font-light { font-weight: var(--font-weight-light); }
.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

.text-muted { color: hsl(var(--muted-foreground)); }
.text-primary { color: hsl(var(--primary)); }

.mb-2 { margin-bottom: var(--spacing-2); }
.mb-4 { margin-bottom: var(--spacing-4); }
.mb-6 { margin-bottom: var(--spacing-6); }
.mb-8 { margin-bottom: var(--spacing-8); }

.mt-2 { margin-top: var(--spacing-2); }
.mt-4 { margin-top: var(--spacing-4); }
.mt-6 { margin-top: var(--spacing-6); }
.mt-8 { margin-top: var(--spacing-8); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--spacing-2); }
.gap-4 { gap: var(--spacing-4); }
.gap-6 { gap: var(--spacing-6); }

/* ============================================================================
   HERO SECTION
   ============================================================================ */

.hero {
  padding: var(--spacing-24) 0;
  text-align: center;
}

.hero-title {
  font-size: var(--font-size-5xl);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-6);
  line-height: var(--line-height-tight);
}

.hero-title .highlight {
  color: hsl(var(--brand-lava-lamp));
}

.hero-subtitle {
  font-size: var(--font-size-xl);
  color: hsl(var(--muted-foreground));
  margin-bottom: var(--spacing-8);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-cta {
  display: flex;
  gap: var(--spacing-4);
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================================
   FEATURE GRID
   ============================================================================ */

.features {
  padding: var(--spacing-16) 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-6);
  margin-top: var(--spacing-12);
}

.feature-card {
  padding: var(--spacing-8);
  text-align: center;
}

.feature-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto var(--spacing-4);
  color: hsl(var(--primary));
}

.feature-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-3);
}

.feature-description {
  color: hsl(var(--muted-foreground));
  font-size: var(--font-size-sm);
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.site-footer {
  background-color: hsl(var(--foreground));
  color: hsl(var(--background));
  padding: var(--spacing-16) 0 var(--spacing-8);
  margin-top: auto;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-4);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-8);
  margin-bottom: var(--spacing-8);
}

.footer-brand {
  font-size: var(--font-size-5xl);
  font-weight: var(--font-weight-bold);
  color: hsl(var(--brand-lava-lamp));
  line-height: 1;
  margin-bottom: var(--spacing-4);
}

.footer-text {
  color: rgba(255, 255, 255, 0.7);
  line-height: var(--line-height-relaxed);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
}

.footer-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color var(--transition-base);
}

.footer-link:hover {
  color: hsl(var(--brand-lava-lamp));
  text-decoration: none;
}

.footer-divider {
  height: 1px;
  background-color: rgba(255, 255, 255, 0.1);
  margin: var(--spacing-8) 0;
}

.footer-bottom {
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: var(--font-size-sm);
}

/* ============================================================================
   MOBILE HEADER & HAMBURGER MENU
   ============================================================================ */

.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: hsl(var(--sidebar));
  border-bottom: 1px solid hsl(var(--sidebar-border));
  padding: 0 var(--spacing-4);
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
}

.mobile-brand {
  display: inline-block;
  text-decoration: none;
  transition: opacity var(--transition-base);
}

.mobile-brand:hover {
  opacity: 0.8;
}

.mobile-logo-image {
  height: 32px;
  width: auto;
  display: block;
}

.hamburger-menu {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.hamburger-menu span {
  width: 30px;
  height: 3px;
  background-color: hsl(var(--foreground));
  border-radius: 3px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.hamburger-menu.hamburger-open span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.hamburger-menu.hamburger-open span:nth-child(2) {
  opacity: 0;
}

.hamburger-menu.hamburger-open span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* Prevent scrolling when sidebar is open on mobile */
body.sidebar-active {
  overflow: hidden;
}

/* Sidebar overlay to block clicks on main content when sidebar is open */
body.sidebar-active::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1100;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 770px) {
  .mobile-header {
    display: flex;
  }

  .main-nav {
    display: none;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1101;
  }

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

  .main-content {
    margin-left: 0;
    width: 100%;
    padding-top: calc(60px + var(--spacing-8));
  }

  /* Remove hover effects on touch devices */
  .sidebar-nav-item:hover {
    background-color: transparent;
    color: hsl(var(--sidebar-foreground));
  }

  .card:hover {
    box-shadow: var(--shadow-sm);
  }

  .btn-primary:hover {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    box-shadow: none;
    transform: none;
  }

  .btn-secondary:hover {
    background-color: hsl(var(--secondary));
    box-shadow: none;
  }

  .btn-outline:hover {
    background-color: transparent;
    border-color: hsl(var(--border));
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: var(--font-size-3xl);
  }

  .hero-subtitle {
    font-size: var(--font-size-lg);
  }

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

@media (min-width: 769px) and (max-width: 1199px) {
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

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

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

/* ============================================================================
   UNREAD MESSAGE BADGE
   ============================================================================ */

.unread-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-size: 0.75rem;
  font-weight: var(--font-weight-semibold);
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  padding: 0 5px;
  line-height: 1;
  box-shadow: 0 0 0 2px hsl(var(--background));
}

/* ============================================================================
   CHAT SYSTEM
   ============================================================================ */

/* Chat Container */
.chat-container {
  max-width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 4rem);
}

.chat-header {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 8px 8px 0 0;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chat-header h1 {
  font-size: 1.5rem;
  margin: 0;
  color: hsl(var(--foreground));
}

.back-link {
  color: hsl(var(--primary));
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.back-link:hover {
  text-decoration: underline;
}

.chat-header-divider {
  color: hsl(var(--muted-foreground));
}

.tenant-info {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin: 0.25rem 0 0 0;
}

.chat-messages {
  flex: 1;
  background: hsl(var(--background));
  border-left: 1px solid hsl(var(--border));
  border-right: 1px solid hsl(var(--border));
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  max-width: 70%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease-in;
}

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

/* Current user's messages - right aligned, orange background */
.message-current-user {
  align-self: flex-end;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-bottom-right-radius: 4px;
  margin-left: auto;
}

/* Other user's messages - left aligned, white card background */
.message-other-user {
  align-self: flex-start;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  border-bottom-left-radius: 4px;
  margin-right: auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Legacy support for old class names */
.message-tenant {
  align-self: flex-end;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-bottom-right-radius: 4px;
  margin-left: auto;
}

.message-staff {
  align-self: flex-start;
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  border-bottom-left-radius: 4px;
  margin-right: auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Notification styling - visible only to staff */
.message-notification {
  background: hsl(var(--accent) / 0.2);
  border: 1px solid hsl(var(--accent) / 0.4);
  color: hsl(var(--foreground));
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-style: italic;
  text-align: center;
}

/* Direct notification divs (without links) - ensure consistent width and centering */
.chat-messages > .message-notification {
  width: 90% !important;
  max-width: 90% !important;
  min-width: 90% !important;
  align-self: center !important;
}

/* Clickable notification wrapper - ensure it stays centered at 90% width */
.chat-messages > a {
  align-self: center !important;
  width: 90% !important;
  max-width: 90% !important;
  min-width: 90% !important;
  display: block !important;
  text-decoration: none !important;
}

/* Notification divs inside anchor tags - fill 100% of the anchor */
.chat-messages > a > .message-notification {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 100% !important;
  cursor: pointer;
  transition: all var(--transition-base);
  box-sizing: border-box !important;
}

.chat-messages > a > .message-notification:hover {
  background: hsl(var(--accent) / 0.3);
  border-color: hsl(var(--accent) / 0.6);
  transform: scale(1.02);
}

.message-notification .message-content {
  margin: 0 0 0.25rem 0;
  font-weight: 500;
}

.message-notification .message-time {
  font-size: 0.7rem;
  opacity: 0.6;
  font-style: normal;
}

.message-notification::before {
  content: "🔔 ";
  margin-right: 0.25rem;
}

.notification-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: hsl(var(--primary));
  text-decoration: none;
  font-weight: 600;
  font-style: normal;
  transition: color 0.2s;
}

.notification-link:hover {
  color: hsl(var(--primary-foreground));
  text-decoration: underline;
}

.message-content {
  margin: 0 0 0.5rem 0;
  line-height: 1.5;
  white-space: pre-wrap;
}

.message-time {
  font-size: 0.75rem;
  opacity: 0.7;
}

.message-other-user .message-time {
  color: hsl(var(--muted-foreground));
}

/* Legacy support */
.message-staff .message-time {
  color: hsl(var(--muted-foreground));
}

.chat-input-container {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 0 0 8px 8px;
  padding: 1rem 1.5rem;
  border-top: 1px solid hsl(var(--border));
}

.chat-input-form {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
}

.chat-input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsla(var(--primary) / 0.1);
}

.btn-send {
  min-height: 2.75rem;
  padding: 0.75rem 1.5rem;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: 1px solid hsl(var(--primary));
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-send:hover {
  background: hsl(20 100% 45%);
  color: hsl(var(--primary-foreground));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-send:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: hsl(var(--muted-foreground));
}

.empty-state p {
  margin: 0.5rem 0;
}

.error-message {
  background: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}

/* Staff Chat List */
.chat-list-container {
  max-width: 100%;
  margin: 0;
  padding: 0;
}

.chat-list-header {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: 8px 8px 0 0;
  padding: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

.chat-list-header h1 {
  font-size: 1.75rem;
  margin: 0 0 0.5rem 0;
  color: hsl(var(--foreground));
}

.chat-list-subtitle {
  color: hsl(var(--muted-foreground));
  margin: 0;
}

.chat-list {
  background: hsl(var(--card));
  border-left: 1px solid hsl(var(--border));
  border-right: 1px solid hsl(var(--border));
  border-bottom: 1px solid hsl(var(--border));
  border-radius: 0 0 8px 8px;
}

.chat-item {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  text-decoration: none;
  color: hsl(var(--foreground));
  transition: background 0.2s;
  cursor: pointer;
}

.chat-item:hover {
  background: hsl(var(--muted) / 0.5);
}

.chat-item:last-child {
  border-bottom: none;
}

.chat-item-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.25rem;
  margin-right: 1rem;
  flex-shrink: 0;
}

.chat-item-content {
  flex: 1;
  min-width: 0;
}

.chat-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
}

.chat-item-name {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
}

.chat-item-time {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-left: 1rem;
  white-space: nowrap;
}

.chat-item-preview {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-unread {
  min-width: 24px;
  height: 24px;
  border-radius: 12px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 1rem;
  padding: 0 0.5rem;
}

/* Mobile responsiveness for chat */
@media (max-width: 768px) {
  .chat-container {
    height: calc(100vh - 180px);
  }

  .message {
    max-width: 85%;
  }

  .chat-header h1 {
    font-size: 1.25rem;
  }

  .chat-header {
    flex-wrap: wrap;
  }

  .chat-input-form {
    flex-direction: column;
    gap: 0.5rem;
  }

  .btn-send {
    width: 100%;
  }

  .chat-item {
    padding: 1rem;
  }

  .chat-item-avatar {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .chat-item-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-item-time {
    margin-left: 0;
    margin-top: 0.25rem;
  }

  .chat-list-container {
    margin: 1rem 0.5rem;
  }
}

@media (max-width: 480px) {
  .chat-messages {
    padding: 1rem;
  }

  .message {
    max-width: 90%;
    padding: 0.65rem 0.85rem;
  }
}

/* ============================================================================
   TABLE STYLES
   ============================================================================ */

.table-responsive {
  overflow-x: auto;
}

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

.table thead {
  background: hsl(var(--muted) / 0.5);
}

.table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  border-bottom: 2px solid hsl(var(--border));
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid hsl(var(--border));
}

/* Center align all columns except the first one */
.table th:not(:first-child),
.table td:not(:first-child) {
  text-align: center;
}

.table tbody tr:hover {
  background: hsl(var(--muted) / 0.3);
}

/* ============================================================================
   BADGE STYLES
   ============================================================================ */

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: hsl(145 65% 45% / 0.1);
  color: hsl(145 65% 35%);
}

.badge-warning {
  background: hsl(var(--accent) / 0.1);
  color: hsl(var(--accent));
}

.badge-info {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

/* ============================================================================
   RESPONSIVE TABLE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 768px) {
  .table {
    font-size: 0.875rem;
  }

  .table th,
  .table td {
    padding: 0.5rem;
  }
}

/* ============================================================================
   CALCULATOR COMMON STYLES
   ============================================================================ */

/* Page Header - Standardized for all calculators and services */
.page-header {
  margin-bottom: 2rem;
  text-align: left;
}

.page-header h1 {
  font-size: 2.25rem;
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-2);
  color: hsl(var(--foreground));
}

.page-header p {
  font-size: var(--font-size-base);
  color: hsl(var(--muted-foreground));
  margin-bottom: var(--spacing-6);
  line-height: 1.6;
}

/* Responsive adjustments for page headers */
@media (max-width: 768px) {
  .page-header h1 {
    font-size: 1.75rem;
  }
}

/* Progress Card */
.progress-card {
  margin-bottom: var(--spacing-6);
  padding: var(--spacing-5);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-3);
}

.progress-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: hsl(var(--foreground));
}

.progress-percentage {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: hsl(var(--muted-foreground));
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: hsl(var(--muted));
  border-radius: 12px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, hsl(var(--primary)), hsl(var(--accent)));
  border-radius: 12px;
  transition: width 0.3s ease;
}

/* Form Cards */
.form-card {
  margin-bottom: var(--spacing-4);
}

.card-title .icon {
  color: hsl(var(--primary));
}

/* Form Row for side-by-side inputs */
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-4);
  margin-bottom: 0;
}

.form-row:last-child {
  margin-bottom: 0;
}

/* Checkbox Labels */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-3);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin: 0.125rem 0 0 0;
  flex-shrink: 0;
  cursor: pointer;
}

.checkbox-label span {
  flex: 1;
  font-size: var(--font-size-sm);
  line-height: 1.5;
}

/* Form error states */
.form-errors {
  background: hsl(var(--destructive) / 0.1);
  border: 1px solid hsl(var(--destructive));
  border-radius: 8px;
  padding: var(--spacing-4);
  margin-bottom: var(--spacing-4);
}

.form-group input.error,
.form-group select.error {
  border-color: hsl(var(--destructive));
  background-color: hsl(var(--destructive) / 0.05);
}

.form-group input[readonly] {
  background: hsl(var(--muted));
  cursor: not-allowed;
}

/* Grid Layout for Calculators */
.planner-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-6);
}

@media (min-width: 1024px) {
  .planner-grid {
    grid-template-columns: 2fr 1fr;
  }
}

/* Results Column */
.results-column {
  position: relative;
  display: flex;
  flex-direction: column;
}

.sticky-results {
  position: sticky;
  top: var(--spacing-6);
}

@media (max-width: 1024px) {
  .sticky-results {
    position: relative;
    top: 0;
  }
}

.result-highlight {
  padding: var(--spacing-5);
  background: linear-gradient(135deg, hsl(var(--primary) / 0.1), hsl(var(--accent) / 0.1));
  border-radius: 12px;
  margin-bottom: var(--spacing-4);
  text-align: center;
}

.result-label {
  font-size: var(--font-size-sm);
  color: hsl(var(--muted-foreground));
  margin-bottom: var(--spacing-2);
}

.result-value {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: hsl(var(--primary));
  margin: 0;
}

@media (max-width: 768px) {
  .result-value {
    font-size: var(--font-size-2xl);
  }
}

.result-box {
  padding: var(--spacing-4);
  background: hsl(var(--muted));
  border-radius: 8px;
  margin-bottom: var(--spacing-4);
}

.result-cost {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: hsl(var(--foreground));
  margin: 0;
}

/* Breakdown Section */
.breakdown-section {
  margin-bottom: var(--spacing-6);
}

.breakdown-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: hsl(var(--foreground));
  margin-bottom: var(--spacing-3);
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2);
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-2) 0;
  font-size: var(--font-size-sm);
  border-bottom: 1px solid hsl(var(--border));
  animation: fadeIn 0.3s ease;
}

.breakdown-item:last-child {
  border-bottom: none;
}

.breakdown-label {
  color: hsl(var(--foreground));
}

.breakdown-value {
  color: hsl(var(--muted-foreground));
  font-weight: var(--font-weight-medium);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-3);
  padding-top: var(--spacing-4);
  border-top: 1px solid hsl(var(--border));
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 16px;
  height: 16px;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive adjustments for calculators */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .planner-grid {
    gap: var(--spacing-4);
  }
}

/* ============================================================================
   MODAL STYLES
   ============================================================================ */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: hsl(var(--card));
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h2,
.modal-header h3 {
  margin: 0;
  font-size: var(--font-size-xl);
  color: hsl(var(--foreground));
}

.modal-close {
  background: none;
  border: none;
  font-size: var(--font-size-2xl);
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  padding: 0;
}

.modal-close:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.modal-body {
  padding: var(--spacing-6);
}

.modal-footer {
  padding: var(--spacing-6);
  border-top: 1px solid hsl(var(--border));
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-3);
}

@media (max-width: 768px) {
  .modal-content {
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
}

/* ============================================================================
   MOBILE RESPONSIVE FIXES - December 2025
   ============================================================================ */

/* Fix #1: Messages container positioning on mobile to not block hamburger menu */
@media (max-width: 770px) {
  .messages-container {
    top: 70px !important; /* Position below mobile header (60px height + 10px margin) */
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    max-width: calc(100% - 20px) !important;
    z-index: 999 !important; /* Below hamburger menu and sidebar */
  }

  .message-card {
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    position: relative;
  }

  /* Ensure message close button doesn't overlap hamburger */
  .message-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 1;
  }

  /* Ensure mobile header and hamburger are above messages */
  .mobile-header,
  .hamburger-menu {
    z-index: 1001 !important;
  }
}

/* Fix #2: List page headers - desktop and mobile */
.list-header-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.list-header-content {
  flex: 1;
}

@media (max-width: 480px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .page-header .btn,
  .page-header a.btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  /* Stack list headers on mobile */
  .list-header-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .list-header-wrapper .btn {
    width: 100%;
    order: -1; /* Move button to top on mobile */
  }
}

/* Fix #4: Button groups - stack vertically on mobile */
@media (max-width: 480px) {
  /* Stack all buttons with these classes */
  a.btn.btn-primary.btn-default,
  a.btn.btn-outline.btn-default {
    display: block !important;
    width: 100% !important;
    margin-bottom: 0 !important;
  }

  /* Ensure they stack in mt-6 containers */
  .mt-6 {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }
}

/* Fix #5: Chat page - remove empty space */
@media (max-width: 768px) {
  .chat-header {
    margin-bottom: 0;
  }

  .messages-container.chat-messages-container {
    margin-top: 0;
    padding-top: 0;
  }

  .chat-info-banner {
    display: none;
  }
}

/* Fix #7: Info icons - ensure adequate touch targets */
.info-icon,
.tooltip-trigger,
button.info-icon,
a.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  padding: 10px;
  cursor: pointer;
  position: relative;
  margin-left: 4px;
  border: none;
  background: transparent;
  vertical-align: middle;
}

@media (max-width: 768px) {
  .info-icon,
  .tooltip-trigger,
  button.info-icon,
  a.info-icon {
    min-width: 28px;
    min-height: 28px;
    padding: 12px;
  }
}

/* Fix #8: Long email addresses in inputs */
input[type="email"] {
  overflow-x: auto;
  text-overflow: ellipsis;
}

@media (max-width: 375px) {
  input[type="email"] {
    font-size: 14px;
  }
}

/* Fix #9: Footer grid - single column on very narrow screens */
@media (max-width: 420px) {
  .footer-grid,
  footer .grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
}

/* New breakpoint for intermediate phone sizes */
@media (max-width: 420px) {
  /* Force single column layouts for tight grids */
  .form-row,
  .grid-auto-fit {
    grid-template-columns: 1fr !important;
  }

  /* Ensure adequate spacing for form elements */
  .form-group {
    margin-bottom: 1rem;
  }
}

/* ============================================================================
   DETAIL PAGE RESPONSIVE LAYOUTS - December 2025
   ============================================================================ */

/* Page header content wrapper for detail pages */
.page-header-content {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  width: 100%;
}

.page-header-actions {
  display: flex;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Detail grid for two-column information sections */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

/* Mobile responsive adjustments for detail pages */
@media (max-width: 768px) {
  /* Stack page header content vertically */
  .page-header-content {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header-actions {
    flex-direction: column;
    width: 100%;
  }

  .page-header-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* Stack detail grids to single column */
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Extra small screens - ensure everything fits */
@media (max-width: 480px) {
  .page-header-actions {
    gap: 0.5rem;
  }

  .detail-grid {
    gap: 1rem;
  }
}

/* Back to list button - full width on mobile */
.back-to-list-container {
  margin-top: 2rem;
}

@media (max-width: 768px) {
  .back-to-list-container .btn {
    width: 100%;
    justify-content: center;
  }

  /* Global form responsive rules - all forms stack on mobile */

  /* All inline grid layouts become single column */
  .card form > div[style*="grid-template-columns"],
  form > div[style*="grid-template-columns"],
  div[style*="grid-template-columns: repeat(2"] {
    grid-template-columns: 1fr !important;
  }

  /* Grid utility classes stack to single column */
  .grid-2col,
  .form-row {
    grid-template-columns: 1fr !important;
    display: grid !important;
  }

  /* All button rows stack vertically */
  .card form > div[style*="display: flex"][style*="justify-content"],
  .card > div > div[style*="display: flex"][style*="justify-content"],
  form > div[style*="display: flex"][style*="justify-content"] {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  /* Nested button groups also stack */
  .card form > div[style*="display: flex"] > div[style*="display: flex"],
  .card > div > div[style*="display: flex"] > div[style*="display: flex"],
  form > div[style*="display: flex"] > div[style*="display: flex"] {
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100%;
  }

  /* All buttons in forms and cards become full width */
  .card form .btn,
  .card > div .btn,
  form .btn {
    width: 100% !important;
    justify-content: center;
  }

  /* Form groups with display flex stack */
  .form-group[style*="display: flex"],
  div[class*="form"][style*="display: flex"] {
    flex-direction: column !important;
  }
}

/* ============================================================================
   FORM COMPONENTS
   Standardized, reusable form patterns for consistency across the app
   ============================================================================ */

/* Form Grid Layouts - Side-by-side field arrangements
   These classes automatically stack to single column on mobile */

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.form-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Auto-fit grid - Automatically adjusts column count based on available space */
.form-grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Form Actions - Button container with flexible alignment */
.form-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 2rem;
}

.form-actions--right {
  justify-content: flex-end;
}

.form-actions--center {
  justify-content: center;
}

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

.form-actions--left {
  justify-content: flex-start;
}


/* Form Help Text */
.form-help {
  display: block;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
  line-height: 1.5;
}

/* Form Divider - Visual separator between form sections */
.form-divider {
  height: 1px;
  background: hsl(var(--border));
  margin: 2rem 0;
  border: none;
}

/* Input with Button Row - For input field with adjacent button */
.input-button-row {
  display: flex;
  gap: 0.5rem;
}

.input-button-row input {
  flex: 1;
}

/* Responsive behavior for form components */
@media (max-width: 1024px) {
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  /* All grids become single column on mobile */
  .form-grid-2,
  .form-grid-3,
  .form-grid-4 {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  /* Form actions stack vertically on mobile */
  .form-actions {
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
  }

  .form-actions .btn {
    width: 100%;
  }

  /* Input with adjacent button - stack vertically on mobile */
  .input-button-row {
    flex-direction: column;
  }

  .input-button-row .btn {
    width: 100%;
  }
}

/* ============================================================================
   DASHBOARD MOBILE RESPONSIVE - December 2025
   ============================================================================ */

/* Dashboard-specific responsive styles */

/* Activity item styles - used in Recent Activity section */
.activity-item {
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid hsl(var(--border));
  transition: all 0.2s;
}

.activity-item:hover {
  background-color: hsl(var(--muted));
}

.activity-item--notification {
  border-color: hsl(var(--accent) / 0.4);
  background: hsl(var(--accent) / 0.1);
}

.activity-item--notification:hover {
  background-color: hsl(var(--accent) / 0.2);
  border-color: hsl(var(--accent) / 0.6);
}

.activity-item-content {
  display: flex;
  align-items: start;
  gap: 0.75rem;
}

.activity-item-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.activity-item-body {
  flex: 1;
  min-width: 0; /* Critical for text truncation in flex containers */
  overflow: hidden;
}

.activity-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.25rem;
  gap: 0.5rem;
}

.activity-item-sender {
  font-weight: 500;
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-item-time {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
  flex-shrink: 0;
}

.activity-item-message {
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.activity-item--notification .activity-item-message {
  font-style: italic;
}

/* Main dashboard grid - Recent Activity / Quick Actions */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Quick Actions inner grid */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

/* Quick Action card styling */
.quick-action-card {
  text-decoration: none;
  padding: 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all var(--transition-base);
}

.quick-action-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.quick-action-card svg {
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 1rem;
  color: hsl(var(--primary));
}

.quick-action-card h4 {
  font-weight: var(--font-weight-semibold);
  margin-bottom: 0.5rem;
  font-size: var(--font-size-base);
}

.quick-action-card p {
  font-size: var(--font-size-xs);
  color: hsl(var(--muted-foreground));
  margin: 0;
}

/* Tablet breakpoint */
@media (max-width: 1024px) {
  .dashboard-grid {
    gap: 1.25rem;
  }
}

/* Mobile breakpoint - stack main sections but keep Quick Actions 2-col */
@media (max-width: 768px) {
  /* Stack main dashboard sections */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Keep Quick Actions as 2 columns on mobile for better space usage */
  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  /* Reduce Quick Action card padding on mobile */
  .quick-action-card {
    padding: 1rem 0.75rem;
  }

  .quick-action-card svg {
    width: 2rem;
    height: 2rem;
    margin-bottom: 0.75rem;
  }

  .quick-action-card h4 {
    font-size: var(--font-size-sm);
    margin-bottom: 0.25rem;
  }

  .quick-action-card p {
    font-size: 0.7rem;
    line-height: 1.3;
  }

  /* Reduce main content padding on mobile */
  .main-content {
    padding: var(--spacing-4);
    padding-top: calc(60px + var(--spacing-4));
  }

  /* Reduce container padding */
  .container-wide {
    padding-left: var(--spacing-3);
    padding-right: var(--spacing-3);
  }

  /* Smaller page title on mobile */
  .page-title {
    font-size: var(--font-size-2xl);
  }
}

/* Small mobile breakpoint - even tighter */
@media (max-width: 375px) {
  .quick-actions-grid {
    gap: 0.5rem;
  }

  .quick-action-card {
    padding: 0.75rem 0.5rem;
  }

  .quick-action-card svg {
    width: 1.75rem;
    height: 1.75rem;
    margin-bottom: 0.5rem;
  }

  .quick-action-card h4 {
    font-size: 0.8rem;
  }

  .quick-action-card p {
    font-size: 0.65rem;
  }

  .page-title {
    font-size: var(--font-size-xl);
  }

  /* Even tighter padding */
  .main-content {
    padding: var(--spacing-3);
    padding-top: calc(60px + var(--spacing-3));
  }
}
