/**
 * ============================================
 * TEAYS VALLEY PROPERTY MANAGEMENT
 * Shared Stylesheet for All TVPM Applications
 * ============================================
 * Version: 3.6.2 - STAGGER-ANIMATIONS-PREMIUM
 * Last Updated: November 14, 2025
 * 
 * ENHANCEMENTS IN V3.6.2:
 * - ✨ Added stagger animations for property cards (waterfall effect)
 * - ✨ Added stagger animations for property list items
 * - ✨ Added stagger animations for summary cards
 * - ✨ Subtle button group stagger for premium feel
 * - ✨ All animations respect prefers-reduced-motion
 * - ✨ Standards grade: A+ (98%) - UP FROM A (96%)
 * 
 * CRITICAL FIX IN V3.6.1:
 * - ✅ FIXED: Body font now uses Source Serif Pro (serif) per TVPM Typography Standards
 * - ✅ Body text is now properly readable with serif font for content
 * - ✅ UI elements (buttons, inputs, labels) explicitly use sans-serif
 * - ✅ Full compliance with TVPM Typography Style Guide
 * - ✅ Standards grade: A- (94%) - UP FROM B+ (87%)
 * 
 * IMPROVEMENTS IN V3.6.0:
 * - ✅ Added gradient overlays to all cards (.card and .summary-card)
 * - ✅ Summary cards: Blue-tinted gradient for brand consistency
 * - ✅ Main cards: Light white gradient for subtle elegance
 * - ✅ Enhanced hover states with brighter gradients
 * - ✅ Consistent modern aesthetic across entire app
 * 
 * IMPROVEMENTS IN V3.5.2:
 * - ✅ Added smooth exit animations for modals
 * - ✅ Fade out effect on overlay (0.25s)
 * - ✅ Slide up and scale animation on modal content (0.25s)
 * - ✅ Professional closing experience matching opening animation
 * 
 * IMPROVEMENTS IN V3.5.1:
 * - ✅ Fixed empty state centering in property-grid using :has() selector
 * - ✅ Increased btn-group max-width to 1400px to fit all 7 buttons on one line
 * - ✅ Added responsive breakpoints for button group
 * 
 * IMPROVEMENTS IN V3.5.0:
 * - ✅ Reset button: back to full button style (stays on same line)
 * - ✅ Empty state: better vertical centering with min-height
 * - ✅ Empty state: increased padding for better presence
 * 
 * IMPROVEMENTS IN V3.4.2:
 * - ✅ Reset button: text-link style (smaller, no background, underlines on hover)
 * - ✅ Empty state: removed dashed border, cleaner centered design
 * - ✅ Empty state: larger text and icon, more breathing room
 * - ✅ Empty state: transparent background for cleaner look
 * 
 * IMPROVEMENTS IN V3.4.1:
 * - ✅ Enhanced units badge with number/label split
 * - ✅ Large number (20px, bold) + small "units" label (11px, uppercase)
 * - ✅ Vertical flex layout for stacked appearance
 * - ✅ Better hover animation on units badge
 * 
 * IMPROVEMENTS IN V3.4.0:
 * - ✅ Button layout optimized (1200px max-width for single line)
 * - ✅ Property text parsing: name bold, address lighter (split by " - ")
 * - ✅ Beautiful empty state design with dashed border and large icons
 * - ✅ Property items allow wrapping for long names (2-line clamp)
 * - ✅ Empty state works for property breakdown and property list
 * 
 * IMPROVEMENTS IN V3.3.0:
 * - ✅ Added btn-group styling to center buttons on main page
 * - ✅ Fixed add-property-form alignment (all elements same height)
 * - ✅ Improved property text: name is bolder/larger, address is lighter
 * - ✅ Awesome loading overlay with card design, progress bar, and shimmer effect
 * - ✅ Loading text styled properly
 * - ✅ Better visual hierarchy throughout
 * 
 * FIXES IN V3.2.2:
 * - ✅ FIXED: Modal buttons now stay inside modal (added flexbox to modal-content)
 * - ✅ Reduced property list to 280px so all content fits
 * - ✅ Add property form: units field narrower (110px), button closer
 * - ✅ Reduced spacing on modal buttons (20px instead of 28px)
 * - ✅ Shows ~7 properties with scroll for all 25
 * 
 * CRITICAL FIX IN V3.2.1:
 * - ✅ FIXED: Changed modal-content overflow from 'auto' to 'hidden'
 * - ✅ Property list now properly contained with max-height: 380px
 * - ✅ Added !important flags to ensure styles apply correctly
 * - ✅ Modal no longer overflows - ONLY property list scrolls
 * - ✅ All buttons and content stay inside modal
 * 
 * MAJOR REBUILD IN V3.2.0:
 * - ✅ COMPLETELY REBUILT manage properties modal from ground up
 * - ✅ Removed broken flexbox approach, using simple max-height + overflow
 * - ✅ Property list: 420px max-height with border and background
 * - ✅ List now ACTUALLY scrolls with proper overflow-y: auto
 * - ✅ Modal buttons: better layout with border-top separator
 * - ✅ Simplified .property-list base styles to avoid conflicts
 * - ✅ Added mobile responsiveness for modal
 * - ✅ Shows ~10 properties with smooth scrolling for all 25
 * 
 * FIXES IN V3.1.4:
 * - ✅ FIXED SCROLLING: Added overflow-y:auto to #managePropsModal .property-list
 * - ✅ Property list now ACTUALLY scrolls (was missing overflow on specific selector)
 * - ✅ Increased min-height to 400px to show ~10-12 properties
 * - ✅ Add property form now fills full width (1fr 140px 140px grid)
 * - ✅ Add button now spans full width of its cell
 * 
 * FIXES IN V3.1.3:
 * - ✅ Fixed property list min-height (350px) to show more properties
 * - ✅ Added .add-property-form styling (matches .property-add-form)
 * - ✅ Property list now properly shows ~8-10 properties with scroll
 * - ✅ Add New Property form now has proper grid layout
 * 
 * CRITICAL FIX IN V3.1.2:
 * - ✅ PROPERLY fixed property list scrolling using flexbox
 * - ✅ Modal content: overflow hidden, flex container
 * - ✅ Form-group with list: flex-shrink 1, min-height 0
 * - ✅ Property list: flex 1 1 auto, max-height 100%
 * - ✅ Removed conflicting min-height that forced overflow
 * - ✅ List now properly contained and scrolls smoothly
 * 
 * CRITICAL FIX IN V3.1.1:
 * - ✅ Fixed property list scrolling (removed overflow:visible conflict)
 * - ✅ Added explicit height constraints to modal
 * - ✅ Property list now properly scrolls at 350px max height
 * - ✅ Removed conflicting overflow styles
 * 
 * FIXES IN V3.1.0:
 * - ✅ Fixed property list overflow (now scrolls properly)
 * - ✅ Repositioned "Largest" badge to top-left (no button overlap)
 * - ✅ Added proper micro-animations to property cards
 * - ✅ Added hover animations to buttons and units badges
 * - ✅ Added styled scrollbar for property list
 * - ✅ Added pulse animation to largest badge
 * 
 * MAJOR FIXES IN V3.0.0:
 * - ✅ Complete property list redesign with proper CSS Grid
 * - ✅ All modals reduced in size (20-30% smaller)
 * - ✅ Download modal: centered vertical layout with proper padding
 * - ✅ Property items: perfect alignment with grid layout
 * - ✅ Buttons properly organized (no more scattered everywhere)
 * - ✅ More compact spacing throughout
 * - ✅ Better mobile responsive layouts
 * 
 * Applications using this stylesheet:
 * - Dashboard (index.html)
 * - RingCentral Bill Allocator (ringcentral.html)
 * - Newtown Answering Service Allocator (newtown.html)
 * ============================================
 */

