/**
 * Dashboard & Reports Page Styles
 * EasyHome - EasyApps
 */

/* Use the same color variables as the main app */
: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);
}

/* Page Header */
.display-4 {
    color: var(--foliage-green);
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.lead {
    color: var(--terracotta);
    font-size: 1.1rem;
    font-weight: 500;
}

/* Stats Cards */
.stats-card {
    border: 2px solid var(--mountain-green);
    border-radius: 15px;
    box-shadow: 0 8px 25px var(--shadow);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    height: 100%;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(32, 178, 170, 0.2);
    border-color: var(--teal-primary);
}

.stats-card .card-body {
    padding: 1.5rem;
}

.stats-card i {
    opacity: 0.8;
}

.stats-card h3 {
    font-weight: 700;
    margin: 0.5rem 0;
}

/* Stats Cards - Smaller */
.stats-card {
    min-height: 100px;
    height: 100px;
}

.stats-card .card-body {
    padding: 0.75rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stats-card i {
    font-size: 1.25rem;
    margin-bottom: 0.375rem;
}

.stats-card h5 {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: var(--foliage-green);
}

.stats-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0.2rem 0;
}

.stats-card small {
    font-size: 0.65rem;
    margin-top: 0.2rem;
}

/* Compact Stat Tiles */
.stat-tile {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(169, 203, 164, 0.2);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 80px;
}

.stat-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-color: var(--foliage-green);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-tile:nth-child(1) .stat-icon {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}

.stat-tile:nth-child(2) .stat-icon {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
}

.stat-tile:nth-child(3) .stat-icon {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
}

.stat-tile:nth-child(4) .stat-icon {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foliage-green);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
    line-height: 1.2;
}

/* Main Cards */
.card {
    border: 2px solid var(--mountain-green);
    border-radius: 15px;
    box-shadow: 0 8px 25px var(--shadow);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(32, 178, 170, 0.2);
    border-color: var(--teal-primary);
}

.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;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.card-title {
    margin-bottom: 0;
    font-weight: 600;
}

/* Credits Display */
.credits-display {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: var(--text-dark);
    padding: 8px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
    align-items: center;
    white-space: nowrap;
    display: inline-flex;
}

.credits-display i {
    color: var(--text-dark);
}

/* Buttons */
.btn {
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--foliage-green) 0%, var(--mountain-green) 100%);
    border-color: var(--foliage-green);
    color: var(--text-light);
}

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

.btn-outline-primary {
    border-color: var(--foliage-green);
    color: var(--foliage-green);
}

.btn-outline-primary:hover {
    background-color: var(--foliage-green);
    border-color: var(--foliage-green);
    color: var(--text-light);
}

.btn-outline-success {
    border-color: var(--foliage-green);
    color: var(--foliage-green);
}

.btn-outline-success:hover {
    background-color: var(--foliage-green);
    border-color: var(--foliage-green);
    color: var(--text-light);
}

.btn-outline-warning {
    border-color: var(--terracotta);
    color: var(--terracotta);
}

.btn-outline-warning:hover {
    background-color: var(--terracotta);
    border-color: var(--terracotta);
    color: var(--text-light);
}

.btn-outline-info {
    border-color: var(--mountain-green);
    color: var(--mountain-green);
}

.btn-outline-info:hover {
    background-color: var(--mountain-green);
    border-color: var(--mountain-green);
    color: var(--text-light);
}

.btn-outline-secondary {
    border-color: #6c757d;
    color: #6c757d;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: var(--text-light);
}

/* Activity List */
.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(169, 203, 164, 0.3);
    transition: background-color 0.3s ease;
}

.activity-item:hover {
    background-color: rgba(169, 203, 164, 0.1);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
}

.activity-icon.recipe {
    background: linear-gradient(135deg, var(--teal-primary) 0%, var(--mountain-green) 100%);
    color: var(--text-light);
}

.activity-icon.meal {
    background: linear-gradient(135deg, var(--foliage-green) 0%, var(--mountain-green) 100%);
    color: var(--text-light);
}

.activity-icon.chore {
    background: linear-gradient(135deg, var(--terracotta) 0%, var(--orange-accent) 100%);
    color: var(--text-light);
}

.activity-icon.finance {
    background: linear-gradient(135deg, var(--mountain-green) 0%, var(--foliage-green) 100%);
    color: var(--text-light);
}

