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

:root {
    --bg: #f4f7f2;
    --surface: #ffffff;
    --primary: #2d5a27;
    --primary-dark: #1e3d1a;
    --primary-light: #4a7c42;
    --accent: #81c784;
    --accent-light: #c8e6c9;
    --text: #1e2d18;
    --text-muted: #5a6b54;
    --border: #c8d6c0;
    --danger: #c0392b;
    --danger-light: #fce4e4;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

header {
    background: var(--primary);
    color: #fff;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

header .logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

header .logo:hover {
    text-decoration: none;
    opacity: 0.9;
}

header .logo svg {
    width: 28px;
    height: 28px;
}

header nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

header nav a {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    padding: 6px 14px;
    border-radius: var(--radius);
    transition: background 0.2s;
    font-weight: 500;
}

header nav a:hover {
    background: rgba(255, 255, 255, 0.15);
    text-decoration: none;
    color: #fff;
}

header nav a.btn-primary {
    background: linear-gradient(135deg, #43a047, #66bb6a);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 8px 18px;
    box-shadow: 0 0 12px rgba(67, 160, 71, 0.5), 0 2px 6px rgba(0, 0, 0, 0.2);
    animation: pulse-glow 2s ease-in-out infinite;
    border: none;
    letter-spacing: 0.3px;
}

header nav a.btn-primary:hover {
    background: linear-gradient(135deg, #66bb6a, #81c784);
    box-shadow: 0 0 24px rgba(102, 187, 106, 0.7), 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: none;
    transform: scale(1.06);
}

main {
    padding: 24px 0;
}

footer {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 48px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-align: center;
    line-height: 1.4;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: #b0c0a8;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #a93226;
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.85rem;
}

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

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text);
}

.form-group .help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.1);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3e%3cpath fill='%235a6b54' d='M6 8L1 3h10z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

input[type="file"] {
    font-size: 0.9rem;
}

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-body {
    padding: 16px;
}

.card-body h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.card-body .meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.card-body .meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.category-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.category-card:hover {
    border-color: var(--primary-light);
    background: var(--accent-light);
}

.category-card.active {
    border-color: var(--primary);
    background: var(--accent-light);
    color: var(--primary-dark);
}

.category-card svg {
    display: block;
    margin: 0 auto 8px;
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.search-bar {
    margin-bottom: 24px;
}

.search-bar input[type="search"] {
    font-size: 1.1rem;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-available {
    background: var(--accent-light);
    color: var(--primary-dark);
}

.badge-taken {
    background: #ffe0b2;
    color: #e65100;
}

.badge-unavailable {
    background: #e0e0e0;
    color: #616161;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.modal h2 {
    margin-bottom: 16px;
    font-size: 1.2rem;
}

.modal .btn {
    margin-top: 12px;
}

.modal-close {
    float: right;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.item-detail {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

.item-detail .item-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
}

.item-detail .item-image img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

.item-detail .item-body {
    padding: 24px;
}

.item-detail h1 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.item-detail .description {
    margin: 16px 0;
    line-height: 1.7;
    white-space: pre-wrap;
}

.item-detail .meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.item-detail .meta p {
    margin-bottom: 4px;
}

.item-detail .actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.message-box {
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
}

.message-box.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.message-box.error {
    background: var(--danger-light);
    color: #a93226;
    border: 1px solid #f5b7b1;
}

.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    color: var(--border);
}

.empty-state h3 {
    margin-bottom: 8px;
}

.login-form {
    max-width: 360px;
    margin: 48px auto;
    background: var(--surface);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-form h1 {
    margin-bottom: 24px;
    text-align: center;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th,
.admin-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.admin-table th {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: var(--accent-light);
}

.admin-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.admin-filters select,
.admin-filters input {
    max-width: 200px;
}

.page-title {
    font-size: 1.5rem;
    margin-bottom: 24px;
}

.form-section {
    max-width: 600px;
    margin: 0 auto;
    background: var(--surface);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.form-section h1 {
    margin-bottom: 24px;
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-dark);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 12px rgba(67, 160, 71, 0.5), 0 2px 6px rgba(0, 0, 0, 0.2);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 22px rgba(102, 187, 106, 0.7), 0 3px 10px rgba(0, 0, 0, 0.25);
        transform: scale(1.06);
    }
}

.pagination-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--border);
    transition: background 0.2s, color 0.2s;
}

.page-btn:hover {
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-color: var(--primary);
}

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

.page-dots {
    padding: 8px 6px;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    header .container {
        flex-wrap: wrap;
    }

    .category-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .category-card {
        padding: 12px 8px;
        font-size: 0.8rem;
    }

    .category-card svg {
        width: 24px;
        height: 24px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .item-detail h1 {
        font-size: 1.3rem;
    }

    .admin-filters select,
    .admin-filters input {
        max-width: 100%;
        flex: 1;
    }

    .admin-table {
        font-size: 0.8rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 6px;
    }
}
