/**
 * Hubble Coffee / Kali — design system
 * Palette da kali.hubblecoffe.com
 */
:root {
    --hc-bg: #f5e5d5;
    --hc-bg-cream: #f5e5d5;
    --hc-surface: #ffffff;
    --hc-text: #4b3b2a;
    --hc-text-muted: #6b7280;
    --hc-primary: #93876d;
    --hc-primary-hover: #847962;
    --hc-primary-dark: #4b3b2a;
    --hc-border: #e5e7eb;
    --hc-border-soft: #e8dcc8;
    --hc-hover: #faf8f4;
    --hc-input-bg: #f3f4f6;
    --hc-input-border: #cccccc;
    --hc-input-focus-bg: #e7e3da;
    --hc-input-focus-border: #444444;
    --hc-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    --hc-shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.06);
    --hc-radius: 12px;
    --hc-radius-sm: 6px;
    --hc-sidebar-w: 16rem;
    --hc-success: #2d7d46;
    --hc-success-bg: #ecfdf5;
    --hc-warning: #b45309;
    --hc-warning-bg: #fef3c7;
    --hc-danger: #c0392b;
    --hc-font: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;

    --coffee-bg: var(--hc-bg);
    --coffee-surface: var(--hc-surface);
    --coffee-text: var(--hc-text);
    --coffee-accent: var(--hc-primary);
    --coffee-accent-dark: var(--hc-primary-hover);
    --coffee-border: var(--hc-border-soft);
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--hc-bg);
    color: var(--hc-text);
    font-family: var(--hc-font);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4, h5, h6 {
    color: var(--hc-text);
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

p {
    line-height: 1.6;
    margin-bottom: 0.9rem;
}

.text-muted {
    color: var(--hc-text-muted) !important;
    line-height: 1.45;
}

a {
    color: var(--hc-primary-dark);
}

a:hover {
    color: var(--hc-primary-hover);
}

/* ——— Shell Kali (topbar + sidebar) ——— */
.hc-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0.35rem;
    background: transparent;
}

@media (min-width: 640px) {
    .hc-topbar {
        padding: 0.65rem 1rem 0.4rem;
    }
}

.hc-topbar-start,
.hc-topbar-end {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.hc-topbar-logo {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: var(--hc-radius-sm);
    text-decoration: none;
}

.hc-topbar-logo:hover {
    background: rgba(255, 255, 255, 0.5);
}

.hc-topbar-logo img {
    height: 2rem;
    width: auto;
    display: block;
}

.hc-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    border: 1px solid var(--hc-border-soft);
    background: var(--hc-surface);
    color: var(--hc-text);
    box-shadow: var(--hc-shadow-sm);
    text-decoration: none;
    transition: background-color 0.2s;
}

.hc-icon-btn:hover {
    background: var(--hc-hover);
    color: var(--hc-text);
}

.hc-icon-btn i {
    font-size: 1.15rem;
}

.hc-shell {
    display: flex;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.hc-sidebar {
    width: var(--hc-sidebar-w);
    flex-shrink: 0;
    background: var(--hc-surface);
    border-right: 1px solid var(--hc-border-soft);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.06);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.hc-sidebar-brand {
    padding: 1rem 1.5rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    text-align: center;
}

.hc-sidebar-brand img {
    height: 2.5rem;
    width: auto;
}

.hc-sidebar-inner {
    padding: 1.25rem 1rem 1.5rem;
}

.hc-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 190;
}

.hc-nav-link,
.hc-nav-sublink,
.hc-nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--hc-radius-sm);
    background: transparent;
    color: var(--hc-text);
    font-size: 0.875rem;
    text-decoration: none;
    text-align: left;
    transition: background-color 0.15s;
}

.hc-nav-link:hover,
.hc-nav-sublink:hover,
.hc-nav-group-toggle:hover {
    background: #f3f4f6;
    color: var(--hc-text);
}

.hc-nav-link.active,
.hc-nav-sublink.active,
.hc-nav-group-toggle.active {
    background: #f3f4f6;
    font-weight: 600;
}

.hc-nav-icon {
    color: var(--hc-primary);
    font-size: 1rem;
    width: 1rem;
    flex-shrink: 0;
}

.hc-nav-group {
    margin-top: 0.15rem;
}

.hc-nav-group-toggle {
    justify-content: space-between;
}

.hc-nav-group-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hc-nav-chevron {
    font-size: 0.75rem;
    color: var(--hc-text-muted);
    transition: transform 0.2s;
}

.hc-nav-group-toggle[aria-expanded="true"] .hc-nav-chevron {
    transform: rotate(180deg);
}

.hc-nav-sub {
    padding-left: 1.25rem;
    margin-top: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.hc-nav-sublink {
    padding: 0.35rem 0.5rem;
    font-size: 0.8125rem;
}

.hc-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.hc-main-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.hc-main {
    flex: 1;
    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

@media (min-width: 640px) {
    .hc-main {
        padding-top: 0.5rem;
    }
}

.hc-footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--hc-text-muted);
    padding: 1rem;
    background: var(--hc-bg);
    border-top: none;
}