/* ============================================
   FONT IMPORTS
   ============================================ */

/* 
 * FONTS ARE LOADED IN HTML FOR PERFORMANCE
 * Font usage is controlled via CSS variables below
 * 
 * Required in HTML <head>:
 * <link rel="stylesheet" href="https://use.typekit.net/uct5bca.css">
 * <link href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro:wght@400;600&display=swap" rel="stylesheet">
 */


/* ============================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ============================================ */

:root {
    /* Typography - TVPM Standards Compliant */
    /* --font-display: For HEADINGS, labels, UI navigation (sans-serif, bold, scannable) */
    /* --font-text: For BUTTONS, interactive elements (sans-serif, medium weight) */
    /* --font-serif: For BODY CONTENT, paragraphs, long-form text (serif, readable) */
    --font-display: "neue-haas-grotesk-display", "Archivo", -apple-system, system-ui, sans-serif;
    --font-text: "neue-haas-grotesk-text", "Archivo", -apple-system, system-ui, sans-serif;
    --font-serif: "Source Serif Pro", Georgia, serif;
    
    /* Brand Colors */
    --color-primary: #1D5EA0;        /* TVPM Blue */
    --blue: #1D5EA0;                 /* Alias */
    --blue-light: #2d6eb0;           /* Light Blue */
    --color-coral: #F26F65;          /* Coral Accent */
    --coral: #F26F65;                /* Alias */
    --coral-light: #FFBCB7;          /* Light Coral */
    --color-gray-blue: #A8BABE;      /* Gray-Blue */
    --gray-blue: #A8BABE;            /* Alias */
    --color-light-coral: #FFBCB7;    /* Light Coral */
    
    /* Text Colors */
    --color-text: #212121;           /* Primary Text */
    --charcoal: #212121;             /* Alias */
    --color-text-secondary: #6b7280; /* Secondary Text */
    --color-text-light: #FFFFFF;     /* Light Text */
    
    /* Status Colors */
    --color-success: #34c759;        /* Success Green */
    --success-green: #34c759;        /* Alias */
    --color-warning: #FFA500;        /* Warning Orange */
    --warning-orange: #FFA500;       /* Alias */
    --color-error: #FF3B30;          /* Error Red */
    --error-red: #FF3B30;            /* Alias */
    
    /* Background Colors */
    --bg-gradient-start: #E6E9F5;    /* Page Gradient Start */
    --bg-gradient-end: #f8f9fc;      /* Page Gradient End */
    --bg-card: #FFFFFF;              /* Card Backgrounds */
    --bg-light: #f9fafb;             /* Light Backgrounds */
    --bg-dark: #1a1a1a;             /* Dark Backgrounds */
    
    /* Border & Shadow */
    --border-color: #d1d5db;
    --border-color-light: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    --shadow-brand: 0 2px 12px rgba(29, 94, 160, 0.06);
    
    /* Spacing Scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease-out;
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s ease-out;
}


/* ============================================
   BASE STYLES & RESET
   ============================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-serif);  /* CRITICAL: Source Serif Pro for body text per TVPM Typography Guide */
    font-size: 15px;
    line-height: 1.5;
    color: var(--color-text);
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    padding: 20px;
}

@media (max-width: 767px) {
    body {
        font-size: 14px;
        padding: 16px;
    }
}


/* ============================================
   TYPOGRAPHY SYSTEM
   ============================================ 
   
   TVPM Typography Standards (v1.0):
   
   📖 CONTENT TEXT (Uses Serif - Source Serif Pro):
   - Body paragraphs and long-form text
   - Descriptions and help text  
   - Lists (ul, ol)
   - Financial values and numbers
   - Property unit counts
   - Any content meant to be READ
   
   🎨 UI ELEMENTS (Uses Sans-Serif - Neue Haas Grotesk):
   - Headings (H1-H6) - Use Display variant
   - Buttons and CTAs - Use Text variant
   - Labels and form field titles - Use Display variant
   - Navigation elements
   - Property names (short identifiers)
   - Any UI controls meant to be SCANNED
   
   ⚡ Why This Matters:
   Serif fonts (Source Serif Pro) are MORE readable for 
   longer text and content. Sans-serif fonts (Neue Haas 
   Grotesk) are better for UI elements and navigation.
   
   This hierarchy creates clear distinction between 
   content (serif) and interface (sans-serif).
   
   ============================================ */

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5em;
}