/* Badge */
.badge {
    font-size: 0.7rem;
    padding: 0.4rem 0.6rem;
    border-radius: 10px;
}

.bg-warning {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%) !important;
    color: var(--text-dark) !important;
}

/* Alert */
.alert {
    border-radius: 10px;
    border: none;
    font-weight: 500;
    box-shadow: 0 2px 4px var(--shadow);
}

.alert-info {
    background: linear-gradient(135deg, rgba(169, 203, 164, 0.2) 0%, rgba(74, 112, 72, 0.1) 100%);
    color: var(--foliage-green);
    border-left: 4px solid var(--mountain-green);
}

/* Modal */
.modal-content {
    border-radius: 15px;
    border: 2px solid var(--mountain-green);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.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-bottom: none;
}

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

.btn-close {
    filter: invert(1);
}

/* AI Report Content */
.ai-report-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(169, 203, 164, 0.05);
    border-radius: 10px;
    border-left: 4px solid var(--foliage-green);
}

.ai-report-section h6 {
    color: var(--foliage-green);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.ai-report-section p {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.ai-insight {
    background: rgba(255, 255, 255, 0.8);
    padding: 0.75rem;
    border-radius: 8px;
    margin: 0.5rem 0;
    border-left: 3px solid var(--terracotta);
}

.ai-insight .insight-title {
    font-weight: 600;
    color: var(--terracotta);
    margin-bottom: 0.25rem;
}

.ai-insight .insight-text {
    color: var(--text-dark);
    font-size: 0.9rem;
}

/* Loading States */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(169, 203, 164, 0.3);
    border-radius: 50%;
    border-top-color: var(--foliage-green);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2rem;
    }

    .lead {
        font-size: 1rem;
    }

    .stats-card .card-body {
        padding: 1rem;
    }

    .stats-card h3 {
        font-size: 1.5rem;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        border-radius: 10px !important;
        margin-bottom: 0.5rem;
    }
}

@media (max-width: 576px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    .stats-card h3 {
        font-size: 1.25rem;
    }

    .credits-display {
        font-size: 0.8rem;
        padding: 6px 10px;
    }

    /* Make meal plan table horizontally scrollable on mobile */
    #meal-plan-grid .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -15px;
        padding: 0 15px;
    }

    .meal-plan-table {
        font-size: 0.85rem;
        min-width: 700px; /* Ensure table doesn't shrink too much */
    }

    /* Make table scrollable on mobile instead of breaking layout */
    @media (max-width: 768px) {
        .meal-plan-table-container {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            width: 100%;
        }

        .meal-plan-table {
            min-width: 600px; /* Reduced for smaller screens */
        }
    }

    @media (max-width: 480px) {
        .meal-plan-table {
            min-width: 500px; /* Further reduced for very small screens */
        }
    }

    .meal-plan-table thead th {
        padding: 8px 4px;
        font-size: 0.75rem;
        min-width: 60px;
    }

    .meal-plan-table tbody td {
        padding: 6px 4px;
        min-width: 70px;
    }

    .meal-plan-table .day-header {
        font-size: 0.8rem;
        padding: 8px 4px;
    }

    .meal-image {
        width: 35px;
        height: 35px;
    }

    .meal-name {
        font-size: 0.75rem;
    }

    .meal-item {
        padding: 4px;
    }
}

/* Calendar Grid Meal Plan Table */
.meal-plan-table {
    margin-bottom: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px var(--shadow);
    width: 100%;
    table-layout: auto;
}

.meal-plan-table thead th {
    background: linear-gradient(135deg, var(--foliage-green) 0%, var(--mountain-green) 100%);
    color: var(--text-light);
    font-weight: 600;
    text-align: center;
    padding: 15px 10px;
    border: none;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    min-width: 80px;
}

.meal-plan-table tbody tr {
    transition: background-color 0.3s ease;
}

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

.meal-plan-table tbody td {
    padding: 12px 10px;
    vertical-align: middle;
    border: 1px solid rgba(169, 203, 164, 0.3);
    min-width: 100px;
}

.day-header {
    background: linear-gradient(135deg, var(--foliage-green) 0%, var(--mountain-green) 100%);
    color: var(--text-light);
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    text-align: center;
}

/* Meal Slots */
.meal-slot {
    min-height: 80px;
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    transition: background-color 0.3s ease;
}

