/* NovaInvoice Main Styles */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f9fafb;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Prevent horizontal scrollbars */
}

/* Allow scrolling for public invoice page */
body.public-invoice {
    overflow-y: auto !important;
    height: auto !important;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Prevent nested scrolling issues */
.h-screen {
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
}

/* Ensure only one scrolling container */
.overflow-y-auto {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Fix scrolling in invoice pages */
.overflow-auto {
    overflow: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

.min-h-screen.bg-gray-100 {
    min-height: auto !important;
}

/* Fix invoice container on mobile */
@media (max-width: 640px) {
    .invoice-container {
        margin-bottom: 50px !important;
    }
    
    /* Mobile Bottom Action Bar Styles */
    .sm\\:hidden {
        display: block !important;
    }
    

    

    
    /* Note: Removed broad header button hiding rule - pages handle their own responsive design */
    
    /* Improve button layout */
    .flex-wrap {
        margin-bottom: 5px;
    }
    
    /* Force allow scroll on iOS */
    body.invoice-view, 
    body.invoice-preview {
        height: auto !important;
        position: static !important;
    }
    
    .overflow-y-auto {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Better dropdown positioning on mobile */
    .dropdown-menu {
        position: fixed !important;
        right: 16px !important;
        left: auto !important;
        max-width: calc(100vw - 32px) !important;
        width: 280px !important;
        border-radius: 16px !important;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
    
    /* Better spacing for mobile */
    .p-4 {
        padding: 16px !important;
    }
    
    .p-5 {
        padding: 20px !important;
    }
    
    /* Enhanced font sizing for mobile readability */
    .text-lg {
        font-size: 18px !important;
        line-height: 1.4 !important;
    }
    
    .text-base {
        font-size: 16px !important;
        line-height: 1.5 !important;
    }
    
    .text-sm {
        font-size: 14px !important;
        line-height: 1.4 !important;
    }
    
    /* Improved tap targets */
    .invoice-card-mobile a,
    .invoice-card-mobile button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better visual separation */
    .border-t {
        border-top-width: 2px !important;
        border-color: #f1f5f9 !important;
    }
    

    

    
    /* Prevent body scroll when modal is open but allow invoice content scroll */
    body.modal-open {
        overflow: hidden;
    }
    
    /* Better mobile scrolling */
    .overflow-y-auto {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Mobile-specific form container spacing */

}

/* Improved spacing for Bill To section */
.mb-8 h3.text-gray-700.font-semibold {
    margin-bottom: 12px !important;
    font-size: 1rem !important;
}

.mb-8 .font-bold.text-lg.text-gray-800 {
    margin-bottom: 10px !important;
}

.mb-8 .text-gray-600.mt-2 > div {
    margin-bottom: 6px !important;
    line-height: 1.5 !important;
}

/* Improved spacing for Items table */
table.w-full th {
    padding: 12px 16px !important;
    font-weight: 600 !important;
}

table.w-full td {
    padding: 14px 16px !important;
    vertical-align: top !important;
}

table.w-full td .font-medium.text-gray-700 {
    margin-bottom: 6px !important;
    display: block !important;
}

.item-suggestions {
    max-height: 200px;
    overflow-y: auto; 
    scrollbar-width: thin;
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(90deg, #4f46e5, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Hero Pattern Background */
.hero-pattern {
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%234f46e5' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* Invoice Illustration */
.invoice-illustration {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Status Badges */
.status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-sent {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.status-viewed {
    background-color: #DCFCE7;
    color: #15803D;
}

.status-pending {
    background-color: #FEF3C7;
    color: #9A3412;
}

.status-overdue {
    background-color: #FEE2E2;
    color: #B91C1C;
}

/* Auth Background Pattern */
.auth-bg-pattern {
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%234f46e5' fill-opacity='0.07'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Form Elements */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    font-size: 0.875rem;
}

.form-input:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Timeline */
.timeline-item {
    position: relative;
    padding-left: 30px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #e5e7eb;
}

.timeline-dot {
    position: absolute;
    left: -4px;
    top: 20px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid white;
}

/* Chart Container */
.chart-container {
    height: 240px;
    position: relative;
}

.mini-chart {
    height: 60px;
    width: 120px;
}

/* Toggle Switch */
.form-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.form-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e7eb;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4f46e5;
}

input:checked + .slider:before {
    transform: translateX(16px);
}

/* Feature Card */
.feature-card {
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Signature Image Standardization */
.signature-img {
    max-width: 180px;
    max-height: 60px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #fff;
    padding: 2px;
    display: inline-block;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 0 0.5rem;
    }
    
    /* Mobile Navigation */
    #nav-content {
        width: 100%;
        border-top: 1px solid #e5e7eb;
        margin-top: 1rem;
        padding-top: 1rem;
    }
    
    #nav-content.hidden {
        display: none;
    }
    
    /* Mobile menu button styling */
    #mobile-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
    }
    
    #mobile-menu-button:hover {
        color: #4f46e5;
        border-color: #4f46e5;
    }
    
    /* Mobile spacing for nav items */
    #nav-content .block {
        margin-bottom: 0.75rem;
    }
    
    /* Ensure proper spacing for buttons on mobile */
    #nav-content a {
        display: block;
        padding: 0.5rem 0;
    }
    
    /* Better touch targets for mobile */
    #nav-content a, 
    #mobile-menu-button,
    .form-input,
    button {
        min-height: 44px;
    }
    
    /* Prevent zoom on input focus for mobile */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    input[type="tel"],
    select,
    textarea {
        font-size: 16px !important; /* Prevents iOS zoom */
    }
    
    /* Improve touch targets for item selection */
    .item-name-input,
    .item-suggestions div {
        padding: 10px !important;
    }
    
    /* Make item cards more touch-friendly */
    .item-card {
        padding: 12px !important;
    }
    
    /* Ensure item suggestions are more touch-friendly */
    .item-suggestions {
        max-height: 250px !important;
    }
    
    /* Mobile-specific quantity button styling - CREATE INVOICE PAGE */
    .quantity-decrement, .quantity-increment {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        border-radius: 12px !important;
        font-size: 14px !important;
        border: 1px solid #e2e8f0 !important;
        background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: rgba(79, 70, 229, 0.15) !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06) !important;
        color: #6b7280 !important;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    @media (hover: hover) {
        .quantity-decrement:hover, .quantity-increment:hover {
            background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%) !important;
            color: white !important;
            border-color: #4f46e5 !important;
            transform: translateY(-1px) !important;
            box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25), 0 2px 6px rgba(79, 70, 229, 0.15) !important;
        }
    }
    
    .quantity-decrement:focus-visible, .quantity-increment:focus-visible {
        background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%) !important;
        color: white !important;
        border-color: #4f46e5 !important;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1), 0 4px 12px rgba(79, 70, 229, 0.15) !important;
        outline: none !important;
    }
    
    .quantity-decrement:active, .quantity-increment:active {
        background: linear-gradient(135deg, #3730a3 0%, #4338ca 100%) !important;
        transform: translateY(0) scale(0.98) !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* Adjust quantity input for better mobile experience */
    .item-quantity {
        padding-left: 52px !important;
        padding-right: 52px !important;
        min-height: 44px !important;
        font-size: 16px !important;
        text-align: center !important;
        font-weight: 500 !important;
        border-radius: 12px !important;
        border: 1px solid #e2e8f0 !important;
        background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    .item-quantity:focus {
        border-color: #4f46e5 !important;
        box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1), 0 1px 3px rgba(0, 0, 0, 0.1) !important;
        background: #ffffff !important;
    }
    
    /* Improved button positioning */
    .quantity-decrement {
        left: 2px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        border-top-right-radius: 4px !important;
        border-bottom-right-radius: 4px !important;
    }
    
    .quantity-increment {
        right: 2px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        border-top-left-radius: 4px !important;
        border-bottom-left-radius: 4px !important;
    }
    
    /* Better icon styling */
    .quantity-decrement i, .quantity-increment i {
        font-size: 16px !important;
        font-weight: 600 !important;
        line-height: 1 !important;
    }
    
    /* Hover states for buttons */
    .quantity-decrement:hover {
        transform: translateY(-50%) translateY(-1px) !important;
    }
    
    .quantity-increment:hover {
        transform: translateY(-50%) translateY(-1px) !important;
    }
    
    .quantity-decrement:active {
        transform: translateY(-50%) translateY(0) scale(0.98) !important;
    }
    
    .quantity-increment:active {
        transform: translateY(-50%) translateY(0) scale(0.98) !important;
    }
    
    /* Enhanced touch targets */
    .mobile-dropdown-button {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Improved invoice card spacing */
    .invoice-card-mobile {
        padding: 20px;
        margin-bottom: 8px;
    }
    
    /* Better button spacing and touch targets */
    .mobile-action-button {
        min-height: 40px;
        padding: 8px 12px;
        font-size: 14px;
        font-weight: 500;
    }
    
    /* Enhanced dropdown animations */
    .dropdown-menu {
        animation: slideDown 0.2s ease-out;
    }
    
    /* Better status badge visibility */
    .status-badge-mobile {
        padding: 6px 12px;
        font-size: 12px;
        font-weight: 600;
        border-radius: 16px;
    }
    
    /* Improved date information layout */
    .date-info-mobile {
        background: #f8fafc;
        padding: 12px;
        border-radius: 8px;
        margin: 12px 0;
    }
    
    /* Enhanced filter section */
    .filter-mobile {
        padding: 16px;
        background: white;
        border-radius: 12px;
        margin-bottom: 16px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    /* Mobile header improvements */
    header {
        min-height: 60px;
    }
    
    header h1 {
        font-size: 18px !important;
        line-height: 1.2 !important;
    }
    
    /* Mobile header buttons */
    header a {
        min-height: 40px;
        min-width: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Compact spacing on mobile */
    header .space-x-2 > * + * {
        margin-left: 6px !important;
    }
    
    /* Icon-only buttons on very small screens */
    @media (max-width: 360px) {
        header a span {
            display: none !important;
        }
        
        header a {
            padding: 8px !important;
            min-width: 36px;
        }
    }
    
    /* Mobile filter dropdowns */
    #client-filter,
    #status-filter {
        min-height: 44px;
        font-size: 16px !important; /* Prevent zoom on iOS */
    }
    
    /* Mobile filter toggle button */
    #mobile-filter-toggle {
        min-width: 40px;
        min-height: 40px;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        position: relative;
        z-index: 10;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    #mobile-filter-toggle:hover {
        background-color: rgba(99, 102, 241, 0.1);
        color: rgb(99, 102, 241);
    }
    
    #mobile-filter-toggle:active {
        transform: scale(0.95);
        background-color: rgba(99, 102, 241, 0.15);
    }
    
    #mobile-filter-toggle i {
        pointer-events: none;
        font-size: 14px;
    }
    
    /* Clear search button improvements */
    #clear-search {
        min-width: 32px;
        min-height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    #clear-search:active {
        transform: scale(0.95);
        background-color: rgba(156, 163, 175, 0.15);
    }
    
    #clear-search i {
        pointer-events: none;
    }
    
    /* Mobile filter panel */
    #mobile-filter-panel {
        transition: max-height 0.3s ease-in-out, opacity 0.2s ease-in-out;
        opacity: 1;
    }
    
    #mobile-filter-panel[style*="max-height: 0"] {
        opacity: 0;
    }
    
    /* Enhanced mobile search input */
    @media (max-width: 768px) {
        #search-input {
            font-size: 16px !important; /* Prevent zoom on iOS */
            padding: 12px 88px 12px 40px !important;
            border-radius: 12px !important;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
        }
        
        #search-input:focus {
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
        }
        
        /* Mobile button container improvements */
        .absolute.inset-y-0.right-0 {
            right: 0 !important;
            top: 0 !important;
            bottom: 0 !important;
            display: flex !important;
            align-items: center !important;
            padding-right: 12px !important;
        }
        
        /* Ensure buttons don't overlap */
        #mobile-filter-toggle,
        #clear-search {
            flex-shrink: 0;
            position: relative;
            z-index: 20;
        }
        
        /* Mobile filter panel styling */
        #mobile-filter-panel .bg-gray-50 {
            background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
            border: 1px solid #e2e8f0 !important;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
        }
        
        /* Mobile filter select styling */
        #mobile-filter-panel select {
            font-size: 16px !important; /* Prevent zoom on iOS */
            min-height: 44px !important;
            border-radius: 8px !important;
            border: 1px solid #d1d5db !important;
            background: white !important;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
        }
        
        #mobile-filter-panel select:focus {
            border-color: rgb(99, 102, 241) !important;
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
        }
    }
    
    /* Filter buttons mobile layout */
    .filter-buttons-mobile {
        display: flex;
        gap: 8px;
        margin-top: 12px;
    }
    
    .filter-buttons-mobile button {
        min-height: 44px;
        min-width: 44px;
        flex: 1;
    }
    
    /* Active filter badges mobile */
    .filter-badge-mobile {
        display: inline-flex;
        align-items: center;
        padding: 6px 12px;
        margin: 4px 4px 4px 0;
        background: #e0f2fe;
        color: #0369a1;
        border-radius: 16px;
        font-size: 12px;
        font-weight: 500;
    }
    
    /* Filter clear button mobile */
    .filter-clear-mobile {
        background: #fee2e2;
        color: #dc2626;
        padding: 4px 8px;
        border-radius: 12px;
        font-size: 11px;
    }
    
    /* Mobile search container improvements */
    @media (max-width: 768px) {
        .relative form {
            position: relative;
        }
        
        .relative form input {
            width: 100%;
        }
        
        /* Better visual feedback for mobile interactions */
        #mobile-filter-toggle:active {
            transform: scale(0.95);
            background-color: rgba(99, 102, 241, 0.15);
        }
        
        /* Fix search input container positioning */
        .relative form {
            position: relative;
        }
        
        .relative form .absolute.inset-y-0.right-0 {
            display: flex;
            align-items: center;
            padding-right: 12px;
            pointer-events: none;
        }
        
        .relative form .absolute.inset-y-0.right-0 > * {
            pointer-events: auto;
        }
        
        /* Ensure proper button spacing */
        #search-input {
            padding-right: 88px !important; /* Space for clear + filter buttons */
        }
        
        /* When no search term, only filter button */
        #search-input:not([value]):not(:focus) {
            padding-right: 52px !important; /* Space for filter button only */
        }
        
        /* Mobile filter panel animation improvements */
        #mobile-filter-panel {
            will-change: max-height, opacity;
        }
        
        /* Enhanced mobile filter button styling */
        #mobile-filter-panel .inline-flex {
            min-height: 44px;
            touch-action: manipulation;
        }
        
        /* Better mobile spacing for filter sections */
        .p-4.md\\:p-6.border-b {
            padding: 1rem !important;
        }
        
        /* Mobile header improvements */
        .text-lg.md\\:text-xl {
            font-size: 1.125rem !important;
        }
        
        /* Mobile filter badge improvements */
        .inline-flex.items-center.px-2\.5 {
            min-height: 24px;
            touch-action: manipulation;
        }
        
        /* Mobile invoice count styling */
        .text-xs.sm\\:text-sm.text-gray-500 {
            font-weight: 500;
            color: #6b7280;
        }
        
        .sm\\:hidden {
            background: rgba(99, 102, 241, 0.08);
            padding: 3px 6px;
            border-radius: 6px;
            font-size: 10px;
            font-weight: 600;
            color: #4f46e5;
            display: inline-block;
            white-space: nowrap;
            vertical-align: middle;
        }
        
        /* Mobile title improvements */
        .text-lg.md\\:text-xl.font-semibold {
            font-size: 1.125rem !important;
            line-height: 1.3 !important;
        }
    }
}

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