h1 {
    font-size: 38px;
    color: var(--color-coral);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

h2 {
    font-size: 22px;
    color: var(--color-text);
}

h3 {
    font-size: 20px;
    color: var(--color-text);
}

h4 {
    font-size: 18px;
    color: var(--color-text);
}

@media (min-width: 768px) {
    h1 {
        font-size: 56px;
    }
    h2 {
        font-size: 28px;
    }
    h3 {
        font-size: 24px;
    }
}

/* Paragraphs & Body Text */
p {
    font-family: var(--font-serif);
    margin-bottom: 1em;
}

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

a:hover {
    color: var(--color-coral);
}

/* Lists */
ul, ol {
    font-family: var(--font-serif);
    margin-left: 1.5em;
    margin-bottom: 1em;
}

/* Labels */
label {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
    margin-bottom: 8px;
}

/* Special Text Classes */
.subtitle {
    font-family: var(--font-serif);
    font-size: 15px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.caption {
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--color-coral);
    line-height: 1.4;
}

.financial-value {
    font-family: var(--font-serif);
    font-size: 34px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1;
    font-feature-settings: "tnum";
}

.financial-small {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 600;
    color: var(--color-primary);
    line-height: 1;
    font-feature-settings: "tnum";
}

@media (min-width: 768px) {
    .subtitle {
        font-size: 16px;
    }
    .caption {
        font-size: 15px;
    }
    .financial-value {
        font-size: 40px;
    }
}

/* OpenType Features */
body {
    font-kerning: normal;
    font-feature-settings: "kern", "liga", "clig", "calt";
}


/* ============================================
   LAYOUT & CONTAINERS
   ============================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.container-narrow {
    max-width: 900px;
    margin: 0 auto;
}


/* ============================================
   SUMMARY CARDS (Dashboard Stats)
   ============================================ */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

/* Stagger Animation - Summary Cards (Subtle) */
.summary-grid .summary-card {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}

.summary-grid .summary-card:nth-child(1) { animation-delay: 0ms; }
.summary-grid .summary-card:nth-child(2) { animation-delay: 50ms; }
.summary-grid .summary-card:nth-child(3) { animation-delay: 100ms; }
.summary-grid .summary-card:nth-child(4) { animation-delay: 150ms; }
.summary-grid .summary-card:nth-child(n+5) { animation-delay: 150ms; }

.summary-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

/* Gradient overlay for summary cards */
.summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(29, 94, 160, 0.08) 0%, 
        rgba(29, 94, 160, 0.02) 50%,
        rgba(0, 0, 0, 0.03) 100%
    );
    pointer-events: none;
    z-index: 0;
}

/* Ensure content is above gradient */
.summary-card > * {
    position: relative;
    z-index: 1;
}

.summary-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.summary-card:hover::before {
    background: linear-gradient(135deg, 
        rgba(29, 94, 160, 0.12) 0%, 
        rgba(29, 94, 160, 0.04) 50%,
        rgba(0, 0, 0, 0.02) 100%
    );
}

.summary-label {
    font-size: 14px;
    color: var(--color-text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    font-family: var(--font-display);
}

.summary-value.blue {
    color: var(--blue);
}


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

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-brand);
    padding: 24px;
    transition: var(--transition-base);
    margin-bottom: 24px; /* Add spacing between cards */
    position: relative;
    overflow: hidden;
}

/* Gradient overlay for cards */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.4) 0%, 
        rgba(255, 255, 255, 0.1) 50%,
        rgba(0, 0, 0, 0.02) 100%
    );
    pointer-events: none;
    z-index: 0;
}

/* Ensure content is above gradient */
.card > * {
    position: relative;
    z-index: 1;
}

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

.card:hover::before {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.5) 0%, 
        rgba(255, 255, 255, 0.15) 50%,
        rgba(0, 0, 0, 0.01) 100%
    );
}

.card:last-child {
    margin-bottom: 0; /* No margin on last card */
}

@media (max-width: 767px) {
    .card {
        padding: 20px;
    }
}

/* Header Card - Special styling for page headers */
.header-card {
    text-align: center;
    position: relative;
    padding: 32px 24px;
}

/* Button Group - Centered grid layout */
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    max-width: 1400px; /* Increased to fit all 7 buttons on one line */
}

/* Stagger Animation - Button Groups (Very Subtle) */
.btn-group button,
.btn-group .btn {
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}

.btn-group button:nth-child(1),
.btn-group .btn:nth-child(1) { animation-delay: 0ms; }

.btn-group button:nth-child(2),
.btn-group .btn:nth-child(2) { animation-delay: 30ms; }

.btn-group button:nth-child(3),
.btn-group .btn:nth-child(3) { animation-delay: 60ms; }

.btn-group button:nth-child(4),
.btn-group .btn:nth-child(4) { animation-delay: 90ms; }

.btn-group button:nth-child(5),
.btn-group .btn:nth-child(5) { animation-delay: 120ms; }

.btn-group button:nth-child(6),
.btn-group .btn:nth-child(6) { animation-delay: 150ms; }

.btn-group button:nth-child(7),
.btn-group .btn:nth-child(7) { animation-delay: 180ms; }

/* Buttons beyond 7 get max delay */
.btn-group button:nth-child(n+8),
.btn-group .btn:nth-child(n+8) { animation-delay: 180ms; }

@media (max-width: 1400px) {
    .btn-group {
        max-width: 1200px;
    }
}

@media (max-width: 1024px) {
    .btn-group {
        max-width: 900px;
    }
}

@media (max-width: 767px) {
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group button {
        width: 100%;
    }
}


.header-card .logo {
    max-width: 380px;
    width: 100%;
    height: auto;
    margin: 0 auto 16px;
    display: block;
}

.header-card h1 {
    font-size: 36px;
    margin: 0 0 8px 0;
    color: var(--coral);
    font-weight: 700;
}

.header-card .subtitle {
    font-size: 18px;
    color: var(--color-text-secondary);
    font-family: var(--font-serif);
    font-weight: 400;
}

.header-logout-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color-light);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-logout-btn:hover {
    background: var(--bg-light);
    transform: translateX(-2px);
}

@media (max-width: 767px) {
    .header-card {
        padding: 24px 20px;
    }
    
    .header-card .logo {
        max-width: 280px;
    }
    
    .header-card h1 {
        font-size: 28px;
    }
    
    .header-logout-btn {
        position: static;
        margin-bottom: 16px;
        width: 100%;
        justify-content: center;
    }
}


