/* Admin panel styling */
:root {
    color-scheme: light;
    --brand-primary: #5d4037;
    --brand-secondary: #8d6e63;
    --brand-light: #f3e9e4;
    --brand-dark: #3e2723;
    --border-color: #e0d5ce;
    --bg-body: #fefbf8;
    --text-color: #2d1b16;
    --text-muted: #7e655c;
    --success: #2e7d32;
    --error: #c62828;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-color);
}

h1, h2, h3 {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    letter-spacing: 0.02em;
}

p {
    margin: 0 0 1rem 0;
}

a {
    color: var(--brand-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 600;
    background: var(--brand-secondary);
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(93, 64, 55, 0.18);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(93, 64, 55, 0.25);
}

.btn-primary {
    background: var(--brand-primary);
}

.btn-secondary {
    background: transparent;
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.btn-danger {
    background: transparent;
    color: var(--error);
    border-color: var(--error);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 2rem clamp(1.5rem, 4vw, 3rem);
    background: linear-gradient(135deg, #f6ebe4, #eaddd0);
    border-bottom: 1px solid var(--border-color);
}

.admin-header .branding h1 {
    font-size: clamp(1.8rem, 2.4vw, 2.4rem);
}

.admin-header .branding p {
    margin-top: 0.35rem;
    color: var(--text-muted);
}

.admin-header nav {
    display: flex;
    gap: 0.75rem;
}

.admin-content {
    padding: clamp(1.5rem, 4vw, 3rem);
    display: grid;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: #fff;
    border-radius: 20px;
    border: 1px solid rgba(93, 64, 55, 0.08);
    box-shadow: 0 20px 40px rgba(93, 64, 55, 0.08);
    padding: clamp(1.5rem, 3vw, 2rem);
}

.card > h2 {
    margin-bottom: 1rem;
}

.form-grid {
    display: grid;
    gap: 0.8rem;
}

.form-grid label {
    font-weight: 600;
    font-size: 0.95rem;
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--brand-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(93, 64, 55, 0.18);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.category-block {
    border: 1px dashed rgba(93, 64, 55, 0.2);
    border-radius: 16px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
    background: #fffdfb;
}

.category-block header {
    margin-bottom: 1rem;
}

.category-block h3 {
    font-size: 1.2rem;
}

.category-description {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.item-form,
.note-form {
    border-radius: 16px;
    border: 1px solid rgba(93, 64, 55, 0.12);
    padding: 1rem;
    margin-bottom: 1rem;
    background: #fff;
    box-shadow: 0 8px 24px rgba(93, 64, 55, 0.05);
}

.item-form .grid,
.note-form .grid {
    display: grid;
    gap: 0.75rem;
}

.item-form .grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.note-form .grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.item-actions,
.note-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.75rem;
}

.delete-form {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.muted {
    color: var(--text-muted);
    font-style: italic;
}

.alert {
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.alert-success {
    background: rgba(46, 125, 50, 0.08);
    color: var(--success);
    border: 1px solid rgba(46, 125, 50, 0.25);
}

.alert-error {
    background: rgba(198, 40, 40, 0.08);
    color: var(--error);
    border: 1px solid rgba(198, 40, 40, 0.25);
}

.flash-messages {
    display: grid;
    gap: 0.5rem;
}

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5ebe3, #e6d4c8);
}

.login-wrapper {
    width: min(420px, 90vw);
}

.login-card {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 25px 60px rgba(93, 64, 55, 0.25);
    padding: 2.5rem;
    text-align: center;
}

.login-card h1 {
    font-size: 1.8rem;
}

.login-card .subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.login-card form {
    display: grid;
    gap: 0.75rem;
    text-align: left;
}

.login-card label {
    font-weight: 600;
}

.menu-link {
    display: inline-block;
    margin-top: 1.5rem;
    font-weight: 600;
}

@media (max-width: 780px) {
    .admin-header {
        flex-direction: column;
        gap: 1.5rem;
        align-items: stretch;
    }
    .admin-header nav {
        flex-wrap: wrap;
    }
}