/* Enhanced hover effects for mobile */
@media (max-width: 768px) {
    .invoice-card-mobile:active {
        transform: scale(0.98);
        transition: transform 0.1s ease-in-out;
    }
    
    .mobile-action-button:active {
        transform: scale(0.95);
        transition: transform 0.1s ease-in-out;
    }
    
    /* Better visual feedback */
    .dropdown-menu a:active,
    .dropdown-menu button:active {
        background-color: rgba(99, 102, 241, 0.1) !important;
        transform: scale(0.98);
    }
}

@media (max-width: 480px) {
    /* Smaller screens adjustments */
    .text-2xl {
        font-size: 1.25rem;
    }
    
    /* Tighter spacing for very small screens */
    .container {
        padding: 0 0.25rem;
    }
    
    /* Mobile-specific item grid adjustments */
    .mobile-items-grid .item-card {
        margin-bottom: 1rem;
    }
    
    .mobile-items-grid .item-card h3,
    .mobile-items-grid .item-card p,
    .mobile-items-grid .item-card button {
        font-size: 16px !important;
    }
    
    .mobile-items-grid .item-card .quick-add-item-button,
    .mobile-items-grid .item-card .preview-item-button {
        padding: 8px 12px !important;
        min-height: 44px !important;
    }
    
    /* Improve checkbox size for touch */
    .select-item-checkbox {
        width: 24px !important;
        height: 24px !important;
    }
}

