/**
 * Admin panel — v4 sidebar layout
 */
.admin-body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    background: #f1f5f9;
    min-height: 100vh;
    color: #334155;
}
.admin-body--sidebar { overflow-x: hidden; }

/* Sidebar layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
}
.admin-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 350;
    border: none;
    cursor: pointer;
}
.admin-sidebar-backdrop.is-visible { display: block; }
.admin-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 400;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
}
.admin-sidebar.is-open { transform: translateX(0); }
@media (min-width: 1024px) {
    .admin-sidebar {
        position: relative;
        transform: none;
    }
    .admin-sidebar-backdrop { display: none !important; }
}
.admin-sidebar-brand {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.admin-sidebar-brand a {
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
    text-decoration: none;
}
.admin-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0 20px;
}
.admin-sidebar-section {
    margin-bottom: 6px;
}
.admin-sidebar-heading {
    display: block;
    padding: 10px 18px 6px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
}
.admin-sidebar-link {
    display: block;
    padding: 10px 18px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.admin-sidebar-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.admin-sidebar-link.is-active {
    background: rgba(13, 148, 136, 0.2);
    color: #5eead4;
    border-left-color: #14b8a6;
}
.admin-sidebar-link--ghost { color: #94a3b8; }
.admin-sidebar-link--danger { color: #fca5a5; }
.admin-sidebar-link--danger:hover { background: rgba(239, 68, 68, 0.15); color: #fecaca; }
.admin-sidebar-footer {
    padding: 14px 18px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.admin-sidebar-footer .admin-sidebar-link { padding: 8px 0; border: none; }

.admin-content-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: 0;
}
@media (min-width: 1024px) {
    .admin-content-wrap { margin-left: 0; }
}
.admin-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.admin-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 10px;
    font-size: 1.25rem;
    cursor: pointer;
    color: #334155;
}
@media (min-width: 1024px) {
    .admin-sidebar-toggle { display: none; }
}
.admin-topbar-title {
    font-weight: 800;
    font-size: 1.1rem;
    color: #0f172a;
}
.admin-main {
    flex: 1;
    padding: 24px 20px 40px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}
.admin-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* Header */
.admin-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f766e 100%);
    color: #fff;
    box-shadow: 0 4px 24px rgba(30, 58, 95, 0.2);
    position: sticky;
    top: 0;
    z-index: 300;
}
.admin-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.admin-logo {
    color: #fff;
    font-weight: 800;
    font-size: 1.15rem;
    text-decoration: none;
    letter-spacing: 0.02em;
}
.admin-logo:hover { color: #a5f3fc; }
.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.admin-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.admin-btn--ghost {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
}
.admin-btn--ghost:hover { background: rgba(255,255,255,0.2); color: #fff; }
.admin-btn--logout {
    background: rgba(244, 63, 94, 0.25);
    color: #fecdd3;
    border: 1px solid rgba(244, 63, 94, 0.4);
}
.admin-btn--logout:hover { background: rgba(244, 63, 94, 0.4); color: #fff; }
.admin-nav-toggle {
    display: none;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Nav groups */
.admin-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px 28px;
    padding: 12px 20px 14px;
}
.admin-nav-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
}
.admin-nav-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.5);
    width: 100%;
    margin-bottom: 2px;
}
.admin-nav-group .admin-nav-label { width: auto; margin-right: 8px; margin-bottom: 0; }
.admin-nav-link {
    color: rgba(255,255,255,0.88);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.admin-nav-link:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}
.admin-nav-link.is-active {
    background: #fff;
    color: #0f766e;
}
@media (max-width: 900px) {
    .admin-nav-toggle { display: inline-flex; }
    .admin-nav {
        display: none;
        flex-direction: column;
        gap: 16px;
        padding-bottom: 16px;
    }
    .admin-nav.is-open { display: flex; }
    .admin-nav-group { flex-direction: column; align-items: flex-start; }
    .admin-nav-group .admin-nav-label { width: 100%; }
}

