/* Custom styles for Calorie Tracker */

:root {
    --transition-speed: 0.3s;
    --custom-card-bg: #1e1e2e;
    --custom-light-bg: #2a2d3a;
    --custom-lighter-bg: #363a4f;
    --custom-accent: #74c0fc;
    --custom-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Smooth transitions for interactive elements */
.btn, .card, .form-control, .form-select {
    transition: all var(--transition-speed) ease;
}

/* Card hover effects */
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Progress bar animations */
.progress-bar {
    transition: width 1s ease-in-out;
}

/* Loading spinner overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bs-gray-200);
}

::-webkit-scrollbar-thumb {
    background: var(--bs-gray-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-gray-500);
}

/* Nutrition preview styles */
#nutritionPreview {
    border: 1px solid var(--bs-border-color);
    background: var(--custom-light-bg);
    color: #fff;
}

/* Search results animation */
.list-group-item {
    transition: background-color var(--transition-speed) ease;
}

.list-group-item:hover {
    background-color: var(--custom-lighter-bg);
}

/* Food entry cards */
.food-entry-card {
    border-left: 4px solid var(--bs-primary);
}

.food-entry-card.breakfast {
    border-left-color: var(--bs-warning);
}

.food-entry-card.lunch {
    border-left-color: var(--bs-success);
}

.food-entry-card.dinner {
    border-left-color: var(--bs-info);
}

.food-entry-card.snack {
    border-left-color: var(--bs-secondary);
}

/* Dashboard progress indicators */
.progress {
    height: 8px;
    border-radius: 4px;
}

/* Modal animations */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -50px);
}

.modal.show .modal-dialog {
    transform: none;
}

/* Form focus styles */
.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

/* Alert animations */
@keyframes slideInDown {
    from {
        transform: translate3d(0, -100%, 0);
        visibility: visible;
    }
    to {
        transform: translate3d(0, 0, 0);
    }
}

.alert {
    animation: slideInDown 0.5s ease-out;
}

/* Button loading state */
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Responsive font sizes */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2.5rem;
    }
    
    .display-5 {
        font-size: 2rem;
    }
    
    .display-6 {
        font-size: 1.75rem;
    }
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .modal,
    footer {
        display: none !important;
    }
    
    .container {
        width: 100% !important;
        max-width: none !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators for keyboard navigation */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid;
    }
    
    .btn {
        border: 2px solid;
    }
}

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

/* Custom utility classes */
.bg-gradient-primary {
    background: var(--custom-gradient);
}

/* Override card backgrounds */
.card {
    background-color: var(--custom-card-bg) !important;
    border-color: #404040;
}

.card-header {
    background-color: var(--custom-light-bg) !important;
    border-color: #404040;
}

/* Override light backgrounds */
.bg-light {
    background-color: var(--custom-light-bg) !important;
    color: #fff !important;
}

.bg-light .text-muted {
    color: #bbb !important;
}

/* Alert boxes */
.alert-info {
    background-color: var(--custom-light-bg) !important;
    border-color: var(--custom-accent);
    color: #fff !important;
}

/* Button enhancements */
.btn-primary {
    background: var(--custom-gradient) !important;
    border: none !important;
}

.btn-outline-primary {
    border-color: var(--custom-accent) !important;
    color: var(--custom-accent) !important;
}

.btn-outline-primary:hover {
    background-color: var(--custom-accent) !important;
    color: #000 !important;
}

/* Progress bars with gradients */
.progress-bar {
    background: var(--custom-gradient) !important;
}

/* Form improvements */
.form-control, .form-select {
    background-color: var(--custom-light-bg) !important;
    border-color: #555 !important;
    color: #fff !important;
}

.form-control:focus, .form-select:focus {
    background-color: var(--custom-lighter-bg) !important;
    border-color: var(--custom-accent) !important;
    color: #fff !important;
}

/* Modal improvements */
.modal-content {
    background-color: var(--custom-card-bg) !important;
}

.modal-header {
    border-color: #404040 !important;
    background-color: var(--custom-light-bg) !important;
}

