/* Custom styles for the Quotation Generator - iOS Inspired Design */

:root {
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-red: #FF3B30;
    --ios-yellow: #FFCC00;
    --ios-orange: #FF9500;
    --ios-purple: #AF52DE;
    --ios-teal: #5AC8FA;
    --ios-gray: #8E8E93;
    --ios-border-radius: 12px;
    --ios-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
    --ios-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    /* Mobile-first variables */
    --navbar-height: 72px;
    --navbar-height-mobile: 64px;
    --mobile-spacing: 1rem;
    --mobile-border-radius: 8px;
    --mobile-touch-target: 44px;
    --mobile-font-size: 16px;
}

/* Mobile Utility Classes */
.mobile-only { display: none !important; }
.desktop-only { display: block !important; }

@media (max-width: 991.98px) {
    .mobile-only { display: block !important; }
    .desktop-only { display: none !important; }
    
    :root {
        --navbar-height: var(--navbar-height-mobile);
    }
}

/* Safe area support for iOS devices */
@supports (padding: max(0px)) {
    .safe-area-inset-top { padding-top: max(var(--navbar-height), env(safe-area-inset-top)); }
    .safe-area-inset-bottom { padding-bottom: env(safe-area-inset-bottom); }
    .safe-area-inset-left { padding-left: env(safe-area-inset-left); }
    .safe-area-inset-right { padding-right: env(safe-area-inset-right); }
}

/* Mobile spacing utilities */
.stack-sm > * + * { margin-top: 0.5rem; }
.stack-md > * + * { margin-top: 1rem; }
.stack-lg > * + * { margin-top: 1.5rem; }

/* Mobile layout helpers */
.mobile-full-width { width: 100%; }
.mobile-single-column { 
    display: flex !important;
    flex-direction: column !important;
    gap: var(--mobile-spacing);
}

/* Minimum touch targets */
.touch-target {
    min-height: var(--mobile-touch-target);
    min-width: var(--mobile-touch-target);
}

/* Text utilities for mobile */
.mobile-text-sm { font-size: 0.875rem; }
.mobile-text-base { font-size: var(--mobile-font-size); }
.mobile-text-lg { font-size: 1.125rem; }

/* Sticky elements */
.sticky-top-mobile {
    position: sticky;
    top: var(--navbar-height);
    z-index: 1020;
}

/* Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    font-weight: 400;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

.navbar {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: rgba(33, 37, 41, 0.85) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 12px rgba(0, 0, 0, 0.15);
    height: var(--navbar-height);
    transition: var(--ios-transition);
}

/* Mobile navbar optimization */
@media (max-width: 991.98px) {
    .navbar {
        height: var(--navbar-height-mobile);
        padding: 0.5rem 0;
    }
    
    .navbar-toggler {
        border: none;
        padding: 0.25rem;
        min-height: var(--mobile-touch-target);
        min-width: var(--mobile-touch-target);
    }
    
    .navbar-toggler:focus {
        box-shadow: none;
    }
    
    .navbar-collapse {
        margin-top: 1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        font-size: var(--mobile-font-size);
        border-radius: var(--mobile-border-radius);
        margin: 0.25rem 0;
        transition: var(--ios-transition);
    }
    
    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link:focus {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .dropdown-menu {
        position: static !important;
        float: none !important;
        background-color: rgba(255, 255, 255, 0.05);
        border: none;
        box-shadow: none;
        padding: 0.5rem 0;
        margin-left: 1rem;
        border-radius: var(--mobile-border-radius);
    }
    
    .dropdown-item {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        border-radius: var(--mobile-border-radius);
        margin: 0.125rem 0.5rem;
    }
    
    .dropdown-item:hover,
    .dropdown-item:focus {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

.navbar-brand {
    font-weight: 600;
    letter-spacing: -0.5px;
}

/* Card styling - iOS inspired */
.card {
    border-radius: var(--ios-border-radius);
    border: none;
    box-shadow: var(--ios-shadow);
    transition: var(--ios-transition);
    margin-bottom: 1.5rem;
    background-color: rgba(33, 37, 41, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.card-header {
    border-top-left-radius: var(--ios-border-radius) !important;
    border-top-right-radius: var(--ios-border-radius) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 1.25rem;
    background-color: rgba(33, 37, 41, 0.5);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(33, 37, 41, 0.5);
}

/* Dashboard stats - iOS style */
.stats-card {
    border-radius: var(--ios-border-radius);
    overflow: hidden;
    box-shadow: var(--ios-shadow);
    transition: var(--ios-transition);
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.2);
}

.stats-card .icon {
    font-size: 2.5rem;
}

.stats-icon-blue { color: var(--ios-blue); }
.stats-icon-green { color: var(--ios-green); }
.stats-icon-orange { color: var(--ios-orange); }
.stats-icon-purple { color: var(--ios-purple); }

/* Form Controls - iOS style */
.form-control, .form-select {
    border-radius: var(--ios-border-radius);
    padding: 0.6rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.05);
    transition: var(--ios-transition);
    font-size: var(--mobile-font-size);
    min-height: var(--mobile-touch-target);
}

.form-control:focus, .form-select:focus {
    border-color: var(--ios-blue);
    box-shadow: 0 0 0 0.2rem rgba(0, 122, 255, 0.25);
}

textarea.form-control {
    min-height: 100px;
    line-height: 1.5;
    resize: vertical;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: var(--mobile-font-size);
}

/* Mobile form optimizations */
@media (max-width: 991.98px) {
    .form-control, .form-select {
        padding: 0.75rem 1rem;
        font-size: var(--mobile-font-size);
        border-radius: var(--mobile-border-radius);
        min-height: var(--mobile-touch-target);
    }
    
    .form-label {
        font-size: var(--mobile-font-size);
        font-weight: 600;
        margin-bottom: 0.5rem;
    }
    
    /* Stack form rows on mobile */
    .row.g-3 > .col-md-6,
    .row.g-3 > .col-lg-6,
    .row.g-3 > .col-6 {
        margin-bottom: 1rem;
    }
    
    /* Full width inputs on small screens */
    .form-control,
    .form-select {
        width: 100%;
    }
    
    /* Better spacing for form groups */
    .mb-3 {
        margin-bottom: 1.5rem !important;
    }
    
    /* Improve checkbox and radio controls */
    .form-check {
        min-height: var(--mobile-touch-target);
        display: flex;
        align-items: center;
        padding-left: 2rem;
    }
    
    .form-check-input {
        width: 1.5rem;
        height: 1.5rem;
        margin-left: -2rem;
        margin-top: 0;
    }
    
    .form-check-label {
        font-size: var(--mobile-font-size);
        line-height: 1.5;
        margin-left: 0.5rem;
    }
}

/* Buttons - iOS style */
.btn {
    border-radius: var(--ios-border-radius);
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: var(--ios-transition);
    min-height: var(--mobile-touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Mobile button optimizations */
@media (max-width: 991.98px) {
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: var(--mobile-font-size);
        border-radius: var(--mobile-border-radius);
        min-height: var(--mobile-touch-target);
        min-width: var(--mobile-touch-target);
    }
    
    .btn-sm {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
        min-height: 40px;
    }
    
    .btn-lg {
        padding: 1rem 2rem;
        font-size: 1.125rem;
        min-height: 56px;
    }
    
    /* Full width buttons on mobile */
    .btn-mobile-full {
        width: 100%;
        justify-content: center;
    }
    
    /* Button groups stack on mobile */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        border-radius: var(--mobile-border-radius) !important;
        margin-bottom: 0.5rem;
    }
    
    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
}

.btn-primary {
    background-color: var(--ios-blue);
    border-color: var(--ios-blue);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #0069d9;
    border-color: #0062cc;
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--ios-green);
    border-color: var(--ios-green);
}

.btn-danger {
    background-color: var(--ios-red);
    border-color: var(--ios-red);
}

.btn-warning {
    background-color: var(--ios-yellow);
    border-color: var(--ios-yellow);
    color: #212529;
}

.btn-outline-secondary {
    border-color: var(--ios-gray);
    color: var(--ios-gray);
}

.btn-outline-secondary:hover {
    background-color: var(--ios-gray);
    color: white;
}

/* Table styling */
.table {
    border-radius: var(--ios-border-radius);
    overflow: hidden;
    margin-bottom: 2rem;
}

.table thead th {
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: none;
    padding: 1rem;
    font-weight: 600;
    color: white;
}

.table tbody td {
    padding: 1rem;
    border-color: rgba(255, 255, 255, 0.05);
}

.table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Status badges - iOS style */
.badge {
    font-weight: 500;
    padding: 0.5em 1em;
    border-radius: 20px;
}

.badge-draft {
    background-color: var(--ios-gray);
}

.badge-sent {
    background-color: var(--ios-blue);
}

.badge-accepted, .badge-paid {
    background-color: var(--ios-green);
}

.badge-rejected, .badge-overdue {
    background-color: var(--ios-red);
}

/* Template card styling */
.border-dashed {
    border: 2px dashed rgba(255, 255, 255, 0.2) !important;
    border-radius: var(--ios-border-radius);
}

.template-thumbnail {
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--ios-border-radius);
    background-color: rgba(255, 255, 255, 0.05);
    margin-bottom: 1rem;
}

.template-features {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 1rem;
}

.template-features li {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.template-features li i {
    color: var(--ios-green);
    margin-right: 0.5rem;
}

/* Quotation preview */
.quotation-preview {
    background-color: white;
    color: #212529;
    border-radius: var(--ios-border-radius);
    padding: 2rem;
    box-shadow: var(--ios-shadow);
}

/* Alerts - iOS style */
.alert {
    border-radius: var(--ios-border-radius);
    border: none;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.alert-success {
    background-color: rgba(52, 199, 89, 0.2);
    color: var(--ios-green);
}

.alert-danger {
    background-color: rgba(255, 59, 48, 0.2);
    color: var(--ios-red);
}

.alert-warning {
    background-color: rgba(255, 204, 0, 0.2);
    color: var(--ios-yellow);
}

.alert-info {
    background-color: rgba(90, 200, 250, 0.2);
    color: var(--ios-teal);
}

/* Footer styling */
.footer {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: rgba(33, 37, 41, 0.85) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 0;
}

/* Mobile-First Responsive Design */

/* Better mobile navigation */
.navbar-nav {
    width: 100%;
}

.navbar-nav .nav-link {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-menu {
    width: 100%;
    border-radius: 0;
    margin-top: 0;
    border: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Better mobile tables - convert to cards */
@media (max-width: 992px) {
    .table-responsive table {
        display: none;
    }
    
    .mobile-card-view {
        display: block;
    }
    
    .mobile-item-card {
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--ios-border-radius);
        padding: 1.5rem;
        margin-bottom: 1rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mobile-item-header {
        display: flex;
        justify-content: between;
        align-items: start;
        margin-bottom: 1rem;
    }
    
    .mobile-item-title {
        font-weight: 600;
        font-size: 1.1rem;
    }
    
    .mobile-item-subtitle {
        color: rgba(255, 255, 255, 0.7);
        font-size: 0.9rem;
    }
    
    .mobile-item-details {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }
    
    .mobile-detail-item {
        display: flex;
        flex-direction: column;
    }
    
    .mobile-detail-label {
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.6);
        margin-bottom: 0.25rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .mobile-detail-value {
        font-weight: 500;
    }
    
    .mobile-actions {
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .mobile-actions .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem;
        flex: 1;
    }
}

/* Improved touch targets */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .btn-sm {
        min-height: 40px;
        padding: 0.5rem 1rem;
    }
    
    .form-control, .form-select {
        min-height: 50px;
        padding: 0.875rem 1rem;
        font-size: 16px; /* Prevents zoom on mobile */
    }
    
    /* Mobile-specific quotation table improvements */
    .table-responsive {
        border: none;
    }
    
    #items_table {
        font-size: 14px;
    }
    
    #items_table td {
        padding: 8px 4px;
        vertical-align: middle;
    }
    
    #items_table .form-control {
        min-height: 44px;
        padding: 8px;
        font-size: 16px;
        border-radius: 6px;
    }
    
    #items_table .btn {
        padding: 6px 8px;
        font-size: 14px;
    }
    
    /* Make Add Item button more prominent on mobile */
    #add_item_btn {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        margin-bottom: 1rem;
    }
    
    .card-title {
        font-size: 1.4rem;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .stats-card .icon {
        font-size: 2rem;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .display-5 {
        font-size: 2rem;
    }
    
    .stats-icon-circle {
        width: 55px;
        height: 55px;
    }
    
    /* Larger dropdowns on mobile */
    .dropdown-menu {
        font-size: 1rem;
    }
    
    .dropdown-item {
        padding: 1rem 1.5rem;
    }
    
    /* Better mobile modals */
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    /* Mobile-friendly alerts */
    .alert {
        padding: 1.25rem;
        border-radius: var(--ios-border-radius);
    }
    
    /* Better mobile footer */
    .footer {
        text-align: center;
    }
    
    .footer .d-flex {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Additional mobile optimizations */
@media (max-width: 576px) {
    .container {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }
    
    /* Mobile-first container padding */
    body .container {
        padding-top: 90px;
    }
    
    .hero-card .card-body {
        padding: 1.5rem 1rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.3rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 1rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .navbar-nav .nav-link {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }
    
    .dropdown-menu {
        min-width: 100%;
        max-width: 100%;
        border-radius: 0;
        margin-top: 0;
    }
    
    /* Stack action buttons vertically */
    .mobile-actions {
        flex-direction: column;
    }
    
    .mobile-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Larger text for readability */
    body {
        font-size: 1rem;
        line-height: 1.6;
    }
    
    .lead {
        font-size: 1.1rem;
    }
    
    .small, small {
        font-size: 0.9rem;
    }
    
    /* Better mobile cards */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Mobile badges */
    .badge {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Full width buttons on small screens */
    .btn-group {
        width: 100%;
    }
    
    .btn-group .btn {
        flex: 1;
    }
    
    /* Mobile-specific navbar improvements */
    .navbar-toggler {
        padding: 0.75rem;
        font-size: 1.25rem;
        border: none;
    }
    
    .navbar-toggler:focus {
        box-shadow: none;
    }
    
    .navbar-collapse {
        background-color: rgba(33, 37, 41, 0.98);
        margin: 0 -1rem;
        padding: 1rem;
        border-radius: 0 0 var(--ios-border-radius) var(--ios-border-radius);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    /* Better mobile search and filters */
    .row.mb-4 {
        margin-bottom: 1rem !important;
    }
    
    .input-group .form-control {
        border-radius: var(--ios-border-radius) 0 0 var(--ios-border-radius);
    }
    
    .input-group .btn {
        border-radius: 0 var(--ios-border-radius) var(--ios-border-radius) 0;
    }
    
    /* Mobile hero section */
    .hero-card .col-lg-5 {
        display: none !important;
    }
    
    .hero-card .col-lg-7 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Mobile action buttons improvements */
    .d-flex.flex-wrap.gap-2 {
        flex-direction: column !important;
        align-items: stretch;
    }
    
    .d-flex.flex-wrap.gap-2 .btn {
        width: 100%;
        margin: 0 0 0.5rem 0 !important;
        justify-content: center;
    }
}

/* Theme selector in settings page */
.theme-card {
    cursor: pointer;
    border: 2px solid transparent;
    overflow: hidden;
    transition: var(--ios-transition);
}

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

.theme-active {
    border-color: var(--ios-blue);
}

.theme-active .theme-check {
    color: var(--ios-blue);
    opacity: 1;
}

.theme-check {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.theme-preview {
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.theme-navbar {
    height: 20px;
    width: 100%;
}

.theme-content {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 5px;
}

.theme-card-1, .theme-card-2 {
    height: 35px;
    border-radius: 5px;
}

.theme-card-1 {
    width: 100%;
}

.theme-card-2 {
    width: 48%;
}

/* iOS theme preview */
.ios-preview {
    background-color: #1E1E1E;
}

.ios-preview .theme-navbar {
    background-color: rgba(52, 52, 52, 0.8);
    backdrop-filter: blur(10px);
}

.ios-preview .theme-card-1 {
    background-color: rgba(52, 52, 52, 0.8);
}

.ios-preview .theme-card-2:nth-child(1) {
    background-color: rgba(0, 122, 255, 0.15);
}

.ios-preview .theme-card-2:nth-child(2) {
    background-color: rgba(52, 199, 89, 0.15);
}

/* Dark GPT theme preview */
.dark-gpt-preview {
    background-color: #000000;
}

.dark-gpt-preview .theme-navbar {
    background-color: #000000;
    border-bottom: 1px solid #333;
}

.dark-gpt-preview .theme-card-1 {
    background-color: #444654;
}

.dark-gpt-preview .theme-card-2:nth-child(1) {
    background: linear-gradient(to bottom right, #FFD60A, #FB8B24);
}

.dark-gpt-preview .theme-card-2:nth-child(2) {
    background: linear-gradient(to bottom right, #00C6FF, #0072FF);
}

/* Modern Code theme preview */
.modern-code-preview {
    background-color: #0e1117;
    padding: 6px;
    border-radius: 6px;
}

.modern-code-preview .theme-navbar {
    background-color: #151922;
    height: 20px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.modern-code-preview .theme-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modern-code-preview .theme-card-1 {
    background-color: #151922;
    height: 25px;
    border-radius: 6px;
    border: 1px solid #2d3748;
}

.modern-code-preview .theme-card-2 {
    background-color: rgba(33, 37, 48, 0.6);
    height: 25px;
    border-radius: 6px;
    border: 1px solid #2d3748;
}

/* Dropdown menu styling - iOS inspired */
.dropdown-menu {
    border-radius: var(--ios-border-radius);
    border: none;
    box-shadow: var(--ios-shadow);
    background-color: rgba(33, 37, 41, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.75rem 0;
    margin-top: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease-in-out;
}

.dropdown-menu.show {
    opacity: 1;
    transform: translateY(0);
}

.dropdown-item {
    padding: 0.65rem 1.5rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    transition: all 0.2s ease;
}

.dropdown-item:hover, .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.dropdown-item:active {
    background-color: var(--ios-blue);
    color: white;
}

/* Touch-friendly improvements for all mobile devices */
@media (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .form-control, .form-select {
        min-height: 50px;
        font-size: 16px; /* Prevents zoom on mobile */
    }
    
    .dropdown-item {
        padding: 1rem 1.5rem;
    }
    
    /* Quotation table improvements for touch devices */
    #items_table .form-control {
        min-height: 48px;
        padding: 12px 8px;
        font-size: 16px;
    }
    
    #items_table .btn {
        min-height: 40px;
        min-width: 40px;
        padding: 8px;
    }
    
    /* Hover states for touch devices */
    .btn:active, .card:active, .dropdown-item:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* Mobile screens - show cards instead of tables */
@media (max-width: 991.98px) {
    /* Hide table layout on mobile screens - Quotations */
    #items_table {
        display: none !important;
    }
    
    /* Hide table layout on mobile screens - Invoices */
    #desktop-items-table {
        display: none !important;
    }
    
    /* Show mobile card layout instead */
    .mobile-items-container {
        display: block !important;
    }
    
    .mobile-item-card {
        background: var(--bs-card-bg, white);
        border: 1px solid var(--bs-border-color, #dee2e6);
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 1rem;
        position: relative;
    }
    
    .mobile-item-card .form-control {
        min-height: 48px;
        font-size: 16px;
        margin-bottom: 0.5rem;
    }
    
    .mobile-item-card .input-group {
        margin-bottom: 0.5rem;
    }
    
    .mobile-item-card .remove-btn {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        min-height: 36px;
        min-width: 36px;
        padding: 6px;
    }
    
    .mobile-item-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
        padding-right: 50px; /* Space for delete button */
    }
    
    .mobile-item-number {
        font-weight: 600;
        color: var(--bs-primary, #0d6efd);
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .navbar {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Android Chrome specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: .001dpcm) {
    .form-control {
        appearance: none;
    }
}

/* Table to Card Mobile Optimizations */
@media (max-width: 991.98px) {
    /* Hide traditional table on mobile */
    .table-responsive .table {
        display: none;
    }
    
    /* Mobile card layout for table data */
    .mobile-card-list {
        display: block;
    }
    
    .mobile-table-card {
        background: var(--card-bg, rgba(33, 37, 41, 0.7));
        border-radius: var(--mobile-border-radius);
        border: 1px solid rgba(255, 255, 255, 0.1);
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: var(--ios-shadow);
    }
    
    .mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 0.75rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mobile-card-title {
        font-weight: 600;
        font-size: 1.1rem;
        margin: 0;
        color: var(--primary-text, #ffffff);
    }
    
    .mobile-card-subtitle {
        font-size: 0.875rem;
        color: var(--secondary-text, #8E8E93);
        margin: 0.25rem 0 0 0;
    }
    
    .mobile-card-body {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mobile-card-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.25rem 0;
    }
    
    .mobile-card-label {
        font-weight: 500;
        color: var(--secondary-text, #8E8E93);
        font-size: 0.875rem;
        flex: 0 0 auto;
        min-width: 120px;
    }
    
    .mobile-card-value {
        text-align: right;
        flex: 1;
        font-size: 0.9rem;
    }
    
    .mobile-card-actions {
        margin-top: 1rem;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .mobile-card-actions .btn {
        flex: 1;
        min-width: 120px;
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
    
    /* Badge adjustments for mobile cards */
    .mobile-card-value .badge {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Status indicators */
    .mobile-status-indicator {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        display: inline-block;
        margin-right: 0.5rem;
    }
    
    .mobile-status-success { background-color: var(--ios-green); }
    .mobile-status-warning { background-color: var(--ios-yellow); }
    .mobile-status-danger { background-color: var(--ios-red); }
    .mobile-status-info { background-color: var(--ios-blue); }
}

/* Desktop table shows normally */
@media (min-width: 992px) {
    .mobile-card-list {
        display: none;
    }
    
    .table-responsive .table {
        display: table;
    }
}

/* Sticky Action Bar for Mobile Forms */
@media (max-width: 991.98px) {
    .mobile-sticky-bottom {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(33, 37, 41, 0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 1rem;
        z-index: 1040;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .mobile-sticky-bottom .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .mobile-sticky-bottom .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Add padding to body when sticky bar is present */
    .has-sticky-bottom {
        padding-bottom: 120px;
    }
    
    /* Totals in sticky bar */
    .mobile-totals-summary {
        background: rgba(0, 122, 255, 0.1);
        border: 1px solid rgba(0, 122, 255, 0.2);
        border-radius: var(--mobile-border-radius);
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .mobile-total-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.25rem;
    }
    
    .mobile-total-row:last-child {
        margin-bottom: 0;
        font-weight: 600;
        font-size: 1.1rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Print styles */
@media print {
    .navbar, .footer, .btn {
        display: none !important;
    }
    
    .quotation-preview {
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    body {
        background-color: white !important;
    }
}