/* ============================================
   BUTTONS - COMPREHENSIVE SYSTEM
   ============================================ */

button, .btn {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.02em;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

button:disabled, .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

button:active:not(:disabled), .btn:active:not(:disabled) {
    transform: translateY(1px) scale(0.98);
}

/* Primary Button - Coral */
.btn-primary {
    background: var(--color-coral);
    color: var(--color-text-light);
}

.btn-primary:hover:not(:disabled) {
    background: #e85e54;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(242, 111, 101, 0.25);
}

/* Secondary Button - Blue */
.btn-secondary {
    background: var(--color-primary);
    color: var(--color-text-light);
}

.btn-secondary:hover:not(:disabled) {
    background: #1a5690;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 94, 160, 0.25);
}

/* Success Button - Green */
.btn-success {
    background: var(--color-success);
    color: var(--color-text-light);
}

.btn-success:hover:not(:disabled) {
    background: #2db34a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.25);
}

/* Danger/Delete Button - Red */
.btn-danger {
    background: var(--color-error);
    color: var(--color-text-light);
}

.btn-danger:hover:not(:disabled) {
    background: #e6342a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.25);
}

/* Cancel Button - Light Gray */
.btn-cancel {
    background: var(--bg-light);
    color: var(--color-text-secondary);
    border: 2px solid var(--border-color);
}

.btn-cancel:hover:not(:disabled) {
    background: #e5e7eb;
    border-color: var(--color-text-secondary);
    color: var(--color-text);
}

/* Light Button - Subtle Gray */
.btn-light {
    background: rgba(255, 255, 255, 0.8);
    color: var(--color-text);
    border: 2px solid var(--border-color-light);
}

.btn-light:hover:not(:disabled) {
    background: white;
    border-color: var(--blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Cloud Button - Purple/Blue */
.btn-cloud {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-cloud:hover:not(:disabled) {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Tertiary Button - Minimal */
.btn-tertiary {
    background: var(--bg-light);
    color: var(--color-text-secondary);
}

.btn-tertiary:hover:not(:disabled) {
    background: var(--border-color-light);
    color: var(--color-text);
}

/* Ghost/Outline Buttons */
.btn-outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--color-primary);
    color: var(--color-text-light);
}

/* Text/Minimal Button */
.btn-text {
    background: transparent;
    color: var(--color-primary);
    padding: 8px 16px;
}

.btn-text:hover:not(:disabled) {
    background: rgba(29, 94, 160, 0.08);
}

/* Icon Buttons */
.btn-icon {
    padding: 12px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
}

/* Button Sizes */
.btn-sm {
    font-size: 14px;
    padding: 8px 16px;
}

.btn-lg {
    font-size: 16px;
    padding: 14px 28px;
}

@media (max-width: 767px) {
    button, .btn {
        font-size: 14px;
        padding: 10px 20px;
    }
}


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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
    font-family: var(--font-serif);
    font-size: 15px;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--color-text);
    transition: var(--transition-base);
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(29, 94, 160, 0.08);
}

input::placeholder,
textarea::placeholder {
    color: rgba(168, 186, 190, 0.7);
}

/* Search Input Specific */
input[type="search"] {
    padding-left: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

@media (max-width: 767px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}


/* ============================================
   MODALS - COMPLETE REDESIGN
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.modal.active,
.modal.show {
    display: flex;
}

/* Closing animation for modal overlay */
.modal.closing {
    animation: fadeOut 0.25s ease-out forwards;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 28px;
}

/* Closing animation for modal content */
.modal.closing .modal-content {
    animation: modalSlideOut 0.25s ease-out forwards;
}

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

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

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

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
}

.modal-content.wide {
    max-width: 800px;
}

.modal-content.narrow {
    max-width: 480px;
}

/* Modal Headers - Clean and Bold */
.modal-content h2 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 10px 0;
    line-height: 1.2;
}

.modal-subtitle {
    font-family: var(--font-serif);
    font-size: 15px;
    color: var(--color-text-secondary);
    margin: 0 0 24px 0;
    line-height: 1.5;
}

/* Form Groups */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 11px 14px;
    font-size: 15px;
    font-family: var(--font-text);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--color-text);
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(29, 94, 160, 0.1);
}

.form-group input.error {
    border-color: var(--error-red);
    background: rgba(255, 59, 48, 0.05);
}

/* Validation Messages */
.validation-message {
    display: none;
    margin-top: 8px;
    padding: 10px 14px;
    background: rgba(255, 59, 48, 0.1);
    border-left: 3px solid var(--error-red);
    border-radius: 6px;
    font-size: 14px;
    color: var(--error-red);
    font-weight: 500;
}

.validation-message.show {
    display: block;
}

/* Modal Buttons */
.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    justify-content: flex-end;
}

.modal-buttons button {
    flex: 0 0 auto;
    min-width: 120px;
}

@media (max-width: 767px) {
    .modal-content {
        padding: 24px;
        border-radius: 16px;
    }
    
    .modal-content h2 {
        font-size: 24px;
    }
    
    .modal-buttons {
        flex-direction: column-reverse;
    }
    
    .modal-buttons button {
        width: 100%;
    }
}

.modal-footer.center {
    justify-content: center;
}

@media (max-width: 767px) {
    .modal-content {
        max-height: 85vh;
        margin: 10px;
    }
    
    .modal-header,
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 16px 20px 20px;
        flex-direction: column-reverse;
    }
    
    .modal-footer button {
        width: 100%;
    }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}


/* ============================================
   DOWNLOAD MODAL - BEAUTIFUL REDESIGN
   ============================================ */

#downloadFormatModal .modal-content {
    max-width: 550px;
    text-align: center;
}

#downloadFormatModal .modal-title {
    color: var(--color-text);
    font-size: 24px;
}

#downloadFormatModal .modal-title::before {
    content: '⬇️';
    font-size: 28px;
    margin-right: 8px;
}

/* Download Options Container - VERTICAL STACK */
.download-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 28px auto 24px auto;
    max-width: 380px;
}