.meal-slot:hover {
    background: rgba(169, 203, 164, 0.2);
}

.meal-slot.empty {
    color: var(--terracotta);
    font-style: italic;
    text-align: center;
    background: rgba(210, 105, 30, 0.1);
}

.meal-item {
    text-align: center;
    padding: 8px;
    position: relative;
}

.meal-item.clickable-meal {
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.meal-item.clickable-meal:hover {
    background: rgba(210, 105, 30, 0.1);
    border-color: var(--terracotta);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(210, 105, 30, 0.3);
}

.meal-click-hint {
    position: absolute;
    top: 5px;
    right: 5px;
    color: var(--terracotta);
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.meal-item.clickable-meal:hover .meal-click-hint {
    opacity: 1;
}

.meal-name {
    font-weight: 600;
    color: var(--foliage-green);
    margin-bottom: 5px;
    word-wrap: break-word;
    font-size: 0.9rem;
}

.meal-image {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--mountain-green);
    box-shadow: 0 2px 8px var(--shadow);
    margin: 0 auto 5px auto;
    display: block;
}

.meal-image-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid var(--mountain-green);
    background: rgba(169, 203, 164, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 5px auto;
    color: var(--foliage-green);
    font-size: 1.2rem;
}

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

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

/* Enhanced Responsive Design for All Screen Types */

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
    .container-fluid {
        max-width: 1320px;
        margin: 0 auto;
    }

    .stat-card {
        padding: 2rem;
    }

    .stats-card.compact {
        width: 150px;
        margin: 0 0.75rem;
    }

    .stats-card.compact .card-body {
        padding: 0.625rem 0.5rem;
    }

    .stats-card.compact i {
        font-size: 1.75rem;
    }

    .stats-card.compact h4 {
        font-size: 1.5rem;
    }

    .stats-card.compact h6 {
        font-size: 1rem;
    }

    .stat-tile {
        padding: 1.25rem;
        min-height: 90px;
    }

    .stat-icon {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    .stat-number {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 1rem;
    }

    .meal-plan-table {
        font-size: 1.1rem;
    }

    .meal-image {
        width: 60px;
        height: 60px;
    }
}

/* Desktop (1200px - 1399px) */
@media (max-width: 1399px) and (min-width: 1200px) {
    .container-fluid {
        padding: 0 2rem;
    }

    .stat-card {
        padding: 1.5rem;
    }

    .stats-card.compact {
        width: 140px;
        margin: 0 0.625rem;
    }

    .stats-card.compact .card-body {
        padding: 0.5rem 0.375rem;
    }

    .stats-card.compact i {
        font-size: 1.5rem;
    }

    .stats-card.compact h4 {
        font-size: 1.25rem;
    }

    .stats-card.compact h6 {
        font-size: 0.875rem;
    }

    .stat-tile {
        padding: 1rem;
        min-height: 85px;
    }

    .stat-icon {
        width: 52px;
        height: 52px;
        font-size: 1.375rem;
    }

    .stat-number {
        font-size: 1.625rem;
    }

    .stat-label {
        font-size: 0.9375rem;
    }
}

/* Tablet Landscape (992px - 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .container-fluid {
        padding: 0 1.5rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stats-card.compact {
        width: 120px;
        margin: 0 0.5rem;
    }

    .stats-card.compact .card-body {
        padding: 0.375rem 0.25rem;
    }

    .stats-card.compact i {
        font-size: 1.25rem;
    }

    .stats-card.compact h4 {
        font-size: 1.125rem;
    }

    .stats-card.compact h6 {
        font-size: 0.8125rem;
    }

    .stat-tile {
        padding: 0.875rem;
        min-height: 80px;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.875rem;
    }

    .stat-card h4 {
        font-size: 1.5rem;
    }

    .meal-plan-table {
        font-size: 0.95rem;
    }

    .meal-plan-table thead th {
        padding: 12px 8px;
        font-size: 0.9rem;
    }

    .meal-plan-table tbody td {
        padding: 10px 8px;
        min-width: 90px;
    }

    .meal-image {
        width: 45px;
        height: 45px;
    }

    .meal-name {
        font-size: 0.85rem;
    }
}

/* Tablet Portrait (768px - 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .container-fluid {
        padding: 0 1rem;
    }

    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .col-md-3, .col-md-6, .col-md-8, .col-md-4 {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .stat-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .stats-card.compact {
        width: 110px;
        margin: 0 0.375rem;
    }

    .stats-card.compact .card-body {
        padding: 0.25rem 0.1875rem;
    }

    .stats-card.compact i {
        font-size: 1rem;
    }

    .stats-card.compact h4 {
        font-size: 1rem;
    }

    .stats-card.compact h6 {
        font-size: 0.75rem;
    }

    .stat-tile {
        padding: 0.75rem;
        min-height: 75px;
        gap: 0.5rem;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.125rem;
    }

    .stat-number {
        font-size: 1.375rem;
    }

    .stat-label {
        font-size: 0.8125rem;
    }

    .stat-card h4 {
        font-size: 1.25rem;
    }

    .stat-card i {
        font-size: 1.5rem;
    }

    .card-body {
        padding: 1rem;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        margin-bottom: 0.5rem;
        border-radius: 0.375rem !important;
    }

    /* Make meal plan table horizontally scrollable on tablets */
    #meal-plan-grid .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .meal-plan-table {
        font-size: 0.9rem;
        min-width: 800px; /* Ensure table doesn't shrink too much */
    }

    /* Make table scrollable on mobile */
    @media (max-width: 768px) {
        .meal-plan-table {
            min-width: 600px; /* Reduced for smaller screens */
        }
    }

    @media (max-width: 480px) {
        .meal-plan-table {
            min-width: 500px; /* Further reduced for very small screens */
        }
    }
    @media (max-width: 768px) {
        .table-container {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            width: 100%;
        }

        .table-container table {
            min-width: 600px; /* Reduced for smaller screens */
        }
    }

    @media (max-width: 480px) {
        .table-container table {
            min-width: 500px; /* Further reduced for very small screens */
        }
    }

    .meal-plan-table thead th {
        padding: 10px 6px;
        font-size: 0.85rem;
        min-width: 70px;
    }

    .meal-plan-table tbody td {
        padding: 8px 6px;
        min-width: 80px;
    }

    .meal-image {
        width: 40px;
        height: 40px;
    }

    .meal-name {
        font-size: 0.8rem;
    }
}

