@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

:root {
    /* Brand Colors - Organic Auditor */
    --color-primary: #006D31;
    --color-primary-container: #16c05e;
    --color-on-primary: #ffffff;
    --color-on-primary-container-text: #054c24;
    
    --color-secondary: #53606c;
    --color-on-secondary: #ffffff;
    
    --color-tertiary: #7b5800; /* Crust / Warning */
    --color-tertiary-container: #ffdf9e;
    --color-on-tertiary-container: #422d00;
    
    --color-danger: #ea3323;
    
    /* Surface Colors (Tonal Layering) */
    --color-surface: #f7f9fb; /* App background */
    --color-surface-container-low: #f2f4f6; /* Off-white containers, row headers */
    --color-surface-container-lowest: #ffffff; /* Pure white content cards */
    --color-surface-bright: #f7f9fb; /* Modals */
    
    --color-on-surface: #191c1e; /* Pure black is forbidden, this is deep slate */
    --color-on-surface-variant: #64748b; /* Lighter text for metadata (slate) */
    
    /* Typography */
    --font-display: 'Plus Jakarta Sans', Arial, sans-serif;
    --font-data: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Elevation / Shadows (Replacing borders) */
    --shadow-soft: 0 12px 32px rgba(25, 28, 30, 0.06); /* Ambient shadow */
    --shadow-float: 0 18px 48px rgba(0, 109, 49, 0.15); /* Primary button float shadow */
    --border-ghost: 1px solid rgba(188, 203, 186, 0.15); 
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 1.5rem; /* Large inputs */
    --radius-pill: 9999px; /* Pill chips and action buttons */
}

/* Base Body & Reset */
body, html {
    margin: 0; padding: 0; width: 100%; height: 100%;
    background-color: var(--color-surface);
}

.bsm-app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    font-family: var(--font-data);
    background: var(--color-surface);
    overflow: hidden;
    color: var(--color-on-surface);
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

/* Sidebar Styling - No rigid border, soft background */
.bsm-sidebar {
    width: 270px;
    background-color: var(--color-surface-container-lowest);
    border-right: var(--border-ghost);
    padding: 2.5rem 0;
    z-index: 10;
    /* Soft elevation on right side */
    box-shadow: 4px 0 24px rgba(25, 28, 30, 0.03); 
    display: flex;
    flex-direction: column;
}

.bsm-sidebar h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    padding: 0 2rem;
    margin-top: 0;
    margin-bottom: 2.5rem;
    color: var(--color-on-surface);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.bsm-sidebar h2 span {
    color: var(--color-primary);
}

.bsm-nav-list {
    list-style: none;
    padding: 0 1rem;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}

/* Custom scrollbar for nav list so it looks clean */
.bsm-nav-list::-webkit-scrollbar {
    width: 6px;
}
.bsm-nav-list::-webkit-scrollbar-thumb {
    background: var(--color-surface-container-high);
    border-radius: 4px;
}

.bsm-nav-list li {
    padding: 1rem 1.2rem;
    cursor: pointer;
    color: var(--color-on-surface-variant);
    transition: all 0.25s ease;
    font-weight: 500;
    font-size: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.bsm-nav-list li:hover {
    background-color: var(--color-surface-container-low);
    color: var(--color-on-surface);
}

.bsm-nav-list li.active {
    background-color: #e6f7ec; /* Highly diluted primary */
    color: #034b23; /* Deep dark primary */
    font-weight: 600;
}

/* Main Content Area */
.bsm-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* CRITICAL for flex item to not stretch uncontrollably */
}

/* Header Area (Glassmorphism if scrolling) */
.bsm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem;
    background-color: rgba(247, 249, 251, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: var(--border-ghost);
    z-index: 5;
    position: sticky;
    top: 0;
}

.bsm-header h1 {
    font-family: var(--font-display);
    margin: 0;
    font-size: 1.8rem;
    color: var(--color-on-surface);
    font-weight: 700;
    letter-spacing: -0.03em;
}

/* Main View Container */
#bsm-view-container {
    padding: 2.5rem 3rem;
    flex: 1;
    background-color: var(--color-surface);
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0; /* CRITICAL for inline tables to trigger their own auto-scroll */
}

/* Cards (Tonal shifts instead of borders) */
.bsm-card {
    background: var(--color-surface-container-lowest);
    border: none;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-soft);
}

.bsm-card h3, .bsm-card h2 {
    font-family: var(--font-display);
    color: var(--color-on-surface);
    letter-spacing: -0.02em;
}

/* Tables (Editorial feel, no harsh vertical borders, huge padding) */
.bsm-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    font-size: 0.95rem;
}

.bsm-table th {
    text-align: left;
    padding: 1.2rem 1rem;
    background-color: var(--color-surface-container-low); /* Background color shift for header */
    color: var(--color-on-surface-variant);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: none; /* No 1px solid lines */
}