/* Main (padding in sidebar block above) */
.admin-page-header { margin-bottom: 28px; }
.admin-page-header h1 { margin: 0 0 8px; font-size: 1.75rem; font-weight: 800; color: #0f172a; }
.admin-page-lead { margin: 0; color: #64748b; font-size: 0.95rem; }
.admin-section-title {
    margin: 32px 0 14px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}
.admin-section-title:first-of-type { margin-top: 0; }

/* Dashboard stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}
.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    border-radius: 12px;
    text-decoration: none;
    color: #334155;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    background: #fff;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(13, 148, 136, 0.12);
}
.stat-card--teal { border-top: 3px solid #0d9488; }
.stat-card--slate { border-top: 3px solid #475569; }
.stat-card--amber { border-top: 3px solid #d97706; }
.stat-card--violet { border-top: 3px solid #7c3aed; }
.stat-card--alert { border-top: 3px solid #f43f5e; }
.stat-card.has-badge .stat-num { margin-top: 8px; }
.stat-num {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}
.stat-label { font-size: 0.75rem; font-weight: 600; color: #64748b; margin-top: 6px; text-align: center; }
.badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #f43f5e;
    color: #fff;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 800;
}

/* Quick link cards */
.admin-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.admin-quick-grid--narrow { max-width: 560px; }
.admin-quick-card {
    display: block;
    padding: 18px 18px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.admin-quick-card:hover {
    border-color: #99f6e4;
    box-shadow: 0 6px 20px rgba(13, 148, 136, 0.1);
}
.admin-quick-card strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}
.admin-quick-card span {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.4;
}

/* Tables & forms */
.admin-page h1 { margin-top: 0; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
}
.admin-table th, .admin-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f1f5f9; }
.admin-table th { background: #1e293b; color: #f8fafc; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.admin-table tr:hover { background: #f8fafc; }
.admin-table tr.unread { background: #ecfdf5; }
.admin-form label { display: block; margin-top: 14px; font-weight: 600; font-size: 0.875rem; color: #334155; }
.admin-form input[type="text"], .admin-form input[type="email"], .admin-form input[type="url"],
.admin-form input[type="number"], .admin-form input[type="file"], .admin-form select, .admin-form textarea {
    padding: 10px 14px;
    margin-top: 6px;
    max-width: 560px;
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
}
.admin-form textarea { min-height: 120px; }
.admin-form .btn, .admin-page .btn {
    margin-top: 18px;
    margin-right: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    color: #fff;
}
.admin-form .btn:hover, .admin-page .btn:hover { filter: brightness(1.05); }
.btn-secondary { background: #64748b !important; }
.link-btn {
    background: none;
    border: none;
    color: #0d9488;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-size: inherit;
    font-weight: 600;
}
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 20px; }
.inline-form input { margin: 0; }

/* Photo Gallery admin — improved layout */
.admin-gallery-page h1 { margin-bottom: 6px; }
.admin-gallery-lead {
    margin: 0 0 24px;
    color: #64748b;
    font-size: 0.9375rem;
}
.admin-gallery-upload-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 28px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.admin-gallery-upload-title {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}
.admin-gallery-upload-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.admin-gallery-file-label {
    display: inline-flex;
    align-items: center;
    padding: 10px 18px;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    color: #475569;
    transition: border-color 0.2s, background 0.2s;
}
.admin-gallery-file-label:hover {
    border-color: #0d9488;
    background: #f0fdfa;
    color: #0f766e;
}
.admin-gallery-file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}
.admin-gallery-add-btn {
    margin: 0;
    padding: 10px 20px;
}
.admin-gallery-list-title {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}
.admin-gallery-count { font-weight: 500; color: #64748b; }
.admin-gallery-empty {
    background: #f8fafc;
    border: 1px dashed #e2e8f0;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    color: #64748b;
    font-size: 0.9375rem;
}
.admin-gallery-empty p { margin: 0; }
.gallery-admin-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.gallery-admin-item {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}
.gallery-admin-item:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); }
.gallery-admin-img-wrap {
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #e2e8f0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gallery-admin-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}
.gallery-admin-actions {
    padding: 12px 14px;
    margin: 0;
    border-top: 1px solid #f1f5f9;
}
.gallery-admin-delete {
    margin: 0;
    padding: 8px 14px;
    font-size: 0.8125rem;
    width: 100%;
}
@media (max-width: 900px) {
    .gallery-admin-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}
@media (max-width: 480px) {
    .gallery-admin-grid { grid-template-columns: 1fr; }
}

.admin-dashboard h1 { margin-bottom: 0; }
.admin-error, .error { color: #b91c1c; }
.success { color: #0f766e; font-weight: 600; }
