/* KitchenStock – Mobile-first UI */

/* Reset / Base */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #0f172a;
    background: #f5f5f7;
}

body {
    min-height: 100vh;
}

.app-background {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at top left, rgba(248, 250, 252, 0.6), transparent 60%),
        radial-gradient(circle at bottom right, rgba(248, 250, 252, 0.7), transparent 55%),
        linear-gradient(135deg, #fef3c7 0%, #f5f5f7 40%, #e0f2fe 100%);
    background-attachment: fixed;
    opacity: 0.95;
}

/* kleine farbige Dreiecke */
.app-background::before,
.app-background::after {
    content: "";
    position: absolute;
    border-style: solid;
    opacity: 0.18;
}
.app-background::before {
    border-width: 0 120px 120px 0;
    border-color: transparent #f97316 transparent transparent;
    top: 10%;
    right: 8%;
}
.app-background::after {
    border-width: 120px 0 0 120px;
    border-color: transparent transparent transparent #0ea5e9;
    bottom: 8%;
    left: 4%;
    opacity: 0.2;
}

.app-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px 32px;
}

/* Topbar */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 8px 10px;
    gap: 8px;
}

.topbar-left,
.topbar-center,
.topbar-right {
    display: flex;
    align-items: center;
}

.topbar-center {
    justify-content: center;
    flex: 1;
}

.topbar-right {
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
}

.brand-logo-fallback {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: linear-gradient(135deg, #0f766e, #22c55e);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: #64748b;
}

.dept-switch-form {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.85);
    padding: 6px 10px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.dept-switch-form label {
    font-size: 0.8rem;
    color: #475569;
}

.dept-switch-form select {
    border: none;
    background: transparent;
    font-size: 0.8rem;
    padding: 4px;
}

.user-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.8rem;
}

.user-name {
    font-weight: 600;
    color: #0f172a;
}

.user-role {
    color: #64748b;
    font-size: 0.7rem;
}

/* Nav */

.main-nav {
    display: flex;
    gap: 6px;
    padding: 0 4px 10px;
    overflow-x: auto;
}

.nav-link {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    text-decoration: none;
    color: #0f172a;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid transparent;
    white-space: nowrap;
}

.nav-link.active {
    background: linear-gradient(135deg, #0f766e, #22c55e);
    color: white;
    border-color: transparent;
    box-shadow: 0 3px 10px rgba(15, 118, 110, 0.35);
}

/* Main */

.app-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Cards */

.card {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px;
    padding: 14px 14px 16px;
    box-shadow:
        0 10px 30px rgba(15, 23, 42, 0.16),
        0 0 0 1px rgba(148, 163, 184, 0.3);
    backdrop-filter: blur(8px);
}

.card-title {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.card-header-meta {
    display: flex;
    gap: 6px;
}

/* Footer */

.app-footer {
    margin-top: 18px;
    font-size: 0.75rem;
    color: #64748b;
    display: flex;
    justify-content: space-between;
    padding: 0 8px;
}

.app-footer-right {
    opacity: 0.8;
}

/* Text / Helper */

.hint {
    margin: 4px 0 8px;
    font-size: 0.8rem;
    color: #64748b;
}

.hint-inline {
    font-size: 0.8rem;
    color: #64748b;
}

.hint.tiny {
    font-size: 0.7rem;
}

.message {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    margin: 6px 0;
}

.message.success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.message.error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Pills / Chips */

.pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    border: 1px solid rgba(148, 163, 184, 0.6);
    color: #475569;
    background: rgba(248, 250, 252, 0.85);
}

.pill-soft {
    background: rgba(129, 230, 217, 0.4);
    border-color: rgba(45, 212, 191, 0.7);
    color: #115e59;
}

/* Buttons */

button,
input,
select,
textarea {
    font-family: inherit;
}

.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 7px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #0f766e, #22c55e);
    color: #fff;
    box-shadow: 0 3px 10px rgba(15, 118, 110, 0.35);
}

.btn-secondary {
    background: rgba(15, 23, 42, 0.05);
    color: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.7);
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.7);
    color: #0f172a;
}

