/* Custom CSS - Sistema de Controle de Estoque e Cardápio Infantil */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --font-primary: 'Outfit', sans-serif;

    /* Color Palette */
    --color-primary: #d96a53;      /* Terracota suave */
    --color-primary-hover: #c45b45;
    --color-primary-light: #fbece9;
    
    --color-success: #5c8f75;      /* Sálvia suave */
    --color-success-hover: #4e7a63;
    --color-success-light: #eef4f0;

    --color-bg-app: #fbf9f6;       /* Fundo creme bem suave */
    --color-bg-card: #ffffff;
    --color-text-dark: #3a383d;    /* Grafite suave */
    --color-text-muted: #85808b;
    --color-border: #ebdcd7;       /* Borda sutil de tom quente */

    /* Stock Status Colors */
    --stock-green: #2ec4b6;
    --stock-blue: #4361ee;
    --stock-orange: #f77f00;
    --stock-yellow: #fcbf49;
    --stock-red: #e63946;

    /* Layout Elements */
    --border-radius-sm: 8px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    --shadow-sm: 0 2px 8px rgba(58, 56, 61, 0.04);
    --shadow-md: 0 8px 24px rgba(58, 56, 61, 0.06);
    --shadow-lg: 0 16px 32px rgba(58, 56, 61, 0.1);
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-bg-app);
    color: var(--color-text-dark);
    margin: 0;
    padding-bottom: 60px; /* Space for mobile screen margins */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography adjustments */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--color-text-dark);
}

/* Social Network Cover */
.cover-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, #fbece9 0%, #eef4f0 100%);
    box-shadow: var(--shadow-sm);
    border-bottom-left-radius: var(--border-radius-md);
    border-bottom-right-radius: var(--border-radius-md);
}

.cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 40%, rgba(0,0,0,0.4) 100%);
    display: flex;
    align-items: flex-end;
    padding: 20px;
}

.cover-title {
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    margin: 0;
}

.change-cover-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.change-cover-btn:hover {
    background: rgba(255, 255, 255, 0.45);
    transform: scale(1.05);
}