.bsm-table th:first-child { border-top-left-radius: var(--radius-md); border-bottom-left-radius: var(--radius-md); }
.bsm-table th:last-child { border-top-right-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }

.bsm-table td {
    padding: 1.5rem 1rem;
    background-color: var(--color-surface-container-lowest);
    color: var(--color-on-surface);
    border-bottom: 1px solid rgba(188, 203, 186, 0.15); /* 15% opacity ghost line */
}

/* Remove border on last row */
.bsm-table tr:last-child td {
    border-bottom: none;
}

/* Buttons */
.bsm-btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-container) 100%);
    color: var(--color-on-primary);
    border: none;
    padding: 0.75rem 1.7rem;
    border-radius: var(--radius-pill); /* xl rounded */
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--shadow-float);
}

.bsm-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 50px rgba(0, 109, 49, 0.25);
}

.bsm-btn-primary:disabled {
    background: var(--color-secondary);
    box-shadow: none;
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.bsm-btn-secondary {
    background-color: transparent;
    color: var(--color-primary);
    border: 1px solid rgba(0, 109, 49, 0.2);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.bsm-btn-secondary:hover {
    background-color: rgba(0, 109, 49, 0.05);
}

.bsm-btn-danger {
    background-color: transparent;
    color: var(--color-danger);
    border: 1px solid rgba(234, 51, 35, 0.2);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.bsm-btn-danger:hover {
    background-color: rgba(234, 51, 35, 0.05);
}

/* Modals */
.bsm-modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(25, 28, 30, 0.5); /* darkened tone */
    backdrop-filter: blur(8px); /* glassmorphism depth */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.bsm-modal-content {
    background: var(--color-surface-bright);
    padding: 3rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.15); /* heavy ambient shadow for modal */
    border: none;
    box-sizing: border-box; /* Prevent padding from blowing up width */
}

.bsm-modal-wide {
    max-width: 850px !important;
    width: 90% !important;
    min-width: 0 !important;
}

.bsm-modal-content h3 {
    margin-top: 0;
    margin-bottom: 2.5rem;
    color: var(--color-on-surface);
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Form Inputs */
.bsm-form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.bsm-form-group label {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-secondary);
}

.bsm-input, .bsm-select, .bsm-form-group input, .bsm-form-group textarea, .bsm-form-group select {
    padding: 1rem 1.2rem;
    border: 1px solid transparent; 
    background-color: var(--color-surface-container-low); /* Recessed feel */
    border-radius: var(--radius-xl); /* XL Rounded */
    font-family: var(--font-data);
    font-size: 1rem;
    color: var(--color-on-surface);
    transition: all 0.2s ease;
}

.bsm-input:focus, .bsm-select:focus, .bsm-form-group input:focus, .bsm-form-group textarea:focus, .bsm-form-group select:focus {
    outline: none;
    border: 1px solid rgba(0, 109, 49, 0.2); /* Ghost border focus */
    background-color: var(--color-surface-container-lowest);
    box-shadow: 0 0 0 4px rgba(0, 109, 49, 0.05); /* Subtle 4px glow */
}

/* Modal specific actions layout */
.bsm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2.5rem;
}

/* Status Chips / Badges */
.bsm-status-db, .bsm-chip {
    background-color: var(--color-surface-container-low);
    color: var(--color-on-surface);
    padding: 0.4rem 1.2rem;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
    border: none;
}
.bsm-chip-success, .bsm-status-db {
    background-color: #dcfce7;
    color: #166534;
}
.bsm-chip-warning {
    background-color: var(--color-tertiary-container);
    color: var(--color-on-tertiary-container);
}

/* Premium Filter Tabs */
.bsm-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.bsm-filter-tabs {
    display: flex;
    background: #f8fafc;
    border-radius: var(--radius-md);
    padding: 6px;
    gap: 8px;
}
.bsm-filter-tab {
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.bsm-filter-tab:hover {
    background: #f1f5f9;
}
.bsm-filter-tab.active {
    background: #ffffff;
    color: var(--color-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Custom Check Tags */
.bsm-tag-knospe {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #dcfce7;
    color: #166534;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
}
.bsm-tag-umstellung {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fef3c7;
    color: #92400e;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
}
.bsm-tag-konventionell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3f4f6;
    color: #4b5563;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 600;
}

/* Recipe Detail Layout */
.bsm-recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}
.bsm-recipe-header h1 {
    font-family: var(--font-display);
    font-size: 2.2rem;
    margin: 0 0 0.5rem 0;
    color: var(--color-on-surface);
    font-weight: 800;
    letter-spacing: -0.03em;
}
.bsm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}
.bsm-kpi-card {
    background: var(--color-surface-container-lowest);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}
.bsm-kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