.modal-footer {
    border-color: #404040 !important;
}

/* Food entry highlights */
.bg-light.rounded {
    background-color: var(--custom-light-bg) !important;
    color: #fff !important;
}

/* Dashboard meal entries */
.d-flex.bg-light {
    background-color: var(--custom-light-bg) !important;
    color: #fff !important;
}

/* Empty meal state */
.text-center.text-muted {
    background-color: var(--custom-lighter-bg) !important;
    color: #ccc !important;
    padding: 2rem !important;
    border-radius: 8px !important;
}

/* Card backgrounds in dashboard */
.card.bg-light {
    background-color: var(--custom-card-bg) !important;
    color: #fff !important;
}

/* Override any remaining white backgrounds */
.bg-white {
    background-color: var(--custom-card-bg) !important;
}

/* List group items */
.list-group-item {
    background-color: var(--custom-light-bg) !important;
    border-color: #404040 !important;
    color: #fff !important;
}

/* Dashboard specific fixes */
.dashboard .card-body .text-center {
    background-color: var(--custom-lighter-bg) !important;
    padding: 2rem !important;
    border-radius: 8px !important;
    margin: 1rem 0 !important;
}

/* Make sure all text is visible on dark backgrounds */
.card .text-muted {
    color: #bbb !important;
}

.card small.text-muted {
    color: #aaa !important;
}

/* Progress card enhancements */
.progress {
    background-color: var(--custom-lighter-bg) !important;
}

/* Border improvements */
.border-top {
    border-color: #404040 !important;
}

/* Ensure no white backgrounds slip through */
* {
    --bs-body-bg: #181825;
}

/* Fix share modal card */
.modal .card.bg-light {
    background-color: var(--custom-light-bg) !important;
    color: #fff !important;
}

/* Modern Search Page Styling */
.modern-search-page {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.modern-search-page .form-control {
    border: 2px solid #e9ecef !important;
    background: #f8f9fa !important;
    color: #333 !important;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.modern-search-page .form-control:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25) !important;
    background: #fff !important;
}

.modern-search-page .card {
    background: #fff !important;
    border: none !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    border-radius: 12px !important;
}

.modern-search-page .btn-light {
    background: #f8f9fa !important;
    border: 2px solid #e9ecef !important;
    color: #495057 !important;
    transition: all 0.3s ease;
}

.modern-search-page .btn-light:hover {
    background: #e9ecef !important;
    border-color: #dee2e6 !important;
    transform: translateY(-1px);
}

.modern-search-page .text-dark {
    color: #2c3e50 !important;
}

.modern-search-page .text-muted {
    color: #6c757d !important;
}

/* Food results styling */
.food-result-card {
    background: #fff !important;
    border: 1px solid #e9ecef !important;
    border-radius: 12px !important;
    transition: all 0.3s ease;
    color: #333 !important;
}

.food-result-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
    transform: translateY(-2px);
    border-color: #007bff !important;
}

/* Override dark theme for search page */
.search-page-override {
    background: #f8f9fa !important;
    color: #333 !important;
}

/* Food entries specifically */
.d-flex.p-2.bg-light {
    background-color: var(--custom-light-bg) !important;
    color: #fff !important;
    border: 1px solid #404040 !important;
}

/* Make sure text is visible on dark backgrounds */
.bg-light .text-muted {
    color: #bbb !important;
}

.bg-light small {
    color: #ccc !important;
}

/* Navbar brand enhancement */
.navbar-brand {
    background: var(--custom-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

.text-shadow {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.border-start-primary {
    border-left: 4px solid var(--bs-primary) !important;
}

.border-start-success {
    border-left: 4px solid var(--bs-success) !important;
}

.border-start-warning {
    border-left: 4px solid var(--bs-warning) !important;
}

.border-start-info {
    border-left: 4px solid var(--bs-info) !important;
}

/* Spacing utilities for mobile */
@media (max-width: 576px) {
    .px-sm-2 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .py-sm-3 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
}
