:root {
    --bg: #07111f;
    --panel: #101b2e;
    --panel-2: #17253c;
    --text: #f7f8fb;
    --muted: #8ea1bb;
    --accent: #58a6ff;
    --accent-2: #7c5cff;
    --border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: radial-gradient(circle at top, #14233c 0%, var(--bg) 55%, #050913 100%);
    color: var(--text);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.container {
    width: min(1400px, calc(100% - 2rem));
    margin: 0 auto;
}

.panel {
    background: linear-gradient(145deg, rgba(16, 27, 46, 0.95), rgba(23, 37, 60, 0.95));
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.15rem;
    border-radius: 999px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: #fff;
    transition: transform 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.remember-choice {
    display: block;
    margin: 0.2rem 0 1rem;
}

.remember-option {
    width: 100%;
    gap: 0.45rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    opacity: 0.65;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.remember-icon {
    width: 0.9rem;
    height: 0.9rem;
    flex: 0 0 auto;
}

.remember-option.is-active {
    opacity: 1;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.remember-option:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.remember-yes {
    background: linear-gradient(90deg, #2fbf71, #18a558);
}

.remember-no {
    background: linear-gradient(90deg, #ef5350, #c62828);
}

.btn-danger {
    background: linear-gradient(90deg, #ea4335, #c5221f);
    color: #fff;
}

.message-error {
    margin-bottom: 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(234, 67, 53, 0.5);
    background: rgba(234, 67, 53, 0.18);
    color: #ffd7d4;
}

.admin-login {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
}

.login-box h1 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-box input {
    width: 100%;
    padding: 0.8rem 0.9rem;
    margin-bottom: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.login-box button {
    width: 100%;
}

.admin-dashboard .header {
    backdrop-filter: blur(16px);
    background: rgba(7, 17, 31, 0.82);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-dashboard .header h1 {
    margin: 0;
    font-size: 1.2rem;
}

.admin-dashboard .header-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.admin-dashboard .role-pill {
    padding: 0.6rem 1rem;
    border-radius: 999px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.14);
    color: var(--text);
    border: 1px solid var(--border);
}

.admin-dashboard .back-site {
    padding: 0.6rem 1rem;
    border-radius: 999px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.14);
    color: var(--text);
    border: 1px solid var(--border);
}

.admin-dashboard .logout {
    padding: 0.6rem 1rem;
    border-radius: 999px;
    font-weight: 600;
    background: linear-gradient(90deg, #ea4335, #c5221f);
}

.admin-dashboard .container {
    padding: 2rem 0 2.5rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    padding: 1.2rem;
}

.stat-label {
    color: var(--muted);
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin-top: 0.35rem;
}

.actions {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.actions .button {
    flex: 1 1 170px;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 0.95rem;
    border-radius: 999px;
    text-align: center;
    font-weight: 600;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: #fff;
}

.sort-form {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.sort-label {
    color: var(--text);
    display: inline-flex;
    align-items: center;
}

.sort-dropdown {
    position: relative;
}

.sort-dropdown > summary {
    list-style: none;
}

.sort-dropdown > summary::-webkit-details-marker {
    display: none;
}

.sort-trigger {
    min-height: 42px;
    min-width: 132px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0.55rem 2.2rem 0.55rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.sort-trigger::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #c8d7ea;
    transform: translateY(-20%);
    transition: transform 0.2s ease;
}

.sort-dropdown[open] .sort-trigger::after {
    transform: translateY(-30%) rotate(180deg);
}

.sort-dropdown[open] .sort-trigger {
    border-color: rgba(88, 166, 255, 0.7);
}

.sort-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 100%;
    padding: 0.35rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(16, 27, 46, 0.98);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.34);
    z-index: 20;
}

.sort-option {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text);
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
}

.sort-option:hover,
.sort-option:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.sort-option.is-active {
    background: linear-gradient(90deg, #2d82e6, #256bca);
    color: #ffffff;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.gallery-card {
    overflow: hidden;
}

.gallery-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.gallery-info {
    padding: 1rem;
}

.gallery-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.gallery-count {
    color: var(--muted);
}

.gallery-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 1200px) {
    .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .gallery-grid { grid-template-columns: repeat(1, 1fr); }
    .stats { grid-template-columns: 1fr; }
    .admin-dashboard .header { gap: 0.6rem; }
    .admin-dashboard .header-actions { width: 100%; justify-content: flex-end; }
}