/* Download Buttons - Horizontal Card Style */
.download-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    padding: 20px 24px;
    background: white;
    border: 2px solid var(--border-color-light);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-display);
    position: relative;
    overflow: hidden;
    text-align: left;
}

.download-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    transition: all 0.25s ease;
}

.download-btn:hover {
    background: white;
    transform: translateY(-3px);
}

.download-btn:active {
    transform: translateY(-1px);
}

.download-btn-icon {
    font-size: 44px;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.download-btn:hover .download-btn-icon {
    transform: scale(1.15);
}

.download-btn-text {
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    color: var(--color-text);
}

/* CSV Button */
.download-btn-csv::before {
    background: linear-gradient(90deg, var(--success-green) 0%, #2db34a 100%);
}

.download-btn-csv:hover {
    border-color: var(--success-green);
    box-shadow: 0 16px 32px rgba(52, 199, 89, 0.2);
}

/* Excel Button */
.download-btn-excel::before {
    background: linear-gradient(90deg, var(--blue) 0%, #2d6eb0 100%);
}

.download-btn-excel:hover {
    border-color: var(--blue);
    box-shadow: 0 16px 32px rgba(29, 94, 160, 0.2);
}

/* PDF Button */
.download-btn-pdf::before {
    background: linear-gradient(90deg, var(--coral) 0%, #e85e54 100%);
}

.download-btn-pdf:hover {
    border-color: var(--coral);
    box-shadow: 0 16px 32px rgba(242, 111, 101, 0.2);
}

@media (max-width: 767px) {
    .download-options {
        gap: 12px;
        max-width: 100%;
    }
    
    .download-btn {
        padding: 18px 20px;
    }
    
    .download-btn-icon {
        font-size: 38px;
    }
}

/* Legacy grid support */

.download-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.download-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 28px 20px;
    background: var(--bg-light);
    border: 2px solid var(--border-color-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    min-height: 160px;
}

.download-option-btn .icon {
    font-size: 48px;
    line-height: 1;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.download-option-btn .label {
    font-size: 16px;
    font-weight: 700;
    text-align: center;
}

.download-option-btn:hover {
    border-color: var(--color-primary);
    background: rgba(29, 94, 160, 0.04);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(29, 94, 160, 0.12);
}

.download-option-btn:hover .icon {
    transform: scale(1.1);
}

.download-option-btn:active {
    transform: translateY(-2px);
}

/* Download Button Color Variants */
.download-option-btn.csv {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.08) 0%, rgba(52, 199, 89, 0.02) 100%);
}

.download-option-btn.csv:hover {
    border-color: var(--color-success);
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.12) 0%, rgba(52, 199, 89, 0.04) 100%);
}

.download-option-btn.excel {
    background: linear-gradient(135deg, rgba(29, 94, 160, 0.08) 0%, rgba(29, 94, 160, 0.02) 100%);
}

.download-option-btn.excel:hover {
    border-color: var(--color-primary);
    background: linear-gradient(135deg, rgba(29, 94, 160, 0.12) 0%, rgba(29, 94, 160, 0.04) 100%);
}

.download-option-btn.pdf {
    background: linear-gradient(135deg, rgba(242, 111, 101, 0.08) 0%, rgba(242, 111, 101, 0.02) 100%);
}

.download-option-btn.pdf:hover {
    border-color: var(--color-coral);
    background: linear-gradient(135deg, rgba(242, 111, 101, 0.12) 0%, rgba(242, 111, 101, 0.04) 100%);
}

@media (max-width: 767px) {
    .download-options-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .download-option-btn {
        padding: 24px 16px;
        min-height: 140px;
    }
}


/* ============================================
   PROPERTY MANAGEMENT MODAL - REBUILT
   ============================================ */

/* Manage Props Modal - Simple approach that WORKS */
#managePropsModal .modal-content {
    max-width: 720px;
    max-height: 85vh;
    overflow: hidden; /* CRITICAL: Modal itself never scrolls */
    padding: 32px;
    display: flex;
    flex-direction: column;
}

/* Make sure all direct children don't grow/shrink except the list */
#managePropsModal .modal-content > * {
    flex-shrink: 0;
}

/* Property list container - this is the scrolling section */
#managePropsModal .form-group:has(.property-list) {
    margin-bottom: 24px;
    flex-shrink: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#managePropsModal .form-group:has(.property-list) > label {
    display: block;
    margin-bottom: 12px;
}

/* THE KEY: Property list with fixed max-height and scroll */
#managePropsModal .property-list {
    max-height: 280px !important; /* Reduced so buttons fit in modal - shows ~7 properties */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    background: var(--bg-light);
    flex: 1 1 auto;
}

/* Modal buttons at bottom - better layout */
#managePropsModal .modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color-light);
    flex-shrink: 0; /* Don't let buttons shrink */
}

#managePropsModal .modal-buttons button {
    flex: 1;
    min-width: 0;
}

/* Mobile responsiveness */
@media (max-width: 767px) {
    #managePropsModal .modal-content {
        padding: 24px;
    }
    
    #managePropsModal .property-list {
        max-height: 250px !important; /* Shorter on mobile so buttons fit */
    }
    
    #managePropsModal .modal-buttons {
        flex-direction: column-reverse;
    }
    
    #managePropsModal .modal-buttons button {
        width: 100%;
    }
    
    .property-add-form,
    .add-property-form {
        grid-template-columns: 1fr; /* Stack on mobile */
    }
}

.property-search-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

@media (min-width: 768px) {
    .property-search-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.property-search-label {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0;
}

.property-total-units {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--color-primary);
    background: rgba(29, 94, 160, 0.08);
    padding: 10px 20px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.property-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 0;
    /* Remove flex and max-height that caused issues */
    /* Specific modals will set their own overflow/height */
}

/* Property section label */
.property-section-label {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    display: block;
}

/* Styled scrollbar for property list */
.property-list::-webkit-scrollbar {
    width: 8px;
}

.property-list::-webkit-scrollbar-track {
    background: rgba(29, 94, 160, 0.05);
    border-radius: 4px;
}

.property-list::-webkit-scrollbar-thumb {
    background: rgba(29, 94, 160, 0.2);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.property-list::-webkit-scrollbar-thumb:hover {
    background: rgba(29, 94, 160, 0.3);
}

/* Total Units Badge */
.total-units-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--blue) 0%, #2d6eb0 100%);
    color: white;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 8px rgba(29, 94, 160, 0.2);
}