/* Enhanced Dropdown Styles */
.dropdown-button:focus-visible {
    ring-color: #6366f1;
    ring-width: 2px;
    ring-offset-width: 2px;
}

.dropdown-menu {
    animation: dropdown-appear 0.15s ease-out;
    transform-origin: top right;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Smart positioning for dropdowns */
.dropdown-menu.position-above {
    transform-origin: bottom right;
    bottom: 100%;
    top: auto;
    margin-bottom: 8px;
    margin-top: 0;
}

.dropdown-menu.position-below {
    transform-origin: top right;
    top: 100%;
    bottom: auto;
    margin-top: 8px;
    margin-bottom: 0;
}

/* Mobile-specific dropdown improvements */
@media (max-width: 768px) {
    .dropdown-menu {
        position: fixed !important;
        right: 8px !important;
        left: auto !important;
        max-width: calc(100vw - 16px) !important;
        width: 280px !important;
        max-height: 70vh !important;
        border-radius: 16px !important;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 60 !important;
    }
    
    /* Mobile positioning adjustments */
    .dropdown-menu.position-above {
        bottom: 60px !important;
        top: auto !important;
    }
    
    .dropdown-menu.position-below {
        top: auto !important;
        bottom: auto !important;
        transform: translateY(-50%);
    }
    
    /* Center dropdown vertically on mobile when needed */
    .dropdown-menu.position-center {
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%);
    }
}