@media (max-width: 639px) {
    .hc-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
    }

    .hc-app.sidebar-open .hc-sidebar {
        transform: translateX(0);
    }

    .hc-app.sidebar-open .hc-sidebar-backdrop {
        display: block;
    }
}

@media (min-width: 640px) {
    .hc-app:not(.sidebar-open) .hc-sidebar {
        display: none;
    }
}

.dropdown-menu {
    border: 1px solid var(--hc-border-soft);
    border-radius: var(--hc-radius-sm);
    box-shadow: var(--hc-shadow-sm);
}

.dropdown-item {
    color: var(--hc-text);
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--hc-input-focus-bg);
    color: var(--hc-primary-dark);
}

main.container {
    background: transparent;
    padding-bottom: 2rem;
}

/* ——— Cards & tables ——— */
.card,
.table,
.alert {
    background-color: var(--hc-surface);
}

.card {
    border: 1px solid var(--hc-border);
    border-radius: var(--hc-radius);
    box-shadow: var(--hc-shadow-sm);
}

.card-body {
    padding: 1.15rem 1.2rem;
}

.card-header {
    background-color: #fafafa;
    border-bottom: 1px solid var(--hc-border);
    color: var(--hc-text);
    font-weight: 600;
}

.table thead th {
    background-color: #fafafa;
    color: var(--hc-text);
    border-bottom: 1px solid var(--hc-border);
    font-weight: 600;
}

.table-hover tbody tr:hover {
    background-color: #f9fafb;
}

.table > :not(caption) > * > * {
    padding: 0.75rem 0.8rem;
    vertical-align: middle;
    border-color: var(--hc-border);
}

.list-group-item {
    border-color: var(--hc-border);
    color: var(--hc-text);
}

.list-group-item-action:hover {
    background-color: var(--hc-input-focus-bg);
}

/* ——— Forms ——— */
.form-label {
    margin-bottom: 0.45rem;
    font-weight: 500;
    color: var(--hc-text);
}

.form-control,
.form-select {
    background-color: var(--hc-input-bg);
    border: 1px solid var(--hc-input-border);
    border-radius: var(--hc-radius-sm);
    color: var(--hc-text);
    padding: 0.65rem 0.75rem;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--hc-input-focus-bg);
    border-color: var(--hc-input-focus-border);
    box-shadow: 0 0 0 0.15rem rgba(147, 135, 109, 0.2);
    color: var(--hc-text);
}

.input-group-text {
    background-color: var(--hc-surface);
    border: 1px solid var(--hc-input-border);
    color: var(--hc-text-muted);
}