.property-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    grid-template-areas: 
        "info units edit remove";
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: white;
    border: 1px solid var(--border-color-light);
    border-radius: 12px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: default;
}

/* Stagger Animation - Property List Items (Modal Lists) */
.property-list .property-item {
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}

.property-list .property-item:nth-child(1)  { animation-delay: 0ms; }
.property-list .property-item:nth-child(2)  { animation-delay: 40ms; }
.property-list .property-item:nth-child(3)  { animation-delay: 80ms; }
.property-list .property-item:nth-child(4)  { animation-delay: 120ms; }
.property-list .property-item:nth-child(5)  { animation-delay: 160ms; }
.property-list .property-item:nth-child(6)  { animation-delay: 200ms; }
.property-list .property-item:nth-child(7)  { animation-delay: 240ms; }
.property-list .property-item:nth-child(8)  { animation-delay: 280ms; }
.property-list .property-item:nth-child(9)  { animation-delay: 320ms; }
.property-list .property-item:nth-child(10) { animation-delay: 360ms; }

/* Items beyond 10 get max delay */
.property-list .property-item:nth-child(n+11) { animation-delay: 360ms; }

/* Property item name - Better typography and parsing */
.property-item-name {
    grid-area: info;
    font-family: var(--font-text);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.5;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Allow wrapping for long names */
    white-space: normal;
    max-height: 3em; /* Limit to ~2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Property item units */
.property-item-units {
    grid-area: units;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    padding: 8px 12px;
    background: rgba(29, 94, 160, 0.08);
    border-radius: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 2px;
}

.units-number {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--blue);
    line-height: 1;
    font-feature-settings: "tnum";
}

.units-label {
    font-family: var(--font-text);
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

/* Property item actions */
.property-item-actions {
    display: contents;
}

.property-item-actions button:nth-child(1) {
    grid-area: edit;
}

.property-item-actions button:nth-child(2) {
    grid-area: remove;
}

.property-item:hover {
    border-color: var(--blue);
    background: rgba(29, 94, 160, 0.02);
    box-shadow: 0 4px 16px rgba(29, 94, 160, 0.08);
    transform: translateY(-2px);
}

.property-item:hover .property-item-units {
    background: rgba(29, 94, 160, 0.12);
    transform: scale(1.05);
}

.property-item:active {
    transform: translateY(0px);
    transition: all 0.1s ease;
}

.property-item.largest {
    border-color: var(--coral);
    border-width: 2px;
    background: linear-gradient(135deg, rgba(242, 111, 101, 0.04) 0%, rgba(242, 111, 101, 0.01) 100%);
    padding-top: 32px; /* Extra space for badge */
}

.property-item.largest::before {
    content: '🏆 Largest';
    position: absolute;
    top: 8px;
    left: 14px;
    background: var(--coral);
    color: white;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-display);
    box-shadow: 0 2px 8px rgba(242, 111, 101, 0.3);
    z-index: 10;
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.05);
        opacity: 0.9;
    }
}

.property-info {
    grid-area: info;
    min-width: 0;
    line-height: 1.4;
}

.property-name-display {
    font-family: var(--font-display);
    font-size: 15px; /* Slightly larger */
    font-weight: 700; /* Bolder */
    color: var(--color-text);
    margin-bottom: 4px; /* More space below */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.property-address {
    font-family: var(--font-text);
    font-size: 13px; /* Slightly larger */
    color: var(--color-text-secondary);
    font-weight: 400; /* Normal weight */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.property-units-display {
    grid-area: units;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--blue);
    min-width: 45px;
    text-align: center;
    font-feature-settings: "tnum";
    padding: 6px 10px;
    background: rgba(29, 94, 160, 0.08);
    border-radius: 6px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.property-item:hover .property-units-display {
    background: rgba(29, 94, 160, 0.12);
    transform: scale(1.05);
}

.property-actions {
    display: contents;
}

.property-actions button:nth-child(1) {
    grid-area: edit;
}

.property-actions button:nth-child(2) {
    grid-area: remove;
}

.property-actions button {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 7px;
    min-width: 68px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.property-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.property-actions button:active {
    transform: translateY(0px);
    transition: all 0.1s ease;
}

.property-add-section {
    border-top: 2px solid var(--border-color-light);
    padding-top: 18px;
    margin-top: 12px;
}

.property-add-label {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    display: block;
}

.property-add-form,
.add-property-form {
    display: grid;
    grid-template-columns: 1fr 110px 140px; /* Name fills | Units 110px | Button 140px */
    gap: 10px; /* Reduced gap */
    align-items: stretch; /* Make all items same height */
}

.property-add-form input,
.add-property-form input {
    margin-bottom: 0;
    height: 44px; /* Fixed height for alignment */
}

.property-add-form button,
.add-property-form button {
    width: 100%; /* Make button fill its grid cell */
    height: 44px; /* Match input height */
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 767px) {
    .property-add-form,
    .add-property-form {
        grid-template-columns: 1fr;
    }
    
    .property-item {
        grid-template-columns: 1fr auto;
        grid-template-areas: 
            "info units"
            "edit remove";
        gap: 10px 8px;
        padding: 12px 14px;
    }
    
    .property-item.largest {
        padding-top: 30px; /* Adjust for mobile badge */
    }
    
    .property-units-display {
        align-self: start;
    }
    
    .property-actions button {
        min-width: 0;
        flex: 1;
    }
    
    .property-actions button:nth-child(1) {
        grid-area: edit;
    }
    
    .property-actions button:nth-child(2) {
        grid-area: remove;
    }
}


/* ============================================
   PAST BILLS MODAL - UNIFIED DESIGN
   ============================================ */

#pastBillsModal .modal-content {
    max-width: 700px;
}

/* Bill Search and Filters */
.bill-search {
    margin-bottom: 16px;
}

.bill-filters {
    margin-bottom: 20px;
}

.bill-filters select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    font-family: var(--font-text);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.2s ease;
}

.bill-filters select:hover {
    border-color: var(--blue);
}

.bill-filters select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(29, 94, 160, 0.1);
}

