:root {
    --bg: #f2f5fb;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-alt: rgba(255, 255, 255, 0.88);
    --primary: #f4b400;
    --primary-gradient: linear-gradient(135deg, #f4b400, #ffd65c);
    --danger: #d64562;
    --text: #1f2933;
    --muted: rgba(31, 41, 51, 0.65);
    --radius: 20px;
    --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.95), rgba(236, 241, 249, 0.9));
    color: var(--text);
}

.auth-layout {
    display: grid;
    place-items: center;
    padding: 2rem;
}

.auth-card {
    background: var(--surface);
    padding: 2.4rem;
    border-radius: var(--radius);
    width: min(360px, 90vw);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.auth-card h1 {
    margin: 0;
    font-size: 1.6rem;
}

.auth-subtitle {
    margin: 0;
    color: var(--muted);
}

.auth-card label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-card .language-switch {
    align-self: flex-end;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-card .language-switch label {
    font-size: 0.85rem;
    color: var(--muted);
}

.auth-card .language-switch select {
    padding: 0.4rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(203, 213, 224, 0.9);
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
}

.auth-card input[type="text"],
.auth-card input[type="password"] {
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    border: 1px solid rgba(203, 213, 224, 0.6);
    background: rgba(240, 244, 250, 0.95);
    color: var(--text);
}

.auth-card button {
    padding: 0.7rem 1rem;
    border: none;
    border-radius: 999px;
    background: var(--primary-gradient);
    color: #1f2937;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(244, 180, 0, 0.25);
}

.auth-error {
    margin: 0;
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    background: rgba(214, 69, 98, 0.15);
    color: #ab1e3d;
}

.auth-meta {
    margin: 0;
    text-align: center;
}

.auth-meta a {
    color: #0f172a;
    text-decoration: none;
}

.admin-layout {
    padding-bottom: 3rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2.6rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(219, 226, 234, 0.9);
}

.admin-header h1 {
    margin: 0;
    font-size: 2rem;
}

.admin-header p {
    margin: 0.3rem 0 0;
    color: var(--muted);
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.admin-user .language-switch {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(15, 23, 42, 0.04);
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
}

.admin-user .language-switch label {
    font-size: 0.85rem;
    color: var(--muted);
}

.admin-user .language-switch select {
    border: 1px solid rgba(203, 213, 224, 0.8);
    border-radius: 999px;
    padding: 0.35rem 0.6rem;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
}

.admin-user .button {
    padding: 0.5rem 1rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    border: none;
    cursor: pointer;
    background: var(--primary-gradient);
    color: #1f2937;
    padding: 0.6rem 1.1rem;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: 0 12px 26px rgba(244, 180, 0, 0.28);
}

.button.secondary {
    background: rgba(15, 23, 42, 0.05);
    color: var(--text);
    box-shadow: none;
}

.button.danger {
    background: linear-gradient(135deg, #d64562, #f0728e);
    color: #fff;
    box-shadow: 0 12px 26px rgba(214, 69, 98, 0.3);
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    align-items: start;
    width: min(1240px, 95vw);
    margin: 2.5rem auto;
    gap: 2rem;
}

.admin-sidebar {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(208, 216, 226, 0.9);
    padding: 1.6rem 1.2rem;
    position: sticky;
    top: 120px;
}

.admin-sidebar h2 {
    margin: 0 0 1rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.admin-sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.9rem;
    border-radius: 12px;
    text-decoration: none;
    color: rgba(31, 41, 51, 0.8);
    transition: background 0.2s ease, transform 0.2s ease;
}

.admin-sidebar a.active,
.admin-sidebar a:hover {
    background: rgba(244, 180, 0, 0.18);
    color: #0f172a;
    transform: translateX(4px);
}

.admin-main {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.admin-card {
    background: var(--surface-alt);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(208, 216, 226, 0.9);
}

.admin-card header h2 {
    margin: 0;
}

.admin-card header p {
    margin: 0.4rem 0 1.6rem;
    color: var(--muted);
}

.admin-flex {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-form label,
.admin-form fieldset {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-form .field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-form .field .hint {
    font-size: 0.8rem;
    color: var(--muted);
}

.admin-form .form-hint {
    font-size: 0.8rem;
    color: var(--muted);
}

.admin-form input,
.admin-form textarea,
.admin-form select {
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(203, 213, 224, 0.75);
    background: rgba(246, 248, 255, 0.95);
    color: var(--text);
}

.admin-form textarea {
    min-height: 160px;
}

.admin-form fieldset {
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem;
    border-radius: 14px;
}

.admin-form legend {
    padding: 0 0.4rem;
    color: var(--muted);
}

.admin-form .checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
}

.admin-form .checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.admin-form .inline {
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
}

.admin-form .inline input {
    max-width: 140px;
}

.admin-list {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 14px;
    padding: 1.4rem;
    border: 1px solid rgba(208, 216, 226, 0.9);
}

.admin-helper {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 14px;
    padding: 1.4rem;
    border: 1px solid rgba(208, 216, 226, 0.9);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-helper .tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.9rem;
}

.admin-helper .tag-list code {
    background: rgba(15, 23, 42, 0.08);
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    font-family: 'Fira Code', 'Consolas', 'SFMono-Regular', monospace;
}

.admin-helper h4 {
    margin: 0.4rem 0 0;
}

.content-image-upload {
    gap: 0.8rem;
}

.content-image-upload input[type="file"] {
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    border: 1px dashed rgba(15, 23, 42, 0.18);
    background: rgba(246, 248, 255, 0.95);
}

.snippet {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.code-snippet {
    width: 100%;
    min-height: 100px;
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid rgba(203, 213, 224, 0.75);
    background: rgba(246, 248, 255, 0.95);
    font-family: 'Fira Code', 'Consolas', 'SFMono-Regular', monospace;
    font-size: 0.95rem;
    resize: none;
}

.snippet-actions {
    display: flex;
    gap: 0.6rem;
}

.snippet-actions .button {
    padding: 0.5rem 0.9rem;
}

.admin-list h3 {
    margin-top: 0;
}

.admin-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.admin-list .item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-list .tag {
    background: rgba(15, 23, 42, 0.06);
    color: rgba(15, 23, 42, 0.8);
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.tag-small {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
}

.admin-list .actions {
    display: flex;
    gap: 0.5rem;
}

.button-small {
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
}

.button.secondary.button-small {
    background: rgba(15, 23, 42, 0.08);
    color: var(--text);
}

.button.danger.button-small {
    box-shadow: none;
}

.tag-success {
    background: rgba(34, 197, 94, 0.18);
    color: #166534;
}

.tag-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #991b1b;
}

.users-board {
    align-items: start;
}

.users-board .admin-form {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(208, 216, 226, 0.9);
    border-radius: 18px;
    padding: 1.6rem;
}

.users-board .admin-list {
    max-height: 540px;
    overflow: auto;
}

.user-edit-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    border: 1px solid rgba(208, 216, 226, 0.9);
}

.user-edit-panel header h3 {
    margin: 0 0 1rem;
}

.alert {
    padding: 1rem 1.2rem;
    border-radius: 14px;
}

.alert.success {
    background: rgba(46, 204, 113, 0.18);
    color: #1d7a3d;
}

.alert.error {
    background: rgba(214, 69, 98, 0.16);
    color: #b4234d;
}

.gallery-admin {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.gallery-admin article {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: center;
    border: 1px solid rgba(208, 216, 226, 0.8);
}

.gallery-admin .tag-small {
    align-self: flex-start;
    background: rgba(244, 180, 0, 0.16);
}

.gallery-admin img {
    width: 100%;
    border-radius: 12px;
    object-fit: cover;
    height: 140px;
}

.gallery-board {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.gallery-board-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.gallery-board-header h3 {
    margin: 0;
}

.gallery-board-meta {
    margin: 0.3rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.gallery-board-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.gallery-tile-grid {
    display: grid;
    gap: 1.2rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.gallery-tile {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    border: 1px solid rgba(208, 216, 226, 0.9);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.gallery-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
}

.gallery-tile.is-active {
    border-color: rgba(244, 180, 0, 0.8);
    box-shadow: 0 22px 48px rgba(244, 180, 0, 0.28);
    transform: translateY(-4px);
}

.gallery-tile-link {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    text-decoration: none;
    color: inherit;
}

.gallery-tile-cover {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.06);
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-tile-cover img {
    width: 100%;
    height: 170px;
    object-fit: cover;
}

.gallery-tile-cover-empty {
    font-size: 2rem;
    opacity: 0.55;
}

.gallery-tile-count {
    position: absolute;
    bottom: 0.7rem;
    right: 0.7rem;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.gallery-tile-body h4 {
    margin: 0;
}

.gallery-tile-body .tag {
    margin-top: 0.4rem;
}

.gallery-tile-updated {
    margin: 0.6rem 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.gallery-tile-actions {
    display: flex;
    gap: 0.5rem;
}

.gallery-detail {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.gallery-detail-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 1.6rem;
    border: 1px solid rgba(208, 216, 226, 0.9);
    box-shadow: var(--shadow);
}

.gallery-detail-card h3,
.gallery-detail-card h4 {
    margin: 0 0 1rem;
}

.gallery-detail-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 1.2rem;
}

.gallery-detail-header {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.gallery-detail-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gallery-detail-summary h3 {
    margin: 0;
}

.gallery-detail-cover {
    width: 120px;
    height: 120px;
    border-radius: 18px;
    object-fit: cover;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
}

.gallery-detail-meta {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.gallery-detail-updated {
    font-weight: 600;
}

.gallery-detail-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.gallery-detail-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.2rem;
}

.gallery-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.gallery-image-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(246, 248, 255, 0.85);
    border-radius: 14px;
    padding: 0.8rem;
}

.gallery-image-item img {
    width: 100%;
    border-radius: 12px;
    object-fit: cover;
}

.gallery-image-item p {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

@media (max-width: 720px) {
    .admin-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .admin-user {
        align-self: stretch;
        justify-content: space-between;
    }

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

    .admin-sidebar {
        position: static;
        flex-direction: row;
        display: flex;
        overflow-x: auto;
    }

    .admin-sidebar nav {
        flex-direction: row;
        gap: 0.5rem;
    }

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

    .gallery-detail-summary {
        flex-direction: column;
        align-items: flex-start;
    }

    .gallery-detail-cover {
        width: 100%;
        height: auto;
        max-height: 220px;
    }
}
