/* ====================== SHARED DESIGN SYSTEM ====================== */
:root {
    --green-1: #498d4a;
    --green-2: #b7d35f;
    --green-3: #cad879;
    --green-4: #397739;
    --brown-1: #6c511e;
    --brown-2: #6b432f;
    --brown-3: #462d1e;
    --brown-4: #a07940;
    --bg: #f5f2eb;
    --text: #2c2c2c;
    --text-mid: #555;
    --text-light: #666;
    --gold: #f0a500;
    --danger: #c0392b;
    --radius-pill: 60px;
    --radius-card: 16px;
    --radius-input: 14px;
    --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 2px 8px rgba(0,0,0,0.03);
    --shadow-card-hover: 0 1px 3px rgba(0,0,0,0.06), 0 4px 14px rgba(0,0,0,0.05);
    --focus-ring: 0 0 0 4px rgba(73, 141, 74, 0.18);
}

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

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Baloo 2", "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Once webfont is loaded the browser naturally prefers Baloo 2 */
body { font-family: "Baloo 2", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

h1, h2, h3, h4 { letter-spacing: -0.01em; }

/* ====================== ACCESSIBILITY ====================== */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--green-1);
    outline-offset: 2px;
    border-radius: 6px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: none;
    border-color: var(--green-1) !important;
    box-shadow: var(--focus-ring) !important;
}
button:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ====================== ADMIN LANG TOGGLE (INLINE) ====================== */
.admin-lang-toggle {
    display: inline-flex;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 50px;
    padding: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    flex-shrink: 0;
}
.admin-lang-toggle button {
    font-family: inherit; font-size: 0.75rem; font-weight: 700;
    padding: 0 0.75rem; border: none; background: none;
    border-radius: 50px; cursor: pointer; color: var(--text-light);
    min-width: 40px; min-height: 40px;
    transition: background-color 0.15s, color 0.15s;
    letter-spacing: 0.02em;
}
.admin-lang-toggle button.active {
    background: var(--green-4); color: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ====================== BOTTOM TAB BAR ====================== */
.tab-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: rgba(255,255,255,0.88);
    backdrop-filter: saturate(1.5) blur(12px);
    -webkit-backdrop-filter: saturate(1.5) blur(12px);
    border-top: 1px solid rgba(0,0,0,0.06);
    display: flex; justify-content: space-around; align-items: center;
    padding: 0.35rem 0; padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
    z-index: 100;
    box-shadow: 0 -1px 0 rgba(0,0,0,0.02), 0 -2px 10px rgba(0,0,0,0.04);
}
@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
    .tab-bar { background: #fff; }
}
.tab {
    position: relative;
    display: flex; flex-direction: column; align-items: center;
    gap: 0.15rem; font-size: 0.68rem; font-weight: 700;
    color: var(--text-light); text-decoration: none;
    padding: 0.45rem 0.6rem 0.35rem; min-height: 48px; justify-content: center;
    border-radius: 10px; transition: color 0.15s;
    letter-spacing: 0.01em;
    flex: 1; max-width: 90px;
}
.tab.active { color: var(--green-4); }
.tab.active::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 3px;
    border-radius: 2px;
    background: var(--green-4);
}
.tab svg {
    width: 22px; height: 22px; stroke: currentColor;
    fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ====================== ADMIN LAYOUT ====================== */
.admin-body {
    min-height: 100vh;
    padding: 1.25rem 1.25rem 5.75rem;
}
.admin-container {
    max-width: 480px;
    margin: 0 auto;
}
.admin-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 0.5rem;
}
.admin-header-left {
    display: flex; align-items: center; gap: 0.6rem;
    min-width: 0; flex: 1;
}
.admin-header-right {
    display: flex; align-items: center; gap: 8px;
    flex-shrink: 0;
}
.admin-logo { width: 32px; height: auto; flex-shrink: 0; }
.admin-header h1 {
    font-size: 1.25rem; font-weight: 800; color: var(--green-4);
    letter-spacing: -0.015em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-logout {
    color: var(--text-light); text-decoration: none;
    min-height: 40px; padding: 0 0.75rem; display: inline-flex;
    align-items: center; justify-content: center; gap: 0.4rem;
    border-radius: 10px; transition: background-color 0.15s;
    font-family: inherit; font-size: 0.85rem; font-weight: 700;
    background: #fff; border: 1px solid rgba(0,0,0,0.06);
    cursor: pointer;
}
.admin-logout:hover, .admin-logout:active { background: rgba(0,0,0,0.04); }
.admin-logout svg {
    width: 18px; height: 18px; stroke: currentColor;
    fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    flex-shrink: 0;
}
.admin-logout .logout-label { display: inline; }
@media (max-width: 359px) {
    .admin-logout { padding: 0; min-width: 40px; }
    .admin-logout .logout-label { display: none; }
}

/* ====================== BACK LINK ====================== */
.back-link {
    display: inline-flex; align-items: center; gap: 0.25rem;
    min-height: 40px; min-width: 40px; padding: 0 0.4rem;
    color: var(--text-mid); text-decoration: none;
    font-size: 0.9rem; font-weight: 600;
    border-radius: 10px; transition: background-color 0.15s;
    margin-right: 0.25rem;
}
.back-link:hover, .back-link:active { background: rgba(0,0,0,0.04); }
.back-link svg {
    width: 20px; height: 20px; stroke: currentColor;
    fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ====================== TOAST ====================== */
.toast {
    position: fixed; top: 72px; right: 16px;
    z-index: 300; max-width: calc(100vw - 32px);
    padding: 0.75rem 1rem;
    border-radius: 12px; font-weight: 700;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    animation: toastIn 0.2s ease-out;
}
.toast-success { background: #e8f5e9; color: #2e7d32; }
.toast-error { background: #fdf0ef; color: var(--danger); }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ====================== TRASH CAN ICON BUTTON ====================== */
.icon-btn-trash {
    width: 44px; height: 44px; border: none; background: none;
    color: var(--text-light); cursor: pointer; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-family: inherit; padding: 0;
    transition: background-color 0.15s, color 0.15s;
}
.icon-btn-trash:hover, .icon-btn-trash:active {
    background: #fdf0ef; color: var(--danger);
}
.icon-btn-trash svg {
    width: 20px; height: 20px; stroke: currentColor;
    fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ====================== DANGER OUTLINED BUTTON ====================== */
.action-btn.danger-outline,
.btn-danger-outline {
    background: transparent;
    border: 1.5px solid var(--danger);
    color: var(--danger);
    box-shadow: none;
}
.action-btn.danger-outline:hover,
.btn-danger-outline:hover {
    background: rgba(192,57,43,0.06);
}

/* ====================== ACTIVE TAB FILLED VARIANT ====================== */
.tab.active svg {
    fill: currentColor;
    fill-opacity: 0.15;
}

/* ====================== TAB BADGE ====================== */
.tab { position: relative; }
.tab .tab-badge {
    position: absolute; top: 4px; right: 10px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.9);
}

/* Login screen */
.admin-login {
    max-width: 320px; margin: 0 auto; padding: 0 1.25rem;
    text-align: center; min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.admin-login img { width: 80px; margin-bottom: 1rem; }
.admin-login h1 {
    font-size: 1.45rem; font-weight: 800; color: var(--green-4);
    margin-bottom: 1.25rem; letter-spacing: -0.02em;
}
.admin-login p { margin-bottom: 0.75rem; color: var(--text-mid); }
.admin-login input {
    width: 100%; padding: 0.85rem 1rem; font-family: inherit; font-size: 1.05rem;
    border: 1.5px solid #e2ddd0; border-radius: var(--radius-input); margin-bottom: 0.75rem;
    background: #fff; min-height: 52px;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.admin-login input:focus {
    outline: none; border-color: var(--green-1);
    box-shadow: var(--focus-ring);
}
.admin-login .error { color: var(--danger); font-size: 0.9rem; font-weight: 700; margin-bottom: 0.75rem; }
.admin-login button {
    width: 100%; padding: 0.85rem; font-family: inherit; font-size: 1.1rem;
    font-weight: 800; color: #fff; background: var(--green-4);
    border: none; border-radius: var(--radius-pill); cursor: pointer;
    box-shadow: 0 3px 0 #2a5c2a, 0 4px 12px rgba(57,119,57,0.2); min-height: 52px;
    transition: transform 0.08s, box-shadow 0.08s;
    letter-spacing: 0.01em;
}
.admin-login button:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #2a5c2a, 0 2px 6px rgba(57,119,57,0.2);
}

/* Section cards */
.admin-section {
    background: #fff; border-radius: var(--radius-card); padding: 1.1rem 1.15rem;
    margin-bottom: 0.85rem; box-shadow: var(--shadow-card);
}
.admin-section h2 {
    font-size: 1.05rem; font-weight: 800; color: var(--green-4);
    margin-bottom: 0.75rem; letter-spacing: -0.01em;
}

/* ====================== DIVIDER ====================== */
.divider {
    width: 36px; height: 4px;
    background: var(--green-3);
    border-radius: 2px;
    margin: 0.5rem auto 1rem;
}

/* ====================== BODY MODIFIERS ====================== */
body.menu-admin .tab-bar { display: none; }

/* ====================== EMPTY STATE DEFAULTS ====================== */
.empty, .empty-state {
    text-align: center; padding: 3.5rem 1.25rem; color: #b8b0a0;
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.7; }
.empty p, .empty-state p { font-size: 1rem; font-weight: 600; }