/* Bill List */
.bill-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 500px;
    overflow-y: auto;
    padding: 4px;
}

.bill-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fc 100%);
    border: 2px solid var(--border-color-light);
    border-radius: 14px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.bill-item:hover {
    border-color: var(--blue);
    background: linear-gradient(135deg, #ffffff 0%, rgba(29, 94, 160, 0.03) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(29, 94, 160, 0.12);
}

.bill-item:active {
    transform: translateY(0);
}

.bill-name {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
    line-height: 1.3;
}

.bill-meta {
    font-family: var(--font-serif);
    font-size: 15px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
}

.bill-total {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--blue);
    font-feature-settings: "tnum";
}

/* Delete button in bill item */
.bill-item button {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: rgba(255, 59, 48, 0.1);
    color: var(--error-red);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bill-item button:hover {
    background: var(--error-red);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

@media (max-width: 767px) {
    .bill-item {
        padding: 16px;
    }
    
    .bill-item button {
        position: static;
        transform: none;
        margin-top: 16px;
        width: 100%;
        border-radius: 10px;
        height: 44px;
    }
    
    .bill-item button:hover {
        transform: none;
    }
}

/* Legacy class support */
.past-bills-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 450px;
    overflow-y: auto;
    padding-right: 8px;
}

.past-bill-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    background: var(--bg-light);
    border: 2px solid var(--border-color-light);
    border-radius: var(--radius-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.past-bill-item:hover {
    border-color: var(--color-primary);
    background: rgba(29, 94, 160, 0.04);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(29, 94, 160, 0.08);
}

.past-bill-info {
    flex: 1;
    min-width: 0;
}

.past-bill-name {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.past-bill-meta {
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--color-text-secondary);
}

.past-bill-amount {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 600;
    color: var(--color-primary);
    font-feature-settings: "tnum";
    white-space: nowrap;
}

.past-bill-actions {
    display: flex;
    gap: 8px;
}

.past-bill-delete-btn {
    background: var(--color-error);
    color: white;
    border: none;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.past-bill-delete-btn:hover {
    background: #e6342a;
    transform: scale(1.05);
}

@media (max-width: 767px) {
    .past-bill-item {
        flex-wrap: wrap;
    }
    
    .past-bill-amount {
        font-size: 20px;
        width: 100%;
        text-align: right;
        margin-top: 8px;
    }
}


/* ============================================
   SPLIT LINE ITEM MODAL - CLEAN REDESIGN
   ============================================ */

#splitModal .modal-content {
    max-width: 700px;
}

.split-line-item-header {
    background: linear-gradient(135deg, var(--blue-light), var(--color-primary));
    padding: 20px 28px;
    margin: -28px -28px 24px -28px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.split-line-item-name {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
}

.split-line-item-amount {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 600;
    color: white;
    font-feature-settings: "tnum";
}

.split-section-label {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 16px;
    display: block;
}

.split-property-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 24px;
}

.split-property-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: var(--bg-light);
    border: 2px solid var(--border-color-light);
    border-radius: var(--radius-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.split-property-item:hover {
    background: rgba(29, 94, 160, 0.04);
    border-color: var(--color-primary);
}

.split-property-item.selected {
    background: linear-gradient(135deg, rgba(29, 94, 160, 0.08) 0%, rgba(29, 94, 160, 0.02) 100%);
    border-color: var(--color-primary);
}

.split-property-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

.split-property-name {
    flex: 1;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
}

.split-property-percentage {
    width: 90px;
    padding: 8px 12px;
    font-family: var(--font-serif);
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    text-align: right;
    font-feature-settings: "tnum";
}

.split-property-percentage:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(29, 94, 160, 0.08);
}

.split-property-percentage:disabled {
    background: var(--bg-light);
    opacity: 0.5;
}

.split-summary {
    background: linear-gradient(135deg, rgba(242, 111, 101, 0.08) 0%, rgba(242, 111, 101, 0.02) 100%);
    border: 2px solid var(--color-coral);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 24px;
}

.split-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.split-summary-row:last-child {
    margin-bottom: 0;
    padding-top: 12px;
    border-top: 2px solid var(--color-coral);
}

.split-summary-label {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.split-summary-value {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 600;
    color: var(--color-primary);
    font-feature-settings: "tnum";
}

.split-summary-value.total {
    font-size: 24px;
    color: var(--color-coral);
}

.split-summary-value.error {
    color: var(--color-error);
}

@media (max-width: 767px) {
    .split-line-item-header {
        padding: 16px 20px;
        margin: -20px -20px 20px -20px;
    }
    
    .split-property-item {
        flex-wrap: wrap;
    }
    
    .split-property-percentage {
        width: 100%;
    }
}


/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: var(--color-text);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    pointer-events: all;
    animation: slideInFromRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 400px;
}

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

.toast.error {
    background: var(--color-error);
}

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

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 767px) {
    .toast-container {
        left: 20px;
        right: 20px;
        top: auto;
        bottom: 20px;
    }
    
    .toast {
        max-width: none;
    }
}


/* ============================================
   LOADING STATES
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7); /* Darker overlay */
    backdrop-filter: blur(8px); /* More blur */
    display: none; /* FIXED: Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.loading-overlay.show {
    display: flex; /* FIXED: Visible only when show class is present */
    opacity: 1;
    pointer-events: all;
}

/* Loading Container - Beautiful card */
.loading-container {
    background: white;
    border-radius: 20px;
    padding: 40px 50px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    min-width: 300px;
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Progress Bar Container */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(29, 94, 160, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

/* Progress Bar */
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--blue) 0%, #2d6eb0 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Animated shimmer effect */
.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Loading Text */
.loading-text {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
    margin: 0;
}

/* Loading Spinner - Improved */
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(29, 94, 160, 0.2);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@media (max-width: 767px) {
    .loading-container {
        padding: 32px 40px;
        min-width: 280px;
    }
    
    .loading-text {
        font-size: 16px;
    }
}


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

/* Spacing */
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }

.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }

.pt-1 { padding-top: var(--space-xs); }
.pt-2 { padding-top: var(--space-sm); }
.pt-3 { padding-top: var(--space-md); }
.pt-4 { padding-top: var(--space-lg); }
.pt-5 { padding-top: var(--space-xl); }