.btn-danger {
    background: #b91c1c;
    color: #fff;
}

.btn-sm {
    font-size: 0.78rem;
    padding: 5px 9px;
}

.btn-block {
    width: 100%;
}

.btn-block-sm {
    width: 100%;
}

/* Forms */

label {
    font-size: 0.8rem;
    color: #475569;
    display: block;
    margin-bottom: 4px;
}

label input,
label select,
label textarea {
    margin-top: 2px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.8);
    padding: 6px 10px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.9);
}

textarea {
    border-radius: 10px;
    resize: vertical;
    min-height: 60px;
}

/* Tables */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 8px;
}

.table-tight {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.table-tight th,
.table-tight td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.4);
    text-align: left;
    vertical-align: middle;
    background: rgba(255, 255, 255, 0.9);
}

.table-tight th {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table-tight tbody tr:nth-child(even) td {
    background: rgba(248, 250, 252, 0.95);
}

/* Filter / Toolbar */

.filter-form {
    margin-bottom: 8px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
    align-items: flex-end;
}

.filter-label {
    font-size: 0.78rem;
    margin-bottom: 2px;
    color: #475569;
}

.filter-actions {
    display: flex;
    align-items: flex-end;
}

.toolbar {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
    align-items: center;
}

.inline-label {
    font-size: 0.8rem;
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
}

/* Tabs */

.tabs {
    display: flex;
    gap: 6px;
    margin: 4px 0 8px;
    overflow-x: auto;
}

.tab {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    text-decoration: none;
    color: #0f172a;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid transparent;
    white-space: nowrap;
}

.tab.active {
    background: #0f766e;
    color: #fff;
    box-shadow: 0 3px 10px rgba(15, 118, 110, 0.4);
}

/* Grid */

.grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

@media (min-width: 768px) {
    .grid-2 {
        grid-template-columns: 1.1fr 1.1fr;
    }
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

@media (min-width: 900px) {
    .settings-grid {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr);
    }
}

/* Edit Toggle Products */

.edit-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

/* Chips */

.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    font-size: 0.72rem;
    margin: 2px;
    background: rgba(248, 250, 252, 0.9);
    cursor: pointer;
}

.chip input {
    margin-right: 4px;
}

.chip-toggle {
    background: #e0f2fe;
    border-color: #7dd3fc;
}

.dept-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

/* Safety row */

.safety-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.safety-input {
    max-width: 60px;
}

/* Forms / actions */

.form-actions-split {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
    align-items: center;
}

.form-actions-right {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.inline-form {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.inline-form input[type="password"] {
    max-width: 140px;
}

/* Logo preview */

.logo-preview {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
}

.logo-preview-img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.25);
}

/* Export bar */

.export-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Supplier block */

.supplier-block + .supplier-block {
    margin-top: 10px;
}

.supplier-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 4px 0;
}

/* Modal */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
}

.modal.open {
    display: flex;
}

.modal-dialog {
    background: #f9fafb;
    border-radius: 18px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.45),
        0 0 0 1px rgba(148, 163, 184, 0.5);
    overflow: hidden;
}

.modal-header {
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.4);
}

.modal-body {
    padding: 10px 14px 14px;
    overflow: auto;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.max-h-60 {
    max-height: 60vh;
}

/* Login */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 18px;
    padding: 20px 16px 18px;
    width: min(360px, 100% - 24px);
    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.45),
        0 0 0 1px rgba(148, 163, 184, 0.5);
}

.login-title {
    margin: 0 0 4px;
    font-weight: 700;
    font-size: 1.1rem;
    text-align: center;
}

.login-subtitle {
    margin: 0 0 10px;
    font-size: 0.8rem;
    color: #64748b;
    text-align: center;
}

.form-vertical label {
    margin-bottom: 6px;
}

/* Misc */

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 16px;
}

/* Small screens tweaks */
@media (max-width: 600px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .topbar-center {
        width: 100%;
        justify-content: flex-start;
    }
    .topbar-right {
        align-self: stretch;
        justify-content: space-between;
    }
}