/* Better visual hierarchy for amounts */
.amount-mobile {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Enhanced status indicators */
.status-overdue-mobile {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
    border: 1px solid #f87171;
}

.status-paid-mobile {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #16a34a;
    border: 1px solid #4ade80;
}

.status-draft-mobile {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: #6b7280;
    border: 1px solid #9ca3af;
}

@keyframes dropdown-appear {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Dropdown menu item hover states */
.dropdown-menu a:hover,
.dropdown-menu button:hover {
    transform: translateX(2px);
    transition: all 0.15s ease-in-out;
}

/* Icon background hover animations */
.dropdown-menu .group:hover .w-8.h-8 {
    transform: scale(1.05);
    transition: all 0.15s ease-in-out;
}

/* Mobile Button Fixes - Create Invoice Page Specific */
@media (max-width: 640px) {
    /* Only hide buttons on create-invoice page (already handled by hidden sm:flex classes) */
    /* Other pages should show their header buttons on mobile */
    
    /* Mobile-optimized Saved Items Modal */
    #item-selector-modal .item-card {
        min-height: 100px !important;
        touch-action: manipulation !important;
    }
    
    #item-selector-modal .item-card .quick-add-item-button,
    #item-selector-modal .item-row .quick-add-item-button {
        min-height: 36px !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    #item-selector-modal .item-card .preview-item-button,
    #item-selector-modal .item-row .preview-item-button {
        min-height: 36px !important;
        min-width: 36px !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    /* Better spacing for modal on mobile */
    #item-selector-modal .item-card {
        margin-bottom: 10px !important;
    }
    
    #item-selector-modal .item-row {
        margin-bottom: 6px !important;
    }
    
    /* Enhanced touch feedback */
    #item-selector-modal .item-card:active {
        transform: scale(0.98) !important;
    }
    
    #item-selector-modal .item-row:active {
        transform: scale(0.99) !important;
    }
    
    /* Ensure modal takes full screen on mobile */
    #item-selector-modal {
        padding: 8px !important;
    }
    
    #item-selector-modal > div {
        max-height: 95vh !important;
        margin: 0 !important;
    }
    
    /* Mobile grid adjustments */
    #item-selector-modal .grid-cols-1 {
        gap: 8px !important;
    }
    
    /* Better button text on mobile */
    #item-selector-modal .quick-add-item-button {
        font-weight: 600 !important;
    }
    
    /* Compact text on mobile */
    #item-selector-modal .item-card h3 {
        font-size: 0.875rem !important;
        line-height: 1.25 !important;
    }
    
    #item-selector-modal .item-card p {
        font-size: 0.75rem !important;
        line-height: 1.25 !important;
    }
    
    #item-selector-modal .item-row h3 {
        font-size: 0.875rem !important;
        line-height: 1.25 !important;
    }
    
    #item-selector-modal .item-row p {
        font-size: 0.75rem !important;
        line-height: 1.25 !important;
    }
    
    /* Hide close X button on mobile since there's a Close button at bottom */
    #item-selector-modal #close-item-selector {
        display: none !important;
    }
}

/* PWA-specific mobile enhancements */
@media (max-width: 768px) {
    /* Touch-friendly button sizes */
    button, .button, a.button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Prevent zoom on input focus */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px;
    }
    
    /* PWA safe area adjustments */
    .pwa-safe-area {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    /* PWA standalone mode adjustments */
    .pwa-standalone .mobile-header {
        padding-top: calc(16px + env(safe-area-inset-top));
    }
    
    /* Better mobile cards */
    .mobile-card:active {
        transform: translateY(1px);
        box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    }
    
    /* Better mobile navigation */
    .mobile-nav-item:active {
        transform: scale(0.98);
        background-color: rgba(79, 70, 229, 0.1);
    }
    
    /* Landscape orientation optimizations */
    @media (orientation: landscape) {
        .landscape-optimize {
            padding: 8px 16px;
        }
    }
}

/* Dark mode mobile optimizations */
@media (max-width: 768px) and (prefers-color-scheme: dark) {
    .mobile-dark-card {
        background: #1f2937;
        border-color: #374151;
        color: white;
    }
}

/* Reduced motion preferences */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    .mobile-card,
    .mobile-nav-item,
    .mobile-form-input,
    .mobile-modal {
        transition: none;
    }
}
