/* Custom styles for miaura.ai */

:root {
    --primary-color: #5d5fe9;
    --secondary-color: #d3b3ff;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --dark-color: #2a1a5e;
    --light-color: #f0f0f0;
    --gradient-bg: linear-gradient(to bottom, #2a1a5e, #1e2a78);
    --gradient-card: linear-gradient(145deg, #3c2a86, #1f3b7b);
    --border-radius: 20px;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
}

/* Global styles */
body {
    font-family: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--gradient-bg);
    color: #f0f0f0;
    line-height: 1.6;
    min-height: 100vh;
}

/* Fix border radius consistency */
.card, .btn, .form-control, .alert, .badge, .progress, .modal-content, .dropdown-menu {
    border-radius: var(--border-radius) !important;
    overflow: hidden; /* Ensures content respects border radius */
}

.card-header, .card-footer {
    border-radius: 0 !important;
}

.card-header:first-child {
    border-top-left-radius: var(--border-radius) !important;
    border-top-right-radius: var(--border-radius) !important;
}

.card-footer:last-child {
    border-bottom-left-radius: var(--border-radius) !important;
    border-bottom-right-radius: var(--border-radius) !important;
}

/* Plan cards on registration */
.plan-card {
    border-radius: var(--border-radius) !important;
    overflow: hidden !important;
}

.plan-card .card-header {
    border-top-left-radius: var(--border-radius) !important;
    border-top-right-radius: var(--border-radius) !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.plan-card .card-body {
    border-radius: 0 !important;
}

/* Gradient text effect */
.gradient-text {
    background-image: linear-gradient(to right, #e0b0ff, #007bff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

/* Navbar enhancements */
.navbar {
    background: var(--gradient-card) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(211, 179, 255, 0.2);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.8rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    margin: 0 0.25rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    color: #f0f0f0 !important;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(211, 179, 255, 0.2);
    color: var(--secondary-color) !important;
}

/* Card enhancements */
.card {
    background: var(--gradient-card);
    border: 1px solid rgba(211, 179, 255, 0.3);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
    color: #f0f0f0;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(93, 95, 233, 0.3);
    transform: translateY(-2px);
    border-color: rgba(211, 179, 255, 0.5);
}

.card-header {
    background: linear-gradient(135deg, rgba(93, 95, 233, 0.3), rgba(211, 179, 255, 0.2));
    border-bottom: 1px solid rgba(211, 179, 255, 0.3);
    font-weight: 600;
    color: var(--secondary-color);
}

/* Nutrition label styling */
.nutrition-label {
    font-family: 'Courier New', monospace;
    border: 2px solid #000;
    border-radius: var(--border-radius);
    background-color: #fff;
    color: #000;
    padding: 1rem;
    max-width: 400px;
}

.nutrition-label h4,
.nutrition-label h5,
.nutrition-label h6 {
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.nutrition-label .table {
    margin-bottom: 0;
    color: #000;
}

.nutrition-label .table td,
.nutrition-label .table th {
    border-color: #000;
    padding: 0.25rem 0.5rem;
}

/* File upload area */
.upload-area {
    border: 2px dashed var(--primary-color);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--success-color);
    background-color: rgba(13, 110, 253, 0.05);
}

.upload-area.dragover {
    border-color: var(--success-color);
    background-color: rgba(25, 135, 84, 0.1);
}

/* Progress bars */
.progress {
    height: 0.75rem;
    border-radius: var(--border-radius);
}

.progress-bar {
    border-radius: var(--border-radius);
}

/* Badge enhancements */
.badge {
    font-size: 0.75em;
    font-weight: 500;
}

/* Button enhancements */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border: none;
    box-shadow: 0 4px 15px rgba(93, 95, 233, 0.3);
}

.btn-primary:hover {
    background-color: #4c4ed6;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(93, 95, 233, 0.5);
}

/* Dietary Preferences Styling */
.preference-card {
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.preference-card:hover {
    border-color: #6f42c1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.15);
}

.preference-card input[type="checkbox"]:checked + label {
    background: linear-gradient(135deg, #6f42c1 0%, #8e44ad 100%);
    color: white !important;
    border-radius: 8px;
}

.preference-card input[type="checkbox"]:checked + label .preference-content {
    color: white !important;
}

.preference-card input[type="checkbox"]:checked + label .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

.preference-card .preference-content {
    color: #212529;
}

.preference-card .preference-content .text-muted {
    color: #6c757d !important;
}

.preference-content {
    text-align: center;
    padding: 10px;
}

.preference-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 8px;
}

/* Heart Button for Saved Foods */
.heart-btn {
    transition: all 0.3s ease;
    border: none;
    background: transparent;
    font-size: 1.25rem;
    color: #6c757d;
}

.heart-btn:hover {
    color: #e74c3c;
    transform: scale(1.2);
}

.heart-btn.hearted {
    color: #e74c3c;
    animation: heartBeat 0.5s ease-in-out;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Food Rating Cards */
.food-rating-card {
    border-left: 4px solid #dee2e6;
    transition: all 0.3s ease;
}

.food-rating-card.rating-excellent {
    border-left-color: #28a745;
}

.food-rating-card.rating-good {
    border-left-color: #ffc107;
}

.food-rating-card.rating-poor {
    border-left-color: #dc3545;
}

.preference-score {
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: inline-block;
    margin: 2px;
}

/* Fix text readability only on scan result pages and specific sections */
.scan-result-page .card .text-muted {
    color: #6c757d !important;
}

.scan-result-page .card-body, .scan-result-page .card-header {
    color: #212529 !important;
}

.scan-result-page .table td, .scan-result-page .table th {
    color: #212529 !important;
}

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

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

/* Form enhancements */
.form-control,
.form-select {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(211, 179, 255, 0.3);
    border-radius: var(--border-radius);
    color: #f0f0f0;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(93, 95, 233, 0.25);
    color: #f0f0f0;
}

.form-control::placeholder {
    color: rgba(240, 240, 240, 0.6);
}

/* Alert enhancements */
.alert {
    border-radius: var(--border-radius);
    border: none;
    font-weight: 500;
}

.alert-dismissible .btn-close {
    padding: 0.75rem 1rem;
}

/* Table enhancements */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table-responsive {
    border-radius: var(--border-radius);
}

/* Food diary specific styles */
.meal-section {
    margin-bottom: 2rem;
}

.meal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    color: white;
    padding: 1rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

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

.nutrition-item {
    text-align: center;
    padding: 1rem;
    background-color: var(--light-color);
    border-radius: var(--border-radius);
}

.nutrition-item h5 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.nutrition-item small {
    color: #6c757d;
    font-weight: 500;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .nutrition-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .nutrition-summary {
        grid-template-columns: 1fr;
    }
    
    .d-grid.gap-2.d-md-block .btn {
        margin-bottom: 0.5rem;
    }
}

/* Dark mode specific adjustments */
[data-bs-theme="dark"] .nutrition-label {
    background-color: #343a40;
    color: #fff;
    border-color: #6c757d;
}

[data-bs-theme="dark"] .nutrition-label .table {
    color: #fff;
}

[data-bs-theme="dark"] .nutrition-label .table td,
[data-bs-theme="dark"] .nutrition-label .table th {
    border-color: #6c757d;
}

[data-bs-theme="dark"] .nutrition-item {
    background-color: #343a40;
    color: #fff;
}

[data-bs-theme="dark"] .upload-area {
    border-color: #6c757d;
    color: #fff;
}

[data-bs-theme="dark"] .upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
}

/* 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);
    }
}

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid transparent;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

.border-primary {
    border-color: var(--primary-color) !important;
}

.bg-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
}

.cursor-pointer {
    cursor: pointer;
}

/* Footer styles */
footer {
    margin-top: auto;
}

/* Chart container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}
