/* ═══════════════════════════════════════════════════════════════════════════
   MAS BOSOM · DASHBOARD MENÚ SETMANAL
   Estil basat en Can Llach amb paleta Mas Bosom
   ═══════════════════════════════════════════════════════════════════════════ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors Mas Bosom */
    --accent: #8B7355;
    --accent-hover: #6d5a44;
    --accent-light: rgba(139, 115, 85, 0.08);
    
    --text: #5C4A3A;
    --text-light: #8a7565;
    --text-muted: #a09080;
    
    --bg: #FAF8F5;
    --bg-card: #FFFFFF;
    --border: #d9cfc5;
    --border-light: #e8e4df;
    
    --supplement: #A67C52;
    --supplement-bg: rgba(166, 124, 82, 0.1);
    
    /* States */
    --success: #5a9f7e;
    --success-bg: #e8f5e9;
    --danger: #c74a4a;
    --danger-bg: #ffebee;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    
    /* Geometria */
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(92, 74, 58, 0.05);
    --shadow: 0 4px 6px -1px rgba(92, 74, 58, 0.08);
    --shadow-lg: 0 10px 25px -3px rgba(92, 74, 58, 0.1);
    
    /* Transitions */
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* HEADER */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    font-family: 'Crimson Pro', serif;
    font-size: 1.5rem;
    font-weight: 600;
    font-style: italic;
    color: var(--accent);
    letter-spacing: 0.02em;
}

.logo-sub {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 400;
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.menu-type-toggle {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem;
    background: var(--accent-light);
    border-radius: var(--radius);
}

.toggle-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    font-family: 'Poppins', sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    background: transparent;
    color: var(--text-light);
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.toggle-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: var(--shadow-sm);
}

.status-live {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    background: var(--success-bg);
    border: 1px solid #c8e6c9;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--success);
}

.status-live-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* MAIN */
.main {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    height: 100%;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-family: 'Crimson Pro', serif;
    font-size: 1.125rem;
    font-weight: 500;
    font-style: italic;
    color: var(--accent);
    margin: 0;
}

.card-body {
    padding: 1.25rem;
}

.card-info {
    background: linear-gradient(135deg, rgba(139, 115, 85, 0.03) 0%, rgba(139, 115, 85, 0.08) 100%);
    border-color: var(--accent-light);
}

.info-item {
    display: flex;
    align-items: start;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-light);
    line-height: 1.5;
}

.info-item svg {
    flex-shrink: 0;
    margin-top: 0.125rem;
    opacity: 0.6;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.375rem;
}

.input,
.textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    color: var(--text);
    background: var(--bg-card);
    transition: all 0.2s var(--ease);
}

.input:focus,
.textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

.btn {
    padding: 0.625rem 1.125rem;
    border: none;
    border-radius: var(--radius);
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--accent-light);
    color: var(--accent);
}

.btn-secondary:hover {
    background: rgba(139, 115, 85, 0.15);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--border);
}

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

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #b33b3b;
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease);
}

.btn-icon:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   SECTIONS LIST
   ═══════════════════════════════════════════════════════════════════════════ */

.sections-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.section-item {
    padding: 0.875rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.section-item:hover {
    background: var(--accent-light);
}

.section-item.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

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

.section-item-name {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
}

.section-item-count {
    font-size: 0.75rem;
    opacity: 0.7;
}

.section-item-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.section-item:hover .section-item-actions {
    opacity: 1;
}

.section-item.active .section-item-actions {
    opacity: 1;
}

.section-item-actions button {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: currentColor;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.section-item-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTENT AREA
   ═══════════════════════════════════════════════════════════════════════════ */

.content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.content-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.content-header h2 {
    font-family: 'Crimson Pro', serif;
    font-size: 1.5rem;
    font-weight: 500;
    font-style: italic;
    color: var(--accent);
    margin: 0;
}

.text-muted {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-top: 0.125rem;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   ITEMS CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */

.items-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.items-container::-webkit-scrollbar {
    width: 6px;
}

.items-container::-webkit-scrollbar-track {
    background: transparent;
}

.items-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.items-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state p {
    font-size: 0.9375rem;
}

/* ITEMS LIST */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.item-card {
    background: #FAFAFA;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    transition: all 0.2s var(--ease);
}

.item-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.item-card-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

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

.item-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.item-card-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
}

.item-card-description {
    font-size: 0.8125rem;
    color: var(--text-light);
    line-height: 1.4;
}

.item-card-actions {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
}

.item-card-actions button {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1.5px solid var(--border);
    background: white;
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.item-card-actions button:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}

.item-card-actions .btn-delete:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}

/* ALLERGENS */
.allergen-icons {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.allergen-icon {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

.supplement-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: var(--supplement-bg);
    color: var(--supplement);
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
}

/* SUBSECTION */
.subsection {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-light);
}

.subsection-header {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.subsection-title {
    font-family: 'Crimson Pro', serif;
    font-size: 0.9375rem;
    font-weight: 500;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ALLERGENS GRID */
.allergens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.allergen-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    user-select: none;
}

.allergen-checkbox:hover {
    background: var(--accent-light);
}

.allergen-checkbox.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.allergen-checkbox input {
    display: none;
}

.allergen-checkbox-icon {
    width: 18px;
    height: 18px;
}

.allergen-checkbox-label {
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(28, 25, 23, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.3s var(--ease);
}

.modal-preview {
    max-width: 420px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.375rem;
    font-weight: 500;
    font-style: italic;
    color: var(--accent);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--accent);
    color: white;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: start;
    gap: 0.875rem;
    min-width: 300px;
    max-width: 400px;
    pointer-events: auto;
    animation: toastIn 0.3s var(--ease);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
}

.toast-message {
    font-size: 0.8125rem;
    color: var(--text-light);
}

.toast-success {
    border-left: 3px solid var(--success);
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-error {
    border-left: 3px solid var(--danger);
}

.toast-error .toast-icon {
    color: var(--danger);
}

.toast-warning {
    border-left: 3px solid var(--warning);
}

.toast-warning .toast-icon {
    color: var(--warning);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PREVIEW CONTENT
   ═══════════════════════════════════════════════════════════════════════════ */

.preview-content {
    font-family: 'Poppins', sans-serif;
    color: var(--text);
}

.preview-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.preview-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.5rem;
    font-weight: 500;
    font-style: italic;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.preview-dates {
    font-size: 0.8125rem;
    color: var(--text-light);
    font-style: italic;
}

.preview-price {
    font-family: 'Crimson Pro', serif;
    font-size: 1.125rem;
    font-weight: 500;
    font-style: italic;
    color: var(--accent);
    text-align: right;
    margin-bottom: 1.5rem;
}

.preview-section {
    margin-bottom: 1.5rem;
}

.preview-section-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.125rem;
    font-weight: 500;
    font-style: italic;
    color: var(--accent);
    text-align: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.preview-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

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

.preview-item-name {
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.125rem;
}

.preview-item-description {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 968px) {
    .layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        max-height: 300px;
    }
    
    .header-left,
    .header-right {
        gap: 0.375rem;
    }
    
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    .logo-sub {
        display: none;
    }
}

@media (max-width: 640px) {
    .layout {
        padding: 1rem;
    }
    
    .header {
        padding: 0.75rem 1rem;
    }
    
    .btn span {
        display: none;
    }
}