/* Mobile Landscape (576px - 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    .container-fluid {
        padding: 0 0.75rem;
    }

    .display-4 {
        font-size: 2rem;
    }

    .lead {
        font-size: 1rem;
    }

    .stat-card {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .stats-card.compact {
        width: 100px;
        margin: 0 0.25rem;
    }

    .stats-card.compact .card-body {
        padding: 0.125rem 0.0625rem;
    }

    .stats-card.compact i {
        font-size: 0.75rem;
    }

    .stats-card.compact h4 {
        font-size: 0.75rem;
    }

    .stats-card.compact h6 {
        font-size: 0.625rem;
    }

    .stat-tile {
        padding: 0.625rem;
        min-height: 70px;
        gap: 0.5rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .stat-number {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .stat-card h4 {
        font-size: 1.1rem;
    }

    .stat-card i {
        font-size: 1.25rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        margin-bottom: 0.25rem;
        border-radius: 0.375rem !important;
    }

    .d-grid.gap-2 {
        gap: 0.5rem !important;
    }

    .meal-plan-table {
        font-size: 0.8rem;
    }

    .meal-image {
        width: 35px;
        height: 35px;
    }

    .meal-name {
        font-size: 0.75rem;
    }

    .meal-plan-table thead th,
    .day-header {
        padding: 8px 4px;
        font-size: 0.8rem;
    }

    .meal-plan-table tbody td {
        padding: 8px 4px;
    }
}

/* Mobile Portrait (up to 575px) */
@media (max-width: 575px) {
    .container-fluid {
        padding: 0 0.5rem;
    }

    .display-4 {
        font-size: 1.75rem;
    }

    .lead {
        font-size: 0.9rem;
    }

    .stat-card {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .stats-card.compact {
        width: 90px;
        margin: 0 0.125rem;
    }

    .stats-card.compact .card-body {
        padding: 0.0625rem 0.03125rem;
    }

    .stats-card.compact i {
        font-size: 0.625rem;
    }

    .stats-card.compact h4 {
        font-size: 0.625rem;
    }

    .stats-card.compact h6 {
        font-size: 0.5rem;
    }

    .stat-tile {
        padding: 0.5rem;
        min-height: 65px;
        gap: 0.375rem;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .stat-number {
        font-size: 1.125rem;
    }

    .stat-label {
        font-size: 0.6875rem;
    }

    .stat-card h4 {
        font-size: 1rem;
    }

    .stat-card i {
        font-size: 1rem;
    }

    .card-body {
        padding: 0.5rem;
    }

    .btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        margin-bottom: 0.25rem;
        border-radius: 0.375rem !important;
    }

    .d-grid.gap-2 {
        gap: 0.375rem !important;
    }

    .meal-plan-table {
        font-size: 0.7rem;
    }

    .meal-image {
        width: 30px;
        height: 30px;
    }

    .meal-name {
        font-size: 0.7rem;
    }

    .meal-plan-table thead th,
    .day-header {
        padding: 6px 2px;
        font-size: 0.7rem;
    }

    .meal-plan-table tbody td {
        padding: 6px 2px;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-body {
        padding: 0.75rem;
    }

    .credits-display {
        font-size: 0.8rem;
    }

    .credits-display i {
        font-size: 0.8rem;
    }
}

/* Extra Small Mobile (up to 375px) */
@media (max-width: 375px) {
    .container-fluid {
        padding: 0 0.25rem;
    }

    .display-4 {
        font-size: 1.5rem;
    }

    .lead {
        font-size: 0.8rem;
    }

    .stat-card {
        padding: 0.375rem;
        margin-bottom: 0.375rem;
    }

    .stats-card.compact .card-body {
        padding: 0.03125rem 0.015625rem;
    }

    .stats-card.compact i {
        font-size: 0.4375rem;
    }

    .stats-card.compact h4 {
        font-size: 0.4375rem;
    }

    .stats-card.compact h6 {
        font-size: 0.375rem;
    }

    .stat-tile {
        padding: 0.375rem;
        min-height: 60px;
        gap: 0.25rem;
    }

    .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .stat-number {
        font-size: 1rem;
    }

    .stat-label {
        font-size: 0.625rem;
    }

    .stat-card h4 {
        font-size: 0.9rem;
    }

    .stat-card i {
        font-size: 0.9rem;
    }

    .card-body {
        padding: 0.375rem;
    }

    .btn {
        padding: 0.25rem 0.375rem;
        font-size: 0.75rem;
    }

    .meal-plan-table {
        font-size: 0.65rem;
    }

    .meal-image {
        width: 25px;
        height: 25px;
    }

    .meal-name {
        font-size: 0.65rem;
    }

    .meal-plan-table thead th,
    .day-header {
        padding: 4px 1px;
        font-size: 0.65rem;
    }

    .meal-plan-table tbody td {
        padding: 4px 1px;
    }
}

/* Responsive adjustments for .stats-card */
@media (max-width: 991px) {
    .stats-card {
        min-height: 240px;
        height: 240px;
    }

    .stats-card .card-body {
        padding: 1.5rem;
    }

    .stats-card i {
        font-size: 3rem;
    }

    .stats-card h5 {
        font-size: 1.25rem;
    }

    .stats-card h3 {
        font-size: 2.8rem;
    }

    .stats-card small {
        font-size: 1rem;
    }
}

@media (max-width: 767px) {
    .stats-card {
        min-height: 200px;
        height: 200px;
    }

    .stats-card .card-body {
        padding: 1.25rem;
    }

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

    .stats-card h5 {
        font-size: 1.1rem;
    }

    .stats-card h3 {
        font-size: 2.2rem;
    }

    .stats-card small {
        font-size: 0.9rem;
    }
}

@media (max-width: 575px) {
    .stats-card {
        min-height: 180px;
        height: 180px;
    }

    .stats-card .card-body {
        padding: 1rem;
    }

    .stats-card i {
        font-size: 2rem;
    }

    .stats-card h5 {
        font-size: 1rem;
    }

    .stats-card h3 {
        font-size: 1.8rem;
    }

    .stats-card small {
        font-size: 0.8rem;
    }
}

/* Print Styles */
@media print {
    .btn, .modal, .navbar, .flash-messages-container {
        display: none !important;
    }

    .container-fluid {
        padding: 0;
    }

    .card {
        border: 1px solid #000;
        box-shadow: none;
    }

    .meal-plan-table {
        font-size: 10pt;
    }
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