/* Custom Card Styling */
.card-custom {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    margin-bottom: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-custom:hover {
    box-shadow: var(--shadow-md);
}

/* Accordions Customization */
.accordion-item-custom {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border) !important;
    border-radius: var(--border-radius-md) !important;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.accordion-button-custom {
    background-color: var(--color-bg-card) !important;
    color: var(--color-text-dark) !important;
    font-weight: 600;
    font-size: 1.05rem;
    padding: 14px 18px;
    border: none !important;
    box-shadow: none !important;
}

.accordion-button-custom:not(.collapsed) {
    border-bottom: 1px solid var(--color-border) !important;
    background-color: var(--color-primary-light) !important;
    color: var(--color-primary) !important;
}

.accordion-body-custom {
    padding: 16px 18px;
    background-color: #ffffff;
}

/* Quantity input group controller */
.qty-controller {
    display: flex;
    align-items: center;
    max-width: 130px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    background-color: #fff;
    overflow: hidden;
}

.qty-btn {
    border: none;
    background: transparent;
    color: var(--color-text-dark);
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.1s;
}

.qty-btn:hover {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

.qty-input {
    width: 50px;
    height: 36px;
    border: none;
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text-dark);
}

.qty-input:focus {
    outline: none;
}

/* Consumption vertical dots */
.consumption-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dots-vertical {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.dot-circle {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #e2e0e5;
    border: 1px solid #c9c7cc;
    transition: all 0.2s ease;
}

.dot-circle.active {
    background-color: var(--color-success);
    border-color: var(--color-success);
}

/* Stock status indicators */
.stock-badge-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.badge-green { background-color: var(--stock-green); box-shadow: 0 0 6px var(--stock-green); }
.badge-blue { background-color: var(--stock-blue); box-shadow: 0 0 6px var(--stock-blue); }
.badge-orange { background-color: var(--stock-orange); box-shadow: 0 0 6px var(--stock-orange); }
.badge-yellow { background-color: var(--stock-yellow); box-shadow: 0 0 6px var(--stock-yellow); }
.badge-red { background-color: var(--stock-red); box-shadow: 0 0 6px var(--stock-red); }

/* Ingredient Item Row in Card */
.ingredient-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 8px;
    border-bottom: 1px solid #f2ece9;
    flex-wrap: wrap;
    gap: 12px;
}

.ingredient-row:last-child {
    border-bottom: none;
}

.ingredient-row.is-hidden {
    background-color: #f7f5f8;
    border-left: 3px dashed var(--color-text-muted);
}

.ing-name-col {
    flex: 1;
    min-width: 150px;
}

.ing-controls-col {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Floating Saves Toast */
.toast-saves {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: rgba(58, 56, 61, 0.95);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 1050;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.toast-saves.show {
    transform: translateX(-50%) translateY(0);
}

/* Header highlight cards */
.highlight-card {
    background: linear-gradient(135deg, var(--color-primary) 0%, #e28a75 100%);
    color: #ffffff;
    border: none;
}

.highlight-card h2, .highlight-card h3, .highlight-card h4, .highlight-card h5 {
    color: #ffffff;
}

/* Custom Checkbox Design for Menu */
.menu-checkbox-container {
    display: flex;
    align-items: center;
    padding: 10px 6px;
    border-radius: var(--border-radius-sm);
    color: #a41b1b;
    background-color: #ffffff;
    border: 1px solid var(--color-border);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.menu-checkbox-container:hover {
    border-color: var(--color-primary);
    background-color: var(--color-primary-light);
}

.menu-checkbox-container.checked {
    border-color: var(--color-success);
    background-color: var(--color-success-light);
}

.menu-checkbox-input {
    width: 20px;
    height: 20px;
    margin-right: 4px;
    border-radius: 4px;
    border: 2px solid var(--color-text-muted);
    cursor: pointer;
    accent-color: var(--color-success);
}

.menu-checkbox-container.checked .menu-checkbox-input {
    border-color: var(--color-success);
}

/* Plate display badge */
.plates-badge {
    background-color: #f7ede2;
    color: #b56576;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
}

/* Quick Action Buttons */
.btn-action {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.btn-action:hover {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

.btn-action.btn-delete:hover {
    background-color: #ffe6e6;
    color: var(--stock-red);
}

/* Custom primary buttons */
.btn-primary-custom {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    padding: 8px 16px;
    transition: all 0.2s;
}

.btn-primary-custom:hover, .btn-primary-custom:focus {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: #fff;
    box-shadow: 0 4px 12px rgba(217, 106, 83, 0.2);
}

.btn-secondary-custom {
    background-color: #fff;
    border-color: var(--color-border);
    color: var(--color-text-dark);
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    padding: 8px 16px;
}

.btn-secondary-custom:hover {
    background-color: #f7ece9;
    border-color: var(--color-border);
}

/* Quick Search Container */
.search-container {
    position: relative;
}

.search-input {
    border: 1px solid var(--color-border);
    border-radius: 30px;
    padding: 10px 18px 10px 40px;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(217, 106, 83, 0.15);
    outline: none;
}

.search-icon {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    color: var(--color-text-muted);
}

/* Category Badge Pills */
.category-pills-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.category-pills-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome/Safari */
}

.category-pill {
    padding: 6px 14px;
    border-radius: 20px;
    background-color: #ffffff;
    border: 1px solid var(--color-border);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.category-pill.active {
    background-color: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

/* Responsive adjustments */
@media (max-width: 575.98px) {
    .cover-container {
        height: 150px;
    }
    
    .ing-controls-col {
        width: 100%;
        justify-content: space-between;
        margin-top: 4px;
        padding-top: 8px;
        border-top: 1px solid #faf5f3;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

/* Drag & Drop - Meal ingredients reorder */
.sortable-ghost {
    opacity: 0.4;
    background-color: var(--color-primary-light) !important;
    border: 2px dashed var(--color-primary) !important;
    border-radius: var(--border-radius-sm);
}

.drag-handle {
    transition: color 0.15s;
}

.drag-handle:hover {
    color: var(--color-primary) !important;
}

/* Meal replace panel styling */
#meal-replace-panel {
    border-color: var(--color-primary) !important;
    background-color: var(--color-primary-light) !important;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Independent Profiles Module Styling --- */

/* Profile Selection Screen */
#profile-selection-container {
    animation: fadeIn 0.4s ease;
}

.min-vh-75 {
    min-height: 75vh;
}

/* Profile Selection Card */
.profile-select-card {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.profile-select-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.profile-card-img-wrapper {
    width: 90px;
    height: 90px;
    margin: 0 auto 16px;
    position: relative;
}

.profile-card-img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: var(--shadow-sm);
}

.profile-card-avatar-placeholder {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary-light) 0%, #ffe8e2 100%);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #fff;
    box-shadow: var(--shadow-sm);
}

.profile-card-name {
    font-weight: 700;
    color: var(--color-text-dark);
    margin-bottom: 4px;
    font-size: 1.15rem;
}

.profile-card-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Rounded navbar avatar and settings */
.rounded-bottom-4 {
    border-bottom-left-radius: var(--border-radius-md) !important;
    border-bottom-right-radius: var(--border-radius-md) !important;
}

#headerProfileDropdown::after {
    display: none; /* remove bootstrap default caret */
}

/* Avatar Preview inside Modal */
#profile-photo-placeholder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 575.98px) {
    .profile-select-card {
        padding: 16px;
    }
    .profile-card-img-wrapper, 
    .profile-card-img,
    .profile-card-avatar-placeholder {
        width: 75px;
        height: 75px;
    }
}
#profile-photo-preview {
    position: absolute;
}