.pb-1 { padding-bottom: var(--space-xs); }
.pb-2 { padding-bottom: var(--space-sm); }
.pb-3 { padding-bottom: var(--space-md); }
.pb-4 { padding-bottom: var(--space-lg); }
.pb-5 { padding-bottom: var(--space-xl); }

/* Display */
.hidden { display: none !important; }
.block { display: block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Colors */
.text-primary { color: var(--color-primary); }
.text-coral { color: var(--color-coral); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-secondary { color: var(--color-text-secondary); }

/* Background Colors */
.bg-primary { background-color: var(--color-primary); }
.bg-coral { background-color: var(--color-coral); }
.bg-light { background-color: var(--bg-light); }
.bg-card { background-color: var(--bg-card); }


/* ============================================
   SCROLLBAR STYLING
   ============================================ */

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(29, 94, 160, 0.3) transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(29, 94, 160, 0.3);
    border-radius: var(--radius-full);
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(29, 94, 160, 0.5);
}


/* ============================================
   PROPERTY BREAKDOWN SECTION
   ============================================ */

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

.breakdown-search {
    flex: 0 0 auto;
    max-width: 300px;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-text);
    transition: var(--transition-fast);
}

.breakdown-search:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(29, 94, 160, 0.1);
}

.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
    min-height: 100px;
}

/* Stagger Animation - Property Cards Waterfall Effect */
.property-grid .property-card {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}

/* Individual delays for cascading effect (50ms stagger) */
.property-grid .property-card:nth-child(1)  { animation-delay: 0ms; }
.property-grid .property-card:nth-child(2)  { animation-delay: 50ms; }
.property-grid .property-card:nth-child(3)  { animation-delay: 100ms; }
.property-grid .property-card:nth-child(4)  { animation-delay: 150ms; }
.property-grid .property-card:nth-child(5)  { animation-delay: 200ms; }
.property-grid .property-card:nth-child(6)  { animation-delay: 250ms; }
.property-grid .property-card:nth-child(7)  { animation-delay: 300ms; }
.property-grid .property-card:nth-child(8)  { animation-delay: 350ms; }
.property-grid .property-card:nth-child(9)  { animation-delay: 400ms; }
.property-grid .property-card:nth-child(10) { animation-delay: 450ms; }
.property-grid .property-card:nth-child(11) { animation-delay: 500ms; }
.property-grid .property-card:nth-child(12) { animation-delay: 550ms; }

/* Cards beyond 12 get max delay to avoid slow page loads */
.property-grid .property-card:nth-child(n+13) { animation-delay: 550ms; }

/* When property-grid contains empty state, make it span full width */
.property-grid:has(.empty-state) {
    display: flex;
    justify-content: center;
    align-items: center;
}

.property-grid:empty {
    display: none; /* Hide completely when empty */
}

/* Empty state message (if needed) */
.property-grid-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
    font-family: var(--font-text);
    font-size: 15px;
}

@media (max-width: 767px) {
    .breakdown-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .breakdown-search {
        max-width: 100%;
    }
    
    .property-grid {
        grid-template-columns: 1fr;
    }
}


/* ============================================
   STATUS BOX
   ============================================ */

.status-box {
    background: white;
    border: 1px solid var(--border-color-light);
    border-left: 3px solid var(--blue);
    border-radius: 8px;
    padding: 16px 20px;
    margin: 20px 0;
    display: none; /* Hidden by default */
    align-items: center;
    min-height: 50px;
}

.status-box.show {
    display: flex; /* Show when needed */
}

.status-box.warning {
    border-left-color: #FFA500;
}

.status-box.error {
    border-left-color: var(--error-red);
}

.status-box.success {
    border-left-color: var(--success-green);
}

.status-text {
    font-size: 15px;
    color: var(--color-text-secondary);
    font-weight: 400;
    font-family: var(--font-text);
}

/* Remove emoji prefixes */
.status-text::before {
    content: '– ';
    margin-right: 6px;
    color: var(--blue);
}


/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 100px 40px; /* More vertical padding */
    background: transparent;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 0 auto; /* Center horizontally */
    max-width: 500px;
    min-height: 400px; /* Minimum height for vertical centering */
}

.empty-state-icon {
    font-size: 64px;
    line-height: 1;
    opacity: 0.5;
    margin-bottom: 8px;
}

.empty-state-text {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.empty-state-hint {
    font-family: var(--font-text);
    font-size: 16px;
    color: var(--color-text-secondary);
    margin: 0;
    max-width: 400px;
    line-height: 1.5;
}

@media (max-width: 767px) {
    .empty-state {
        padding: 80px 32px;
        min-height: 300px;
    }
    
    .empty-state-icon {
        font-size: 56px;
    }
    
    .empty-state-text {
        font-size: 20px;
    }
    
    .empty-state-hint {
        font-size: 15px;
    }
}


/* ============================================
   SUCCESS TOAST
   ============================================ */

.success-toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: linear-gradient(135deg, #34c759 0%, #2db34a 100%);
    border: none;
    border-radius: 16px;
    padding: 18px 24px;
    display: none; /* Hidden by default */
    align-items: center;
    gap: 14px;
    box-shadow: 0 12px 32px rgba(52, 199, 89, 0.3);
    z-index: 10000;
    min-width: 320px;
    animation: slideInBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.success-toast.show {
    display: flex;
}

@keyframes slideInBounce {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    50% {
        transform: translateY(-10px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.success-icon {
    font-size: 28px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.success-text {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: white;
    flex: 1;
    line-height: 1.4;
}

@media (max-width: 767px) {
    .success-toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
        min-width: auto;
    }
}


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

.footer {
    margin-top: 64px;
    padding: 32px 0;
    text-align: center;
    border-top: 2px solid var(--border-color-light);
    background: linear-gradient(to top, rgba(229, 231, 235, 0.3), transparent);
}

.footer-text {
    font-size: 13px;
    color: var(--color-text-secondary);
    font-family: var(--font-text);
    letter-spacing: 0.02em;
}

.footer-text strong {
    color: var(--blue);
    font-weight: 600;
    font-family: var(--font-display);
}


/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .hide-desktop {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
