:root {
    --bg: #f4f7fc;
    --surface: #ffffff;
    --text: #1e2a3e;
    --text-secondary: #5a6a7e;
    --primary: #07c160;
    --primary-hover: #06ad56;
    --shadow: 0 8px 30px rgba(0,0,0,0.08);
    --radius: 16px;
    --border: #e2e8f0;
    --card-bg: #ffffff;
    --hero-bg: linear-gradient(135deg, #07c160 0%, #06ad56 100%);
    --footer-bg: #1e2a3e;
    --footer-text: #cbd5e1;
    --modal-bg: rgba(0,0,0,0.5);
    --input-bg: #ffffff;
    --input-border: #d1d5db;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --shadow: 0 8px 30px rgba(0,0,0,0.4);
    --border: #334155;
    --card-bg: #1e293b;
    --hero-bg: linear-gradient(135deg, #0b4f2c 0%, #07c160 100%);
    --footer-bg: #020617;
    --footer-text: #64748b;
    --input-bg: #1e293b;
    --input-border: #475569;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
    line-height: 1.6;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
    background: var(--surface);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-nav {
    display: flex;
    gap: 24px;
    align-items: center;
}
.main-nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}
.main-nav a:hover, .main-nav a.active { color: var(--primary); }

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--text);
    cursor: pointer;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-toggle {
    background: none;
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    font-size: 1.2rem;
    transition: 0.2s;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* Hero */
.hero {
    background: var(--hero-bg);
    padding: 60px 0 50px;
    text-align: center;
    color: #fff;
}
.hero h1 {
    font-size: 2.4rem;
    font-weight: 700;
    margin-bottom: 12px;
}
.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 28px;
}

.search-bar {
    max-width: 560px;
    margin: 0 auto 20px;
    position: relative;
}
.search-bar i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}
.search-bar input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    border: none;
    border-radius: 40px;
    background: rgba(255,255,255,0.95);
    font-size: 1rem;
    color: #1e2a3e;
    outline: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.filter-bar {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.filter-bar select {
    padding: 10px 18px;
    border-radius: 40px;
    border: none;
    background: rgba(255,255,255,0.9);
    font-size: 0.95rem;
    color: #1e2a3e;
    cursor: pointer;
    outline: none;
    min-width: 140px;
}

/* Cards Grid */
.cards-section {
    padding: 40px 0;
}
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
    position: relative;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.card-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.card-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.card-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.5;
}

.card-stats {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.card-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary);
    color: #fff;
    padding: 10px 24px;
    border-radius: 40px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s, transform 0.1s;
    border: none;
    cursor: pointer;
}
.btn-primary:hover { background: var(--primary-hover); transform: scale(1.02); }

.btn-qr {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 40px;
    padding: 10px 16px;
    cursor: pointer;
    color: var(--text);
    font-size: 1.1rem;
    transition: 0.2s;
}
.btn-qr:hover { border-color: var(--primary); color: var(--primary); }

.card-changelog details {
    margin-top: 8px;
}
.card-changelog summary {
    font-weight: 500;
    cursor: pointer;
    color: var(--primary);
    font-size: 0.9rem;
}
.card-changelog p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 6px;
    padding-left: 8px;
    border-left: 3px solid var(--primary);
}

.no-results {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-secondary);
    padding: 40px 0;
}

/* Stats */
.stats-section {
    background: var(--surface);
    padding: 30px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.stats-grid {
    display: flex;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
}
.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text);
}
.stat-item i { color: var(--primary); font-size: 1.4rem; }
.stat-item span { font-weight: 700; font-size: 1.3rem; }

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 200;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: var(--modal-bg);
    align-items: center;
    justify-content: center;
}
.modal.show { display: flex; }
.modal-content {
    background: var(--surface);
    padding: 32px;
    border-radius: var(--radius);
    text-align: center;
    max-width: 340px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-content h3 { margin-bottom: 16px; }
.close-modal {
    position: absolute;
    top: 12px; right: 18px;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: 0.2s;
}
.close-modal:hover { color: var(--text); }
#qrcode { display: inline-block; margin: 12px auto; }
#qrUrl { font-size: 0.85rem; color: var(--text-secondary); word-break: break-all; }

/* Footer */
.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 32px 0;
    text-align: center;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.footer-links a {
    color: var(--footer-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.footer-links a:hover { color: #fff; }
.site-footer p { font-size: 0.85rem; opacity: 0.8; }

/* Admin */
.admin-login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}
.login-container {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 360px;
    max-width: 90%;
}
.login-container h2 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--primary);
}
.login-container input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 2px solid var(--input-border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 1rem;
    outline: none;
}
.login-container input:focus { border-color: var(--primary); }
.login-container button {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.login-container button:hover { background: var(--primary-hover); }
.back-link {
    display: block;
    text-align: center;
    margin-top: 16px;
    color: var(--text-secondary);
    text-decoration: none;
}
.error-msg { color: #e74c3c; margin-bottom: 12px; text-align: center; }

.admin-page {
    background: var(--bg);
}
.admin-header {
    background: var(--surface);
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.admin-header h1 { font-size: 1.4rem; color: var(--primary); }
.btn-logout {
    background: #e74c3c;
    color: #fff;
    padding: 8px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: 0.2s;
}
.btn-logout:hover { background: #c0392b; }

.admin-main {
    padding: 30px;
    max-width: 1000px;
    margin: 0 auto;
}
.admin-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.admin-section h2 {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.admin-form input, .admin-form select, .admin-form textarea {
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 12px;
    border: 2px solid var(--input-border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
}
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus { border-color: var(--primary); }
.admin-form textarea { resize: vertical; min-height: 80px; }
.admin-form button {
    background: var(--primary);
    color: #fff;
    padding: 10px 28px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.admin-form button:hover { background: var(--primary-hover); }

.admin-table-wrap { overflow-x: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th, .admin-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.admin-table th { font-weight: 600; color: var(--text-secondary); font-size: 0.85rem; }
.btn-delete {
    color: #e74c3c;
    text-decoration: none;
    font-weight: 500;
}
.btn-delete:hover { text-decoration: underline; }

.success-msg {
    background: #d4edda;
    color: #155724;
    padding: 12px 20px;
    border-radius: 10px;
    margin-bottom: 16px;
}
.back-home { margin-top: 16px; }
.back-home a { color: var(--primary); text-decoration: none; }

/* Responsive */
@media (max-width: 768px) {
    .main-nav {
        display: none;
        flex-direction: column;
        background: var(--surface);
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        padding: 20px;
        box-shadow: 0 8px 20px rgba(0,0,0,0.1);
        gap: 16px;
    }
    .main-nav.open { display: flex; }
    .hamburger { display: block; }
    .hero h1 { font-size: 1.8rem; }
    .cards-grid { grid-template-columns: 1fr; }
    .stats-grid { gap: 24px; }
}

/* Inner pages generic */
.inner-page {
    padding: 40px 0;
    min-height: 60vh;
}
.inner-page h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--text);
}
.inner-page p, .inner-page li {
    color: var(--text-secondary);
    line-height: 1.8;
}
.inner-page ul { padding-left: 20px; }