* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f4f5f7;
    color: #1f2937;
    line-height: 1.5;
    overflow-x: hidden;
}
.admin-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
}
.admin-header {
    background: #1f2937;
    color: #fff;
    padding: 14px 0;
    margin-bottom: 24px;
}
.admin-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.admin-nav nav {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.admin-nav a {
    color: #d1d5db;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 4px 0;
}
.admin-nav a:hover, .admin-nav a.active { color: #fff; font-weight: 600; }
.admin-nav a.logout-link { color: #fca5a5; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
}

.panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 22px;
    margin-bottom: 22px;
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}
.panel h2 { font-size: 1.25rem; margin-bottom: 4px; }
.muted { color: #6b7280; font-size: 0.88rem; }

.pill-type {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 99px;
    font-size: 0.78rem;
    font-weight: 600;
}
.pill-print { background: #fef3c7; color: #92400e; }
.pill-online { background: #e0f2fe; color: #075985; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.86rem;
    margin-bottom: 5px;
}
input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.94rem;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #8b3a2b;
}
.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.checkbox-label input { width: auto; }

.seo-preview-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 18px;
    margin-top: 8px;
    overflow-wrap: break-word;
}
.seo-preview-label {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin-bottom: 6px;
}
.seo-preview-title {
    color: #1a0dab;
    font-size: 1.08rem;
    line-height: 1.3;
    margin-bottom: 2px;
}
.seo-preview-url {
    color: #006621;
    font-size: 0.84rem;
    margin-bottom: 4px;
}
.seo-preview-desc {
    color: #4d5156;
    font-size: 0.88rem;
    line-height: 1.45;
}

.preview-wrap { margin-top: 10px; }
.preview-hero {
    width: 100%;
    max-width: 320px;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #d1d5db;
}
.preview-portrait {
    width: 110px;
    height: 140px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #d1d5db;
}
.preview-book {
    width: 110px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #d1d5db;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.thumb-cover {
    width: 42px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid #d1d5db;
}
.thumb-album {
    width: 72px;
    height: 52px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #d1d5db;
}

.photo-admin-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.photo-admin-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 20px;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
}
.photo-admin-media img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    margin-bottom: 8px;
}
.photo-admin-media-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

hr { border: 0; border-top: 1px solid #e5e7eb; margin: 24px 0; }

.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    text-align: center;
}
.btn-primary { background: #8b3a2b; color: #fff; }
.btn-primary:hover { background: #6d2b1f; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.84rem; background: #374151; color: #fff; }
.btn-sm.btn-primary { background: #8b3a2b; }
.btn-sm.btn-danger { background: #dc2626; }
.btn-block { width: 100%; text-align: center; }

.form-actions { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.92rem;
    vertical-align: middle;
}
th { background: #f9fafb; font-weight: 600; }
.actions-cell { display: flex; gap: 8px; flex-wrap: wrap; }

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 0.92rem;
}
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.login-card {
    background: #fff;
    padding: 28px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    width: 100%;
    max-width: 400px;
}
.login-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.login-card .subtitle { color: #6b7280; font-size: 0.9rem; margin-bottom: 20px; }
.back-home { margin-top: 16px; text-align: center; font-size: 0.88rem; }
.back-home a { color: #6b7280; text-decoration: none; }

@media (max-width: 760px) {
    .admin-container { padding: 0 14px; }
    .panel { padding: 16px; }
    .photo-admin-row { grid-template-columns: 1fr; }

    table thead { display: none; }
    table, tbody, tr, td { display: block; width: 100%; }
    tr {
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 10px 12px;
        margin-bottom: 12px;
        background: #fafafa;
    }
    td {
        border-bottom: 1px solid #eceff1;
        padding: 8px 4px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        text-align: right;
    }
    td:last-child { border-bottom: 0; }
    td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.8rem;
        color: #6b7280;
        text-align: left;
    }
    .actions-cell { justify-content: flex-end; }
    .form-actions .btn { width: 100%; }
}
