/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f2f2f7; color: #1c1c1e; line-height: 1.5; min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== Login ===== */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 1.5rem;
    background: linear-gradient(135deg, #1a1a2e, #0f3460);
}
.login-card {
    background: #fff; border-radius: 20px; padding: 2rem;
    width: 100%; max-width: 380px; box-shadow: 0 16px 48px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; font-size: 1.4rem; font-weight: 700; color: #0f3460; margin-bottom: 0.25rem; }
.login-card h1 { text-align: center; font-size: 1rem; font-weight: 400; color: #8e8e93; margin-bottom: 1.5rem; }

/* ===== Forms ===== */
.form-group { margin-bottom: 0.75rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: #8e8e93; margin-bottom: 0.2rem; }
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], textarea, select {
    width: 100%; padding: 0.7rem 0.75rem; border: 1px solid #d1d1d6;
    border-radius: 10px; font-size: 1rem; font-family: inherit;
    background: #fff; color: #1c1c1e; transition: border-color 0.15s;
    -webkit-appearance: none;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: #007aff; box-shadow: 0 0 0 3px rgba(0,122,255,0.12);
}
textarea { resize: vertical; min-height: 70px; line-height: 1.4; }
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6' fill='%238e8e93'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
    padding: 0.65rem 1.1rem; border: none; border-radius: 10px;
    font-size: 0.9rem; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all 0.15s; text-decoration: none;
    -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.btn:active { transform: scale(0.96); opacity: 0.85; }
.btn-primary { background: #007aff; color: #fff; }
.btn-success { background: #34c759; color: #fff; }
.btn-danger { background: #ff3b30; color: #fff; }
.btn-secondary { background: #e5e5ea; color: #1c1c1e; }
.btn-ghost { background: none; color: #007aff; padding: 0.5rem 0.6rem; font-size: 0.85rem; }
.btn-outline { background: none; color: #007aff; border: 1.5px solid #007aff; }
.btn-full { width: 100%; }
.btn-sm { padding: 0.45rem 0.7rem; font-size: 0.8rem; }

/* ===== Alerts ===== */
.alert { padding: 0.65rem 0.9rem; border-radius: 10px; font-size: 0.85rem; margin-bottom: 0.75rem; }
.alert-error { background: #fff2f2; color: #ff3b30; }
.alert-success { background: #f0faf3; color: #248a3d; }

/* ===== App Header ===== */
.app-header {
    background: #fff; border-bottom: 1px solid #d1d1d6;
    padding: 0.6rem 0.75rem; position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
}
.app-header .brand { font-weight: 700; font-size: 1rem; color: #0f3460; }
.app-header nav { display: flex; gap: 0.25rem; }
.app-main { max-width: 600px; margin: 0 auto; padding: 0.75rem; }

/* ===== Week Bar ===== */
.week-bar {
    display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.75rem;
}
.week-bar select { flex: 1; font-weight: 600; text-align: center; }
.week-arrow {
    width: 44px; height: 44px; border: none; border-radius: 10px;
    background: #e5e5ea; font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    -webkit-tap-highlight-color: transparent; font-family: inherit;
}
.week-arrow:active { background: #d1d1d6; }

/* ===== Tabs ===== */
.tabs {
    display: flex; background: #e5e5ea; border-radius: 10px;
    padding: 2px; margin-bottom: 0.75rem;
}
.tab {
    flex: 1; padding: 0.55rem; text-align: center; border-radius: 8px;
    font-size: 0.9rem; font-weight: 600; cursor: pointer; border: none;
    background: transparent; color: #8e8e93; font-family: inherit;
    transition: all 0.15s;
}
.tab.active { background: #fff; color: #1c1c1e; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Cards ===== */
.card {
    background: #fff; border-radius: 14px; padding: 1rem;
    margin-bottom: 0.75rem; border: 1px solid #e5e5ea;
}
.card-title {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: #8e8e93; margin-bottom: 0.6rem;
}

/* ===== Day Cards ===== */
.day-card {
    background: #fff; border-radius: 14px; padding: 0.75rem;
    margin-bottom: 0.5rem; border: 1.5px solid #e5e5ea;
    transition: border-color 0.15s;
}
.day-card:focus-within { border-color: #007aff; }
.day-card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.4rem;
}
.day-card-header h3 { font-size: 0.95rem; font-weight: 700; color: #1c1c1e; }
.day-card textarea {
    border: none; padding: 0.3rem 0; min-height: 60px; font-size: 0.9rem;
    width: 100%; background: transparent;
}
.day-card textarea:focus { box-shadow: none; outline: none; }
.day-card input[type="text"] { border: none; padding: 0.3rem 0; font-size: 0.9rem; }
.day-card input[type="text"]:focus { box-shadow: none; }
.pasta-card textarea, .pasta-card input { min-height: auto; }

/* Closed day */
.day-card.day-closed { border-color: #ff3b30; background: #fff5f5; }
.day-card.day-closed .day-card-header h3 { text-decoration: line-through; color: #ff3b30; }

.closed-label {
    display: flex; align-items: center; gap: 0.3rem;
    font-size: 0.75rem; color: #8e8e93; cursor: pointer; user-select: none;
}
.closed-label input { margin: 0; accent-color: #ff3b30; width: 16px; height: 16px; }
.closed-label span { font-weight: 500; }

/* ===== Suggestions ===== */
.suggestions-wrap { position: relative; margin-top: 0.3rem; }
.suggestion-input {
    width: 100%; padding: 0.45rem 0.6rem; border: 1px dashed #d1d1d6;
    border-radius: 8px; font-size: 0.8rem; background: #fafafa; color: #8e8e93;
}
.suggestion-input:focus { border-style: solid; border-color: #007aff; background: #fff; color: #1c1c1e; }
.suggestion-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
    background: #fff; border: 1px solid #d1d1d6; border-radius: 10px;
    max-height: 180px; overflow-y: auto; display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.suggestion-dropdown.visible { display: block; }
.suggestion-item {
    padding: 0.55rem 0.7rem; cursor: pointer; font-size: 0.85rem;
    border-bottom: 1px solid #f2f2f7; display: flex; justify-content: space-between; align-items: center;
}
.suggestion-item:active { background: #f0f5ff; }
.suggestion-item:last-child { border-bottom: none; }
.suggestion-count { font-size: 0.7rem; color: #8e8e93; background: #f2f2f7; padding: 0.1rem 0.35rem; border-radius: 4px; flex-shrink: 0; margin-left: 0.5rem; }

/* ===== Closed toggles (send tab) ===== */
.closed-toggles { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.closed-toggle {
    display: flex; align-items: center; gap: 0.25rem;
    padding: 0.4rem 0.65rem; border-radius: 8px;
    background: #e8faf0; font-size: 0.8rem; font-weight: 600;
    cursor: pointer; user-select: none; transition: all 0.15s;
}
.closed-toggle:has(input:checked) { background: #fff2f2; color: #ff3b30; text-decoration: line-through; }
.closed-toggle input { margin: 0; accent-color: #ff3b30; width: 14px; height: 14px; }

/* ===== Background picker ===== */
.bg-picker { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.bg-thumb {
    width: 56px; height: 78px; border-radius: 8px;
    background-size: cover; background-position: center;
    border: 2.5px solid transparent; cursor: pointer;
    transition: all 0.15s; box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.bg-thumb:active { transform: scale(0.95); }
.bg-thumb.active { border-color: #007aff; }
.pdf-actions { display: flex; gap: 0.4rem; }

/* ===== Email ===== */
.email-list { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.4rem; }
.email-chip {
    display: inline-flex; align-items: center; gap: 0.2rem;
    background: #e5e5ea; padding: 0.25rem 0.5rem; border-radius: 8px; font-size: 0.8rem;
}
.email-chip button {
    background: none; border: none; cursor: pointer; color: #8e8e93;
    font-size: 1rem; line-height: 1; padding: 0 0.1rem;
}
.email-chip button:active { color: #ff3b30; }
.email-add-row { display: flex; gap: 0.3rem; }
.email-add-row input { flex: 1; }
.email-add-row .btn { min-width: 44px; font-size: 1.2rem; padding: 0.5rem; }

/* ===== Preview ===== */
.send-preview {
    background: #f2f2f7; border-radius: 10px; padding: 0.75rem;
    font-size: 0.85rem; line-height: 1.5; max-height: 300px; overflow-y: auto;
}
.send-preview .day-name { font-weight: 700; color: #0f3460; margin-top: 0.5rem; }
.send-preview .day-name:first-child { margin-top: 0; }

/* ===== Status bar ===== */
.status-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    padding: 0.7rem 1rem; text-align: center;
    font-size: 0.85rem; font-weight: 600;
    transform: translateY(100%); transition: transform 0.25s; z-index: 200;
}
.status-bar.visible { transform: translateY(0); }
.status-bar.success { background: #34c759; color: #fff; }
.status-bar.error { background: #ff3b30; color: #fff; }
.status-bar.saving { background: #007aff; color: #fff; }

/* ===== Action bar ===== */
.action-bar {
    display: flex; gap: 0.5rem; padding: 0.75rem 0;
    position: sticky; bottom: 0; background: #f2f2f7; z-index: 50;
}
.action-bar .btn { flex: 1; padding: 0.75rem; font-size: 0.95rem; }

/* ===== Spinner ===== */
.spinner {
    display: inline-block; width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff; border-radius: 50%;
    animation: spin 0.5s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Public pages ===== */
.public-page {
    background: linear-gradient(135deg, #1a1a2e, #0f3460);
    min-height: 100vh; padding: 1rem;
}
.menu-public-card {
    max-width: 600px; margin: 0 auto; background: rgba(255,255,255,0.97);
    border-radius: 20px; overflow: hidden; box-shadow: 0 16px 48px rgba(0,0,0,0.3);
}
.menu-public-header {
    background: linear-gradient(135deg, #0f3460, #1a1a2e);
    padding: 1.75rem 1.25rem; text-align: center; color: #fff;
}
.menu-public-header h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.2rem; }
.menu-public-header .week-label { font-size: 0.85rem; opacity: 0.7; }
.menu-public-body { padding: 1rem; }
.menu-day { padding: 0.75rem 0; border-bottom: 1px solid #f0f0f2; }
.menu-day:last-child { border-bottom: none; }
.menu-day-name {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: #8e8e93; margin-bottom: 0.2rem;
}
.menu-day-today .menu-day-name { color: #007aff; }
.menu-day-today { background: #f0f5ff; margin: 0 -1rem; padding: 0.75rem 1rem; border-radius: 10px; }
.menu-day-dishes { font-size: 0.95rem; line-height: 1.5; }
.menu-day-dishes .dish { margin-bottom: 0.15rem; }
.menu-day-closed { color: #8e8e93; font-style: italic; }
.menu-pasta { margin-top: 0.5rem; padding: 0.75rem; background: #faf5ef; border-radius: 10px; }
.menu-pasta-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #b08330; margin-bottom: 0.15rem; }
.menu-section { margin-top: 0.5rem; padding: 0.75rem; background: #f2f2f7; border-radius: 10px; }
.menu-section-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #8e8e93; margin-bottom: 0.15rem; }
.menu-public-footer { padding: 1rem; border-top: 1px solid #e5e5ea; text-align: center; font-size: 0.8rem; color: #8e8e93; }
.menu-public-footer .price { font-size: 1.2rem; font-weight: 700; color: #1c1c1e; margin-bottom: 0.15rem; }
.dagens-hero { text-align: center; padding: 1.5rem 1rem; }
.dagens-hero .day-name { font-size: 0.9rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #007aff; margin-bottom: 0.4rem; }
.dagens-hero .dish-text { font-size: 1.3rem; font-weight: 600; line-height: 1.4; }
.dagens-hero .pasta-text { margin-top: 0.75rem; font-size: 0.95rem; color: #8e8e93; }

/* ===== Mobile tweaks ===== */
@media (max-width: 480px) {
    .app-main { padding: 0.5rem; }
    .day-card { padding: 0.6rem; }
    .day-card textarea { min-height: 55px; font-size: 0.85rem; }
    .bg-thumb { width: 48px; height: 68px; }
    .app-header .brand { font-size: 0.9rem; }
}