.form-check-input:checked {
    background-color: var(--hc-primary);
    border-color: var(--hc-primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.15rem rgba(147, 135, 109, 0.25);
}

/* ——— Buttons ——— */
.btn {
    padding: 0.5rem 0.9rem;
    line-height: 1.35;
    border-radius: var(--hc-radius-sm);
    font-weight: 600;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.btn-primary {
    background-color: var(--hc-primary);
    border-color: var(--hc-primary);
    color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--hc-primary-hover) !important;
    border-color: var(--hc-primary-hover) !important;
    color: #fff !important;
}

.btn-outline-primary {
    color: var(--hc-primary-dark);
    border-color: var(--hc-primary);
}

.btn-outline-primary:hover {
    background-color: var(--hc-primary);
    border-color: var(--hc-primary);
    color: #fff;
}

.btn-success {
    background-color: var(--hc-success);
    border-color: var(--hc-success);
}

.btn-success:hover {
    background-color: #256b38;
    border-color: #256b38;
}

.btn-secondary {
    background-color: #e5e7eb;
    border-color: #d1d5db;
    color: var(--hc-text);
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active {
    background-color: #d1d5db !important;
    border-color: #9ca3af !important;
    color: var(--hc-text) !important;
}

.btn-outline-secondary {
    color: var(--hc-text-muted);
    border-color: var(--hc-border);
    background-color: transparent;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active {
    background-color: var(--hc-hover);
    border-color: var(--hc-border);
    color: var(--hc-text);
}

.page-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.page-actions form {
    margin: 0;
}

.bulk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    justify-content: space-between;
}

.bulk-category-input {
    min-width: 220px;
}

/* ——— Pannelli riepilogo (preparazioni/ricette) ——— */
.hc-summary {
    border-radius: var(--hc-radius-sm);
    padding: 0.75rem 1rem;
}

.hc-summary-primary {
    background: #f3f4f6;
    border: 2px solid var(--hc-primary);
}

.hc-summary-primary .hc-summary-label {
    font-weight: 600;
    color: var(--hc-primary-dark);
}

.hc-summary-primary .hc-summary-value {
    color: var(--hc-primary);
    font-size: 1.1rem;
}

.hc-summary-success {
    background: var(--hc-success-bg);
    border-radius: var(--hc-radius-sm);
}

.hc-summary-success .hc-summary-value {
    color: var(--hc-success);
}

.hc-summary-warning {
    background: var(--hc-warning-bg);
    border: 2px solid #f59e0b;
    border-radius: var(--hc-radius-sm);
}

.hc-summary-warning .hc-summary-label {
    font-weight: 600;
    color: #92400e;
}

.hc-summary-warning .hc-summary-value {
    color: var(--hc-warning);
    font-size: 1.2rem;
}

.costo-ingrediente {
    background: #f3f4f6 !important;
    border: 1px solid var(--hc-border) !important;
    color: var(--hc-primary-dark) !important;
    padding: 0.5rem;
    border-radius: var(--hc-radius-sm);
    font-weight: 600;
    text-align: center;
    min-height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.costo-ingrediente.costo-positive {
    color: var(--hc-success) !important;
    background: var(--hc-success-bg) !important;
    border-color: #a7f3d0 !important;
}

/* ——— Hero & filtri ——— */
.coffee-hero {
    background: linear-gradient(135deg, var(--hc-primary) 0%, #b5a48a 100%);
    padding: 2.5rem 2rem;
    border-radius: var(--hc-radius);
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--hc-shadow-sm);
}

.coffee-hero-circle {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 280px;
    height: 280px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 50%;
}

.coffee-hero-content {
    position: relative;
    z-index: 1;
}

.coffee-hero-title {
    color: #fff;
    margin-bottom: 0.5rem;
}

.coffee-hero-subtitle {
    margin: 0;
    font-size: 1.05rem;
    opacity: 0.95;
}

.coffee-filter-box {
    background: var(--hc-surface);
    padding: 1rem;
    border-radius: var(--hc-radius-sm);
    border: 1px solid var(--hc-border);
    box-shadow: var(--hc-shadow-sm);
}

.coffee-filter-title {
    color: var(--hc-primary-dark);
    font-weight: 600;
    display: block;
    margin-bottom: 0.75rem;
}

.coffee-search-addon {
    border: 1px solid var(--hc-input-border);
    background: var(--hc-surface);
}

.coffee-price {
    color: var(--hc-success);
}

.coffee-alert-item {
    border-left: 4px solid var(--hc-danger);
}

/* Dashboard — schede alert FC / DC affiancate */
.dashboard-alert-row > [class*="col-"] {
    display: flex;
}

.dashboard-alert-card {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.dashboard-alert-card .card-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.dashboard-alert-card.is-expanded {
    height: auto;
}

.dashboard-alert-body--paired {
    min-height: 17.5rem;
}

.dashboard-alert-list {
    flex: 1 1 auto;
}

.dashboard-alert-toggle {
    align-self: flex-start;
    padding-left: 0;
    text-decoration: none;
}

.dashboard-alert-toggle:hover {
    text-decoration: underline;
}

.coffee-empty-state {
    text-align: center;
    padding: 2rem;
}

.coffee-empty-icon {
    font-size: 2.4rem;
    color: var(--hc-primary);
    margin-bottom: 1rem;
    display: block;
}

.coffee-ok-icon {
    font-size: 3rem;
    color: var(--hc-success);
    margin-bottom: 1rem;
    display: block;
}

.coffee-empty-panel {
    background: linear-gradient(135deg, #f5efe8 0%, #ebe3d6 100%);
    padding: 2rem;
    border-radius: var(--hc-radius);
    border-left: 4px solid var(--hc-primary);
}

.coffee-empty-title {
    color: var(--hc-primary-dark);
    margin-bottom: 0.5rem;
}

.coffee-accent-text {
    color: var(--hc-primary);
}

.coffee-warm-text {
    color: #b5a48a;
}

.coffee-muted-strong {
    color: var(--hc-primary-dark);
    font-size: 1rem;
}

.coffee-left-border {
    border-left: 4px solid var(--hc-primary);
}

.stat-card .card-body h2 {
    color: var(--hc-primary-dark);
}

.stat-card .card-body h6 {
    color: var(--hc-text-muted);
}

/* ——— Alert bootstrap ——— */
.alert {
    border-radius: var(--hc-radius-sm);
    border-width: 1px;
}

/* ——— Select2 (preparazioni/ricette) ——— */
.select2-container--bootstrap-5 .select2-selection {
    background-color: var(--hc-input-bg);
    border-color: var(--hc-input-border);
    border-radius: var(--hc-radius-sm);
    min-height: 2.1rem;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    background-color: var(--hc-input-focus-bg);
    border-color: var(--hc-input-focus-border);
    box-shadow: 0 0 0 0.15rem rgba(147, 135, 109, 0.2);
}

@media (max-width: 768px) {
    body {
        font-size: 16px;
        line-height: 1.65;
    }

    h1, h2, h3 {
        line-height: 1.35;
        margin-bottom: 0.85rem;
    }

    .hc-main {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .card-body {
        padding: 1rem;
    }

    .table > :not(caption) > * > * {
        padding: 0.7rem 0.6rem;
    }

    .btn {
        padding: 0.55rem 0.9rem;
    }
}
