/* EasyHome - EasyApps Custom Color Scheme */

/* Import PWA-specific styles */
@import url('pwa.css');

/* PWA Cross-Platform Adaptation Styles */

/* Responsive Layout Classes */
.responsive-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Breakpoint-specific styles */
.breakpoint-xs .responsive-container { max-width: 100%; }
.breakpoint-sm .responsive-container { max-width: 540px; }
.breakpoint-md .responsive-container { max-width: 720px; }
.breakpoint-lg .responsive-container { max-width: 960px; }
.breakpoint-xl .responsive-container { max-width: 1140px; }
.breakpoint-xxl .responsive-container { max-width: 1320px; }

/* Device-specific optimizations */
.device-mobile .responsive-container {
    padding: 0 0.5rem;
}

.device-tablet .responsive-container {
    padding: 0 1rem;
}

.device-desktop .responsive-container {
    padding: 0 1.5rem;
}

/* Layout optimizations */
.mobile-optimized {
    font-size: 0.9rem;
    line-height: 1.4;
}

.tablet-optimized {
    font-size: 1rem;
    line-height: 1.5;
}

.desktop-optimized {
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Compact layout for small screens */
.compact-layout {
    padding: 0.5rem;
    margin: 0.25rem;
}

.compact-layout .card {
    margin-bottom: 0.5rem;
}

.compact-layout .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Balanced layout for medium screens */
.balanced-layout {
    padding: 1rem;
    margin: 0.5rem;
}

.balanced-layout .card {
    margin-bottom: 1rem;
}

.balanced-layout .btn {
    padding: 0.5rem 1rem;
    font-size: 1rem;
}

/* Expanded layout for large screens */
.expanded-layout {
    padding: 1.5rem;
    margin: 1rem;
}

.expanded-layout .card {
    margin-bottom: 1.5rem;
}

.expanded-layout .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

/* Responsive Grid System */
.responsive-grid {
    display: grid;
    gap: var(--grid-gutter, 1rem);
    grid-template-columns: repeat(var(--grid-columns, 1), 1fr);
    max-width: var(--grid-max-width, 100%);
    margin: 0 auto;
}

/* Responsive Image Classes */
.img-mobile {
    max-width: 100%;
    height: auto;
}

.img-tablet {
    max-width: 100%;
    height: auto;
}

.img-desktop {
    max-width: 100%;
    height: auto;
}

/* Breakpoint-specific image sizes */
.img-xs { max-width: 100%; }
.img-sm { max-width: 100%; }
.img-md { max-width: 100%; }
.img-lg { max-width: 100%; }
.img-xl { max-width: 100%; }
.img-xxl { max-width: 100%; }

/* Responsive Typography */
.text-mobile {
    font-size: 0.875rem;
    line-height: 1.4;
}

.text-tablet {
    font-size: 1rem;
    line-height: 1.5;
}

.text-desktop {
    font-size: 1.125rem;
    line-height: 1.6;
}

/* Breakpoint-specific typography */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-md { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-xxl { font-size: 1.5rem; }

/* Adaptive Navigation Styles */
.navbar {
    transition: all 0.3s ease;
}

/* Input method specific styles */
.input-touch .navbar {
    touch-action: manipulation;
}

.input-touch .nav-item {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-mouse .navbar {
    cursor: pointer;
}

.input-mouse .nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease;
}

.input-keyboard .navbar {
    outline: none;
}

.input-keyboard .nav-item:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Touch optimizations */
.touch-optimized .nav-item {
    padding: 0.75rem 1rem;
    margin: 0.25rem;
    border-radius: 0.375rem;
}

.touch-optimized .nav-item.touch-active {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
    transition: all 0.15s ease;
}

/* Hover effects for mouse */
.hover-enabled .nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* Smooth transitions */
.smooth-transitions .nav-item {
    transition: all 0.3s ease;
}

/* Keyboard navigation */
.keyboard-navigation .nav-item:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    transition: top 0.3s;
    border-radius: 4px;
}

.skip-link:focus {
    top: 6px;
}

/* Device-specific navigation */
.nav-mobile {
    flex-direction: column;
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    transition: left 0.3s ease;
    z-index: 1000;
    padding: 2rem 1rem;
}

.nav-mobile.menu-open {
    left: 0;
}

.nav-tablet {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
}

.nav-desktop {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
}

.nav-mobile .mobile-menu-toggle {
    display: block;
    position: absolute;
    top: 1rem;
    right: 1rem;
}

/* Hamburger animation */
.hamburger-line {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    margin: 5px 0;
    transition: 0.3s;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* Navigation backdrop */
.navbar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.nav-mobile.menu-open + .navbar-backdrop {
    opacity: 1;
    visibility: visible;
}

/* Click feedback */
.nav-item.click-active {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
    transition: all 0.15s ease;
}

/* Page visibility optimizations */
.page-hidden * {
    animation-play-state: paused !important;
}

/* Online/Offline indicators */
.online {
    border-top: 3px solid #28a745;
}

.offline {
    border-top: 3px solid #dc3545;
}

/* Reduced motion */
.reduce-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* Optimized transitions */
.optimized-transitions * {
    transition-property: transform, opacity !important;
}

/* Full motion */
.full-motion * {
    animation-duration: inherit !important;
    animation-iteration-count: inherit !important;
    transition-duration: inherit !important;
}

/* Reduced motion */
.reduced-motion * {
    animation-duration: 0.2s !important;
    transition-duration: 0.2s !important;
}

/* Responsive utilities */
@media (max-width: 767.98px) {
    .mobile-menu-toggle {
        display: block;
    }

    .nav-desktop {
        display: none;
    }

    .nav-tablet {
        display: none;
    }
}

@media (min-width: 768px) and (max-width: 1023.98px) {
    .nav-mobile {
        display: none;
    }

    .nav-desktop {
        display: none;
    }
}

@media (min-width: 1024px) {
    .nav-mobile {
        display: none;
    }

    .nav-tablet {
        display: none;
    }
}

/* Color Variables - Now managed by theme system in themes.css */
/* These are fallbacks if theme system hasn't loaded yet */
:root {
    --wooden-bg: #D4A017;
    --sun-gradient-start: #F5E8C7;
    --sun-gradient-end: #FF9A8B;
    --terracotta: #D2691E;
    --foliage-green: #4A7048;
    --mountain-green: #A9CBA4;
    --text-dark: #2c3e50;
    --text-light: #ffffff;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* Global Styles */
.app-body {
    background: var(--app-body-bg, linear-gradient(135deg, var(--sun-gradient-start) 0%, var(--sun-gradient-end) 100%));
    background-color: var(--body-bg, #ffffff);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Camera Component Styles */
.camera-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px var(--shadow);
    overflow: hidden;
    border: 2px solid var(--mountain-green);
}

.camera-header {
    background: linear-gradient(135deg, var(--foliage-green) 0%, var(--mountain-green) 100%);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.camera-title {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.camera-controls {
    display: flex;
    gap: 0.5rem;
}

.camera-controls .btn {
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    background: transparent;
    transition: all 0.3s ease;
}

.camera-controls .btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.camera-viewfinder-container {
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.camera-viewfinder {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-focus-frame {
    width: 200px;
    height: 200px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.camera-viewfinder:focus + .camera-overlay .camera-focus-frame {
    opacity: 1;
}

.camera-capture-controls {
    padding: 1.5rem;
    text-align: center;
    background: #f8f9fa;
}

.camera-capture-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid var(--foliage-green);
    background: white;
    color: var(--foliage-green);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 112, 72, 0.3);
}

.camera-capture-btn:hover {
    background: var(--foliage-green);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(74, 112, 72, 0.4);
}

.camera-capture-btn:active {
    transform: scale(0.95);
}

.camera-capture-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.camera-status {
    padding: 1rem;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.camera-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--foliage-green);
    font-weight: 500;
}

.camera-error {
    padding: 1rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

.camera-error .alert {
    margin: 0;
    border-radius: 0;
    border: none;
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

/* Upload Options */
.upload-options {
    margin-bottom: 1rem;
}

.upload-options .btn {
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.upload-options .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Camera Section */
.camera-section {
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease;
}

/* Responsive Design for Camera */
@media (max-width: 768px) {
    .camera-viewfinder {
        height: 250px;
    }

    .camera-capture-btn {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }

    .camera-header {
        padding: 0.75rem;
    }

    .camera-title {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .camera-viewfinder {
        height: 200px;
    }

    .camera-capture-btn {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .camera-focus-frame {
        width: 150px;
        height: 150px;
    }
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dark Mode Support for Camera */
@media (prefers-color-scheme: dark) {
    .camera-container {
        background: #2c3e50;
        border-color: var(--mountain-green);
    }

    .camera-capture-controls {
        background: #34495e;
    }

    .camera-status {
        background: #34495e;
        border-color: #4a5f7a;
    }

    .camera-error {
        background: #34495e;
        border-color: #4a5f7a;
    }
}

/* Banner Styles */
.banner-container {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
    margin-bottom: 0;
}

.banner-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(212, 160, 23, 0.8) 0%, rgba(210, 105, 30, 0.6) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.banner-title {
    color: var(--text-light);
    font-size: 3.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5rem;
}

.banner-subtitle {
    color: var(--text-light);
    font-size: 1.2rem;
    font-weight: 300;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    margin-bottom: 0;
}

/* Navigation Styles */
.custom-navbar {
    background: var(--wooden-bg) !important;
    box-shadow: 0 2px 10px var(--shadow);
    border-bottom: 3px solid var(--terracotta);
    position: relative;
    z-index: 1000;
}

.custom-navbar .navbar-nav {
    align-items: center;
}

.custom-navbar .nav-item {
    display: flex;
    align-items: center;
}

.custom-navbar .navbar-brand {
    pointer-events: auto !important;
    z-index: 1002 !important;
    position: relative;
}

/* Ensure navbar dropdowns appear above banner */
.navbar .dropdown-menu {
    z-index: 1001 !important;
}

.custom-brand {
    color: var(--text-light) !important;
    font-weight: 600;
    font-size: 1.3rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    text-decoration: none !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    position: relative;
    z-index: 1002;
    display: inline-block;
}

.custom-brand,
.custom-brand:link,
.custom-brand:visited,
.custom-brand:hover,
.custom-brand:active {
    text-decoration: none !important;
    color: var(--text-light) !important;
    pointer-events: auto !important;
}

.custom-brand:hover {
    color: var(--mountain-green) !important;
    transform: translateY(-1px);
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.custom-brand:focus {
    text-decoration: none !important;
    outline: 2px solid var(--mountain-green);
    outline-offset: 2px;
}

.custom-nav-link {
    color: var(--text-light) !important;
    font-weight: 500;
    padding: 0.75rem 1rem !important;
    border-radius: 8px;
    margin: 0 0.25rem;
    transition: all 0.3s ease;
    line-height: 1.5;
    vertical-align: middle;
}

.custom-nav-link i {
    vertical-align: middle;
    line-height: 1;
    width: 1em;
    text-align: center;
    display: inline-block;
}

.custom-nav-link:hover {
    color: var(--mountain-green) !important;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.custom-toggler {
    border-color: var(--text-light);
}

.custom-toggler .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.custom-dropdown {
    background: var(--wooden-bg);
    border: 2px solid var(--terracotta);
    border-radius: 12px;
    box-shadow: 0 8px 25px var(--shadow);
    margin-top: 0.5rem;
}

.custom-dropdown-item {
    color: var(--text-light) !important;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    transition: all 0.3s ease;
}

.custom-dropdown-item:hover {
    background: var(--terracotta) !important;
    color: var(--text-light) !important;
    transform: translateX(5px);
}

/* Main Content */
.main-content {
    background: var(--main-content-bg, linear-gradient(135deg, var(--sun-gradient-start) 0%, var(--sun-gradient-end) 100%));
    background-color: var(--body-bg, #ffffff);
    min-height: calc(100vh - 300px);
    padding: 0;
}

/* Footer */
.custom-footer {
    background: var(--wooden-bg);
    color: var(--text-light);
    text-align: center;
    padding: 2rem 0;
    border-top: 3px solid var(--terracotta);
    box-shadow: 0 -2px 10px var(--shadow);
}

.custom-footer p {
    margin: 0;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, var(--foliage-green) 0%, var(--mountain-green) 100%);
    border: none;
    color: var(--text-light);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(74, 112, 72, 0.3);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--mountain-green) 0%, var(--foliage-green) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 112, 72, 0.4);
    color: var(--text-light);
}

.btn-secondary {
    background: var(--terracotta);
    border: none;
    color: var(--text-light);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(210, 105, 30, 0.3);
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--terracotta) 0%, #B8860B 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(210, 105, 30, 0.4);
    color: var(--text-light);
}

.btn-outline-primary {
    border: 2px solid var(--foliage-green);
    color: var(--foliage-green);
    background: transparent;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background: var(--foliage-green);
    color: var(--text-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 112, 72, 0.3);
}

.btn-outline-secondary {
    border: 2px solid var(--terracotta);
    color: var(--terracotta);
    background: transparent;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-outline-secondary:hover {
    background: var(--terracotta);
    color: var(--text-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(210, 105, 30, 0.3);
}

/* Payment buttons - ensure consistent sizing */
.payment-btn {
    width: 100% !important;
    min-height: 48px !important;
    padding: 0.75rem 1.5rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 0.5rem !important;
    box-sizing: border-box !important;
}

.payment-btn:last-child {
    margin-bottom: 0 !important;
}

.payment-btn i {
    font-size: 1.1rem !important;
    margin-right: 0.5rem !important;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border: none;
    color: var(--text-light);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
    color: var(--text-light);
}

/* Card Styles */
.card {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 15px;
    box-shadow: 0 8px 25px var(--shadow);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-header {
    background: linear-gradient(135deg, var(--foliage-green) 0%, var(--mountain-green) 100%);
    color: var(--text-light);
    border-radius: 15px 15px 0 0 !important;
    border: none;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Form Styles */
.form-control {
    border: 2px solid var(--mountain-green);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

.form-control:focus {
    border-color: var(--foliage-green);
    box-shadow: 0 0 0 0.2rem rgba(74, 112, 72, 0.25);
    background: var(--text-light);
}

/* ============================================
   GLOBAL INPUT STYLING - Screen Scaling Fix
   ============================================
   This ensures all form inputs across the app
   are readable and properly scaled on all devices
   ============================================ */

/* Comprehensive Input Styling - All Input Types */
/* Apply to ALL inputs, selects, and textareas across the entire app */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="url"],
input[type="search"],
input[type="color"],
input[type="range"],
select,
textarea {
    /* Critical: 16px minimum prevents iOS auto-zoom */
    font-size: 16px !important;
    line-height: 1.5;
    /* High contrast text color for visibility */
    color: #212529 !important;
    background-color: #ffffff !important;
    /* Minimum touch target size (WCAG 2.1 AA) */
    min-height: 48px;
    /* Comfortable padding */
    padding: 14px 16px;
    /* Box sizing for proper width calculation */
    box-sizing: border-box;
    /* Remove browser default styling */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Smooth transitions */
    transition: all 0.2s ease;
}

/* Ensure text is visible when entered (not just placeholder) */
input[type="text"]:not(:placeholder-shown),
input[type="number"]:not(:placeholder-shown),
input[type="email"]:not(:placeholder-shown),
input[type="tel"]:not(:placeholder-shown),
input[type="password"]:not(:placeholder-shown),
input[type="date"]:not(:placeholder-shown),
input[type="time"]:not(:placeholder-shown),
input[type="datetime-local"]:not(:placeholder-shown),
input[type="url"]:not(:placeholder-shown),
input[type="search"]:not(:placeholder-shown),
select:not([value=""]),
textarea:not(:placeholder-shown) {
    color: #212529 !important;
    font-weight: 400;
}

/* Focus states with better visibility */
input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
    background-color: #ffffff !important;
    color: #212529 !important;
}

/* Placeholder styling */
input::placeholder,
textarea::placeholder {
    color: #6c757d;
    opacity: 0.7;
    font-weight: 400;
}

/* Disabled state */
input:disabled,
select:disabled,
textarea:disabled {
    background-color: #f8f9fa !important;
    color: #6c757d !important;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Textarea specific */
textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

/* Checkbox and radio - Enhanced visibility */
input[type="checkbox"],
input[type="radio"] {
    min-height: auto;
    padding: 0;
    width: auto;
    height: auto;
    font-size: inherit;
}

/* Global Checkbox Enhancement - Better Visibility */
input[type="checkbox"] {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    cursor: pointer;
    border: 2px solid #6c757d !important;
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #ffffff;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

input[type="checkbox"]:hover {
    border-color: #007bff !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

input[type="checkbox"]:checked {
    background-color: #007bff !important;
    border-color: #007bff !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 16px 16px !important;
}

input[type="checkbox"]:focus {
    outline: none;
    border-color: #007bff !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25) !important;
}

input[type="checkbox"]:focus:not(:checked) {
    border-color: #007bff !important;
}

/* Form check input specific styling */
.form-check-input {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    margin-top: 0.125rem;
    margin-right: 0.5rem;
    cursor: pointer;
    border: 2px solid #6c757d !important;
    border-radius: 4px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #ffffff;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.form-check-input:hover {
    border-color: #007bff !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-check-input:checked {
    background-color: #007bff !important;
    border-color: #007bff !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 16px 16px !important;
}

.form-check-input:focus {
    outline: none;
    border-color: #007bff !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25) !important;
}

/* Radio button styling */
input[type="radio"] {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    cursor: pointer;
    border: 2px solid #6c757d !important;
    border-radius: 50%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #ffffff;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

input[type="radio"]:checked {
    background-color: #007bff !important;
    border-color: #007bff !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3ccircle cx='10' cy='10' r='5' fill='%23fff'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 10px 10px !important;
}

/* Range input - special handling */
input[type="range"] {
    min-height: auto;
    padding: 0;
    height: 8px;
}

/* Color input - special handling */
input[type="color"] {
    min-height: 48px;
    padding: 4px;
    width: 100%;
    cursor: pointer;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    input[type="url"],
    input[type="search"],
    select,
    textarea {
        /* Critical: Maintain 16px to prevent iOS auto-zoom */
        font-size: 16px !important;
        /* Larger padding for better touch targets */
        padding: 16px 18px !important;
        /* Larger touch target on mobile */
        min-height: 52px !important;
        /* Better text rendering */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    /* Ensure text visibility on mobile */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    input[type="url"],
    input[type="search"],
    select {
        color: #212529 !important;
        background-color: #ffffff !important;
    }

    /* Better focus visibility on mobile */
    input:focus,
    select:focus,
    textarea:focus {
        box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.2) !important;
    }
}

/* Small Mobile Devices (320px - 480px) */
@media (max-width: 480px) {
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    input[type="url"],
    input[type="search"],
    select,
    textarea {
        /* Keep at 16px minimum */
        font-size: 16px !important;
        /* Even larger padding for small screens */
        padding: 18px 20px !important;
        /* Maximum touch target */
        min-height: 56px !important;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    input[type="url"],
    input[type="search"],
    select,
    textarea {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* ============================================
   GLOBAL FORM ROW RESPONSIVE FIX
   ============================================
   Ensures all form-row elements stack on mobile
   ============================================ */

/* Form rows should stack on mobile for better usability */
.form-row {
    display: grid;
    gap: 1rem;
}

/* Default: 2 columns on desktop */
.form-row {
    grid-template-columns: repeat(2, 1fr);
}

/* Stack on mobile */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 1.25rem; /* More spacing on mobile */
    }
}

/* Extra spacing on small mobile */
@media (max-width: 480px) {
    .form-row {
        gap: 1.5rem; /* Even more spacing */
    }
}

.form-label {
    color: var(--foliage-green);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-text {
    color: var(--terracotta);
    font-size: 0.9rem;
}

/* Alert Styles */
.alert-success {
    background: linear-gradient(135deg, var(--mountain-green) 0%, #90EE90 100%);
    color: var(--text-light);
    border: none;
    border-radius: 10px;
    font-weight: 500;
}

.alert-danger {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: var(--text-light);
    border: none;
    border-radius: 10px;
    font-weight: 500;
}

.alert-warning {
    background: linear-gradient(135deg, var(--terracotta) 0%, #ffa500 100%);
    color: var(--text-light);
    border: none;
    border-radius: 10px;
    font-weight: 500;
}

/* Modal Styles */
.modal-content {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 15px;
    box-shadow: 0 15px 35px var(--shadow);
    backdrop-filter: blur(10px);
}

.modal-header {
    background: linear-gradient(135deg, var(--foliage-green) 0%, var(--mountain-green) 100%);
    color: var(--text-light);
    border-radius: 15px 15px 0 0;
    border: none;
}

.modal-title {
    font-weight: 600;
}

.modal-footer {
    background: rgba(245, 232, 199, 0.8);
    border-radius: 0 0 15px 15px;
    border: none;
}

/* Table Styles */
.table {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow);
}

.table thead th {
    background: linear-gradient(135deg, var(--foliage-green) 0%, var(--mountain-green) 100%);
    color: var(--text-light);
    border: none;
    font-weight: 600;
    padding: 1rem;
}

.table tbody td {
    border-color: rgba(169, 203, 164, 0.3);
    padding: 1rem;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: rgba(169, 203, 164, 0.1);
}

/* Badge Styles */
.badge {
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}

.badge.bg-primary {
    background: var(--foliage-green) !important;
}

.badge.bg-secondary {
    background: var(--terracotta) !important;
}

.badge.bg-success {
    background: var(--mountain-green) !important;
}

/* Loading Spinner */
.spinner-border {
    color: var(--foliage-green);
}

/* Text Colors */
.text-primary {
    color: var(--foliage-green) !important;
}

.text-secondary {
    color: var(--terracotta) !important;
}

.text-success {
    color: var(--mountain-green) !important;
}

.text-muted {
    color: var(--terracotta) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .banner-title {
        font-size: 2.5rem;
    }

    .banner-subtitle {
        font-size: 1rem;
    }

    .banner-container {
        height: 250px;
    }

    .custom-nav-link {
        padding: 0.5rem 0.75rem !important;
        margin: 0.125rem 0;
    }

    .custom-nav-link i {
        vertical-align: middle;
    }
}

/* Large screen fixes for proper alignment */
@media (min-width: 992px) {
    .custom-navbar .navbar-nav {
        flex-wrap: nowrap;
    }

    .custom-nav-link {
        white-space: nowrap;
    }
}

@media (max-width: 576px) {
    .banner-title {
        font-size: 2rem;
    }

    .banner-subtitle {
        font-size: 0.9rem;
    }

    .banner-container {
        height: 200px;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Utility Classes */
.shadow-custom {
    box-shadow: 0 8px 25px var(--shadow);
}

.border-custom {
    border: 2px solid var(--mountain-green);
}

.bg-custom-primary {
    background: linear-gradient(135deg, var(--foliage-green) 0%, var(--mountain-green) 100%);
}

.bg-custom-secondary {
    background: var(--terracotta);
}

.bg-custom-light {
    background: rgba(255, 255, 255, 0.9);
}

/* Recovery Modal Styles */
.recovery-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}

.recovery-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.recovery-modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    margin: 2% auto;
    padding: 0;
    border-radius: 16px;
    width: 95%;
    max-width: 800px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: recoveryModalSlideIn 0.4s ease-out;
    max-height: 90vh;
    overflow: hidden;
}

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

.recovery-modal-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.recovery-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
    border-radius: 16px 16px 0 0;
}

.recovery-modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.recovery-close {
    color: white;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recovery-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.recovery-modal-body {
    padding: 2rem;
    max-height: 60vh;
    overflow-y: auto;
}

/* Recovery Steps */
.recovery-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.recovery-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 40px;
    right: 40px;
    height: 2px;
    background: #e9ecef;
    z-index: 1;
}

.recovery-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

.recovery-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    border: 3px solid #e9ecef;
}

.recovery-step.active .recovery-step-circle {
    background: #007bff;
    color: white;
    border-color: #007bff;
    transform: scale(1.1);
}

.recovery-step.completed .recovery-step-circle {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.recovery-step.error .recovery-step-circle {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.recovery-step-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-align: center;
    font-weight: 500;
}

.recovery-step.active .recovery-step-label {
    color: #007bff;
    font-weight: 600;
}

.recovery-step.completed .recovery-step-label {
    color: #28a745;
}

.recovery-step.error .recovery-step-label {
    color: #dc3545;
}

/* Recovery Options */
.recovery-options {
    margin-bottom: 2rem;
}

.recovery-option {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.recovery-option:hover {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
    transform: translateY(-2px);
}

.recovery-option.selected {
    border-color: #007bff;
    background: #f8f9ff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

.recovery-option-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.recovery-option-radio {
    margin-right: 1rem;
    transform: scale(1.2);
}

.recovery-option-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

.recovery-option-description {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
}

.recovery-option-warning {
    color: #dc3545;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
}

.recovery-option-warning::before {
    content: '⚠️';
    margin-right: 0.5rem;
}

/* Progress Section */
.recovery-progress {
    margin-bottom: 2rem;
    display: none;
}

.recovery-progress.show {
    display: block;
}

.recovery-progress-bar {
    width: 100%;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
    position: relative;
}

.recovery-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff 0%, #0056b3 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
    position: relative;
}

.recovery-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: progressShine 2s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.recovery-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.recovery-progress-percentage {
    font-weight: 600;
    color: #007bff;
    font-size: 1.1rem;
}

.recovery-progress-eta {
    color: #6c757d;
    font-size: 0.9rem;
}

.recovery-current-operation {
    color: #495057;
    font-size: 0.9rem;
    font-style: italic;
}

/* Confirmation Dialog */
.recovery-confirmation {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.recovery-confirmation-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.recovery-confirmation-icon {
    font-size: 1.5rem;
    margin-right: 0.75rem;
}

.recovery-confirmation-title {
    font-weight: 600;
    color: #856404;
    margin: 0;
}

.recovery-confirmation-message {
    color: #856404;
    line-height: 1.5;
    margin: 0;
}

.recovery-confirmation-warnings {
    margin-top: 1rem;
    padding-left: 1.5rem;
}

.recovery-confirmation-warnings li {
    color: #856404;
    margin-bottom: 0.5rem;
}

/* Results Section */
.recovery-results {
    display: none;
}

.recovery-results.show {
    display: block;
}

.recovery-results.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.recovery-results.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.recovery-results-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.recovery-results-icon {
    font-size: 1.5rem;
    margin-right: 0.75rem;
}

.recovery-results-title {
    font-weight: 600;
    margin: 0;
}

.recovery-results.success .recovery-results-title {
    color: #155724;
}

.recovery-results.error .recovery-results-title {
    color: #721c24;
}

.recovery-results-message {
    line-height: 1.5;
    margin: 0;
}

.recovery-results.success .recovery-results-message {
    color: #155724;
}

.recovery-results.error .recovery-results-message {
    color: #721c24;
}

.recovery-results-details {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Modal Footer */
.recovery-modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: #f8f9fa;
    border-radius: 0 0 16px 16px;
}

.recovery-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 120px;
}

.recovery-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.recovery-btn-primary {
    background: #007bff;
    color: white;
}

.recovery-btn-primary:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.recovery-btn-secondary {
    background: #6c757d;
    color: white;
}

.recovery-btn-secondary:hover:not(:disabled) {
    background: #545b62;
    transform: translateY(-1px);
}

.recovery-btn-danger {
    background: #dc3545;
    color: white;
}

.recovery-btn-danger:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.recovery-btn-success {
    background: #28a745;
    color: white;
}

.recovery-btn-success:hover:not(:disabled) {
    background: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Loading States */
.recovery-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.recovery-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: recoverySpin 1s linear infinite;
    margin-right: 1rem;
}

@keyframes recoverySpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.recovery-loading-text {
    color: #6c757d;
    font-weight: 500;
}

/* Recovery Modal Responsive Design */
@media (max-width: 768px) {
    .recovery-modal-content {
        width: 98%;
        margin: 1% auto;
        max-height: 95vh;
    }

    .recovery-modal-header {
        padding: 1rem 1.5rem;
    }

    .recovery-modal-body {
        padding: 1.5rem;
    }

    .recovery-modal-footer {
        padding: 1rem 1.5rem;
        flex-direction: column;
    }

    .recovery-btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .recovery-steps {
        flex-direction: column;
        gap: 1rem;
    }

    .recovery-steps::before {
        display: none;
    }

    .recovery-step {
        flex-direction: row;
        align-items: center;
        text-align: left;
    }

    .recovery-step-circle {
        margin-right: 1rem;
        margin-bottom: 0;
    }
}

/* =============================================
   OFFLINE EXPERIENCE COMPONENTS
   ============================================= */

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--shadow);
    border: 2px solid var(--mountain-green);
    min-width: 250px;
    transition: all 0.3s ease;
}

.offline-indicator.online {
    border-color: var(--foliage-green);
    background: linear-gradient(135deg, #e8f5e8 0%, #f0fff0 100%);
}

.offline-indicator.offline {
    border-color: #ff6b6b;
    background: linear-gradient(135deg, #ffe8e8 0%, #fff0f0 100%);
}

.offline-indicator-content {
    display: flex;
    align-items: center;
    padding: 1rem;
    gap: 0.75rem;
}

.offline-indicator-icon {
    font-size: 1.5rem;
    color: var(--foliage-green);
}

.offline-indicator.offline .offline-indicator-icon {
    color: #ff6b6b;
}

.offline-indicator-text {
    flex: 1;
}

.offline-indicator-status {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.offline-indicator-message {
    font-size: 0.8rem;
    color: #666;
}

.offline-indicator-message.success {
    color: var(--foliage-green);
}

.offline-indicator-message.error {
    color: #ff6b6b;
}

.offline-indicator-retry {
    background: var(--foliage-green);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.offline-indicator-retry:hover {
    background: var(--mountain-green);
}

/* Offline Experience */
.offline-experience {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px var(--shadow);
    border: 2px solid var(--mountain-green);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.offline-experience-content {
    padding: 2rem;
}

.offline-experience-header h3 {
    color: var(--foliage-green);
    margin-bottom: 0.5rem;
}

.offline-experience-header p {
    color: #666;
    margin-bottom: 1.5rem;
}

.offline-experience-sections {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.offline-available-features,
.offline-limited-features,
.offline-cached-data {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.offline-available-features h4,
.offline-limited-features h4,
.offline-cached-data h4 {
    color: var(--foliage-green);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.feature-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.feature-item.available {
    border-color: var(--foliage-green);
    background: #f0fff0;
}

.feature-item.unavailable {
    border-color: #ff6b6b;
    background: #fff0f0;
}

.feature-item.limited {
    border-color: #ffa500;
    background: #fff8e1;
}

.feature-item i {
    font-size: 1.1rem;
}

.feature-item.available i {
    color: var(--foliage-green);
}

.feature-item.unavailable i {
    color: #ff6b6b;
}

.feature-item.limited i {
    color: #ffa500;
}

.feature-item span {
    flex: 1;
}

.feature-status {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.feature-reason {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
}

.cached-data-summary {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cached-data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.cached-data-type {
    font-weight: 600;
    color: var(--foliage-green);
}

.cached-data-count {
    color: #666;
    font-size: 0.9rem;
}

.cached-data-updated {
    color: #999;
    font-size: 0.8rem;
}

.no-cached-data {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

.offline-experience-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.offline-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
    background: white;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 15px var(--shadow);
    border: 2px solid var(--mountain-green);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideDown 0.3s ease;
}

.offline-message.success {
    border-color: var(--foliage-green);
    background: #f0fff0;
}

.offline-message.error {
    border-color: #ff6b6b;
    background: #fff0f0;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Sync Manager */
.sync-manager {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px var(--shadow);
    border: 2px solid var(--mountain-green);
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.sync-manager-content {
    padding: 2rem;
}

.sync-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.sync-manager-header h3 {
    color: var(--foliage-green);
    margin: 0;
}

.sync-status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.sync-status-indicator.idle {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e9ecef;
}

.sync-status-indicator.syncing {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.sync-status-indicator.paused {
    background: #fff3e0;
    color: #f57c00;
    border: 1px solid #ffcc02;
}

.sync-status-indicator.error {
    background: #ffebee;
    color: #d32f2f;
    border: 1px solid #ffcdd2;
}

.sync-manager-sections {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.sync-queue-section,
.sync-progress-section,
.sync-conflicts-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.sync-queue-section h4,
.sync-progress-section h4,
.sync-conflicts-section h4 {
    color: var(--foliage-green);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.sync-queue {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sync-operation {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.sync-operation.pending {
    border-color: #ffa500;
    background: #fff8e1;
}

.sync-operation.completed {
    border-color: var(--foliage-green);
    background: #f0fff0;
}

.sync-operation.failed {
    border-color: #ff6b6b;
    background: #fff0f0;
}

.operation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.operation-type {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--foliage-green);
}

.operation-priority {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.operation-priority.high {
    background: #ffebee;
    color: #d32f2f;
}

.operation-priority.normal {
    background: #e3f2fd;
    color: #1976d2;
}

.operation-priority.low {
    background: #f3e5f5;
    color: #7b1fa2;
}

.operation-details {
    margin-bottom: 0.75rem;
}

.operation-description {
    color: #666;
    margin-bottom: 0.5rem;
}

.operation-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #999;
}

.operation-actions {
    display: flex;
    gap: 0.5rem;
}

.progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--foliage-green) 0%, var(--mountain-green) 100%);
    transition: width 0.3s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-text {
    color: #666;
    font-size: 0.9rem;
}

.progress-percentage {
    color: var(--foliage-green);
    font-weight: 600;
    font-size: 0.9rem;
}

.progress-meta {
    text-align: center;
}

.estimated-time {
    color: #999;
    font-size: 0.8rem;
}

.sync-conflicts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sync-conflict {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid #ff6b6b;
    background: #fff0f0;
}

.conflict-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.conflict-header h5 {
    color: #d32f2f;
    margin: 0;
    font-size: 1rem;
}

.conflict-severity {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.conflict-severity.high {
    background: #ffebee;
    color: #d32f2f;
}

.conflict-severity.medium {
    background: #fff3e0;
    color: #f57c00;
}

.conflict-severity.low {
    background: #e8f5e8;
    color: var(--foliage-green);
}

.conflict-description {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.conflict-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sync-manager-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.loading-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #666;
    font-style: italic;
}

/* Modal Styles */
.offline-modal-overlay,
.sync-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1003;
    display: flex;
    align-items: center;
    justify-content: center;
}

.offline-modal,
.sync-modal {
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 25px var(--shadow);
    border: 2px solid var(--mountain-green);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.offline-modal-header,
.sync-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
}

.offline-modal-header h3,
.sync-modal-header h3 {
    color: var(--foliage-green);
    margin: 0;
}

.offline-modal-close,
.sync-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.offline-modal-close:hover,
.sync-modal-close:hover {
    background: #f8f9fa;
}

.offline-modal-content,
.sync-modal-content {
    padding: 1.5rem;
}

.offline-modal-footer,
.sync-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .offline-indicator {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
    }

    .offline-experience,
    .sync-manager {
        width: 95%;
        max-height: 90vh;
    }

    .offline-experience-content,
    .sync-manager-content {
        padding: 1rem;
    }

    .offline-experience-actions,
    .sync-manager-actions {
        flex-direction: column;
    }

    .operation-actions,
    .conflict-options {
        flex-direction: column;
    }

    .sync-manager-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* Modal Backdrop Fix - Prevents blocking issues */
.modal-backdrop {
    z-index: 1040 !important;
}

.modal-backdrop.fade.show {
    opacity: 0.5 !important;
}

/* Ensure modals are above backdrops */
.modal {
    z-index: 1050 !important;
}

/* Fix for stuck modal backdrops */
body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* Remove any stuck backdrops */
.modal-backdrop.fade:not(.show) {
    display: none !important;
}

/* ========================================
   UNIFORM BUTTON SYSTEM
   ======================================== */

/* Base Button Standards */
.btn {
    font-family: inherit;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    position: relative;
    overflow: visible;
    text-overflow: ellipsis;
    word-wrap: break-word;
    hyphens: auto;
}

/* Button Sizes - Uniform Scaling */
.btn-xs {
    padding: 0.75rem 1.25rem;
    font-size: 0.8rem;
    line-height: 1.2;
    min-height: 2.5rem;
    min-width: 4rem;
}

.btn-sm {
    padding: 0.875rem 1.5rem;
    font-size: 0.9rem;
    line-height: 1.3;
    min-height: 2.75rem;
    min-width: 5rem;
}

.btn-md {
    padding: 1rem 1.75rem;
    font-size: 1rem;
    line-height: 1.4;
    min-height: 3rem;
    min-width: 6rem;
}

.btn-lg {
    padding: 1.125rem 2rem;
    font-size: 1.1rem;
    line-height: 1.5;
    min-height: 3.25rem;
    min-width: 7rem;
}

.btn-xl {
    padding: 1.25rem 2.25rem;
    font-size: 1.2rem;
    line-height: 1.6;
    min-height: 3.5rem;
    min-width: 8rem;
}

/* Default size if no size class specified */
.btn:not(.btn-xs):not(.btn-sm):not(.btn-md):not(.btn-lg):not(.btn-xl) {
    padding: 1rem 1.75rem;
    font-size: 1rem;
    line-height: 1.4;
    min-height: 3rem;
    min-width: 6rem;
}

/* Button Variants - Consistent Styling */
.btn-primary {
    background: linear-gradient(135deg, var(--foliage-green) 0%, var(--mountain-green) 100%);
    border-color: var(--foliage-green);
    color: var(--text-light);
    box-shadow: 0 2px 8px rgba(74, 112, 72, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--mountain-green) 0%, var(--foliage-green) 100%);
    border-color: var(--mountain-green);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 112, 72, 0.3);
    color: var(--text-light);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--terracotta) 0%, #B8860B 100%);
    border-color: var(--terracotta);
    color: var(--text-light);
    box-shadow: 0 2px 8px rgba(210, 105, 30, 0.2);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #B8860B 0%, var(--terracotta) 100%);
    border-color: #B8860B;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(210, 105, 30, 0.3);
    color: var(--text-light);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-color: #28a745;
    color: white;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
    border-color: #20c997;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-color: #dc3545;
    color: white;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
    border-color: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    border-color: #ffc107;
    color: #212529;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e0a800 0%, #d39e00 100%);
    border-color: #e0a800;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
    color: #212529;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    border-color: #17a2b8;
    color: white;
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.2);
}

.btn-info:hover {
    background: linear-gradient(135deg, #138496 0%, #117a8b 100%);
    border-color: #138496;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
    color: white;
}

.btn-light {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-color: #dee2e6;
    color: #495057;
    box-shadow: 0 2px 8px rgba(248, 249, 250, 0.2);
}

.btn-light:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(248, 249, 250, 0.3);
    color: #495057;
}

.btn-dark {
    background: linear-gradient(135deg, #343a40 0%, #23272b 100%);
    border-color: #343a40;
    color: white;
    box-shadow: 0 2px 8px rgba(52, 58, 64, 0.2);
}

.btn-dark:hover {
    background: linear-gradient(135deg, #23272b 0%, #1d2124 100%);
    border-color: #23272b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 58, 64, 0.3);
    color: white;
}

/* Outline Button Variants */
.btn-outline-primary {
    background: transparent;
    border-color: var(--foliage-green);
    color: var(--foliage-green);
    box-shadow: 0 2px 8px rgba(74, 112, 72, 0.1);
}

.btn-outline-primary:hover {
    background: var(--foliage-green);
    border-color: var(--foliage-green);
    color: var(--text-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 112, 72, 0.3);
}

.btn-outline-secondary {
    background: transparent;
    border-color: var(--terracotta);
    color: var(--terracotta);
    box-shadow: 0 2px 8px rgba(210, 105, 30, 0.1);
}

.btn-outline-secondary:hover {
    background: var(--terracotta);
    border-color: var(--terracotta);
    color: var(--text-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(210, 105, 30, 0.3);
}

/* Button States */
.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Button Groups */
.btn-group {
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-group .btn {
    border-radius: 0;
    border-right-width: 1px;
    margin: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.btn-group .btn:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    border-right-width: 2px;
}

/* Icon Buttons */
.btn-icon {
    padding: 0.5rem;
    min-width: 2.5rem;
    aspect-ratio: 1;
}

.btn-icon i {
    font-size: 1.1em;
}

/* Buttons with Icons and Text */
.btn i {
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.btn i:last-child {
    margin-right: 0;
    margin-left: 0.5rem;
}

.btn i:only-child {
    margin: 0;
}

/* Long Text Button Handling */
.btn-long-text {
    white-space: normal;
    line-height: 1.3;
    padding: 0.75rem 1rem;
    min-height: auto;
    height: auto;
}

/* Compact Button for Small Spaces */
.btn-compact {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    min-height: 2rem;
    min-width: 3rem;
}

/* Button with Icon and Text - Optimized Layout */
.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    min-height: 2.5rem;
}

.btn-with-icon i {
    margin: 0;
    flex-shrink: 0;
    font-size: 0.9em;
    width: 1em;
    text-align: center;
}

/* Icon-only buttons */
.btn-icon-only {
    padding: 0.75rem;
    min-width: 2.5rem;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-only i {
    margin: 0;
    font-size: 1.1em;
}

/* Responsive Button Scaling - Better Mobile Layout */
@media (max-width: 768px) {
    /* Make button container wrap on smaller screens - more specific selector */
    .row .col-12 .d-flex.gap-3.align-items-center.justify-content-center,
    .d-flex.gap-3.align-items-center.justify-content-center {
        flex-wrap: wrap !important;
        gap: 0.75rem !important;
        justify-content: center !important;
    }

    /* Smaller buttons on mobile */
    .btn {
        padding: 0.5rem 0.75rem !important;
        min-width: auto !important;
        font-size: 0.875rem !important;
        white-space: nowrap !important;
    }

    /* AI and action buttons - smaller on mobile */
    .btn-ai-enhance,
    #aiRecipeSearchBtn,
    .btn-primary,
    .btn-secondary {
        min-width: auto !important;
        padding: 0.5rem 0.75rem !important;
        font-size: 0.875rem !important;
    }

    /* Credits display - smaller on mobile */
    .credits-display {
        font-size: 0.875rem !important;
        padding: 0.4rem 0.6rem !important;
    }
}

@media (max-width: 576px) {
    /* Very small screens - stack buttons vertically - more specific selector */
    .row .col-12 .d-flex.gap-3.align-items-center.justify-content-center,
    .d-flex.gap-3.align-items-center.justify-content-center {
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: center !important;
    }

    /* Smaller buttons for very small screens */
    .btn {
        padding: 0.4rem 0.6rem !important;
        min-width: auto !important;
        font-size: 0.8rem !important;
        width: auto !important;
    }

    /* AI and action buttons - smaller */
    .btn-ai-enhance,
    #aiRecipeSearchBtn,
    .btn-primary,
    .btn-secondary {
        min-width: auto !important;
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem !important;
    }

    /* Credits display - smaller */
    .credits-display {
        font-size: 0.8rem !important;
        padding: 0.3rem 0.5rem !important;
    }
}

/* Extra small screens - even more compact */
@media (max-width: 480px) {
    /* Make buttons even more compact */
    .btn {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.75rem !important;
        min-width: auto !important;
    }

    /* AI and action buttons - very compact */
    .btn-ai-enhance,
    #aiRecipeSearchBtn,
    .btn-primary,
    .btn-secondary {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.75rem !important;
        min-width: auto !important;
    }

    /* Credits display - very compact */
    .credits-display {
        font-size: 0.75rem !important;
        padding: 0.25rem 0.4rem !important;
    }
}

/* Extra small screens - stack buttons vertically if needed */
@media (max-width: 480px) {
    .page-header .d-flex,
    .header-actions,
    .action-buttons-container {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .btn {
        min-width: 2.5rem;
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }

    .btn-ai-enhance,
    #aiRecipeSearchBtn,
    .btn-primary,
    .btn-secondary {
        min-width: 4rem !important;
        padding: 0.5rem 0.75rem !important;
        font-size: 0.75rem !important;
    }
}

/* Navigation and Main Action Buttons - Specific Override */
.navbar .btn,
.main-actions .btn,
.page-header .btn {
    padding: 0.875rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 2.75rem;
    min-width: auto;
    width: auto;
    max-width: none;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    gap: 0.375rem;
    flex-shrink: 0;
}

/* Icon spacing for main buttons */
.navbar .btn i,
.main-actions .btn i,
.page-header .btn i {
    margin-right: 0.375rem;
    flex-shrink: 0;
    font-size: 0.9em;
    width: 1em;
    text-align: center;
}

/* Specific fixes for AI and action buttons */
.btn-ai-enhance,
#aiRecipeSearchBtn,
.btn-primary,
.btn-secondary {
    width: auto !important;
    min-width: 8rem !important;
    max-width: none !important;
    flex-shrink: 0 !important;
    padding: 0.875rem 1.5rem !important;
    font-size: 0.9rem !important;
}

/* Button containers should not constrain width */
.d-flex .btn,
.btn-group .btn,
.action-buttons .btn {
    flex-shrink: 0;
    width: auto;
    min-width: fit-content;
}

/* Credits Display Styling */
.credits-display {
    background: #ffd700;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 0.375rem 0.75rem;
    color: #333;
    font-weight: 600;
    font-size: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    align-items: center;
    display: inline-flex;
    height: 38px; /* Exact Bootstrap button height */
    white-space: nowrap;
    line-height: 1.5;
    vertical-align: middle;
    box-sizing: border-box;
    min-width: fit-content;
    flex-shrink: 0;
    width: auto;
    max-width: none;
}

.credits-display i {
    color: #333;
    margin-right: 4px;
}

/* Credits container fixes */
.credits-container,
.credits-wrapper,
.d-flex .credits-display {
    flex-shrink: 0;
    min-width: fit-content;
    width: auto;
    max-width: none;
}

/* Header action buttons container */
.page-header .d-flex,
.header-actions,
.action-buttons-container {
    flex-wrap: nowrap;
    gap: 0.75rem;
    align-items: center;
}

.page-header .d-flex > *,
.header-actions > *,
.action-buttons-container > * {
    flex-shrink: 0;
    min-width: fit-content;
}

/* Credits display specific fixes */
.credits-display,
.credits-display *,
.credits-display span,
.credits-display div {
    flex-shrink: 0 !important;
    min-width: fit-content !important;
    white-space: nowrap !important;
    display: inline !important;
}

/* Fix for split credits elements */
.credits-display .ms-1,
.credits-display span.ms-1 {
    flex-shrink: 0 !important;
    min-width: fit-content !important;
    white-space: nowrap !important;
}

/* Ensure credits container doesn't shrink */
.credits-container,
.credits-wrapper,
.d-flex:has(.credits-display) {
    flex-shrink: 0 !important;
    min-width: fit-content !important;
}

/* Responsive credits display */
@media (max-width: 768px) {
    .credits-display {
        font-size: 0.9rem;
        padding: 0.3rem 0.6rem;
        height: 34px; /* Slightly smaller */
    }
}

@media (max-width: 576px) {
    .credits-display {
        font-size: 0.85rem;
        padding: 0.25rem 0.5rem;
        height: 32px; /* Even smaller */
    }

    /* Credits display simplified on very small screens */
    .credits-display {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .credits-display {
        font-size: 0.8rem;
        padding: 0.2rem 0.4rem;
        height: 30px;
    }

    /* Very small screens - show just the number */
    .credits-display .credits-text,
    .credits-display::after {
        display: none;
    }

    .credits-display::before {
        content: "💳 ";
    }
}

/* Recipe Card Action Buttons - Specific Override */
.recipe-actions .btn {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    padding: 8px 12px;
    min-height: 2rem;
    min-width: auto;
}

.recipe-actions .btn-view {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.recipe-actions .btn-view:hover {
    background: #0056b3;
    border-color: #0056b3;
    color: white;
    transform: translateY(-1px);
}

.recipe-actions .btn-edit {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.recipe-actions .btn-edit:hover {
    background: #1e7e34;
    border-color: #1e7e34;
    color: white;
    transform: translateY(-1px);
}

.recipe-actions .btn-delete {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.recipe-actions .btn-delete:hover {
    background: #c82333;
    border-color: #c82333;
    color: white;
    transform: translateY(-1px);
}
