* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #0b1119;
    color: #e8eef8;
    line-height: 1.45;
}

a { color: #87beff; text-decoration: none; }
a:hover { text-decoration: none; }

h1, h2, h3 {
    margin-top: 0;
    letter-spacing: 0.2px;
}

.admin-content > h1 {
    margin-bottom: 16px;
}

.admin-content > p {
    margin-top: 0;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px;
}

.center-card {
    max-width: 560px;
    margin: 8vh auto 0 auto;
    background: #111a26;
    border: 1px solid #24364d;
    border-radius: 16px;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.34);
    padding: 26px;
}

.hero {
    text-align: center;
    margin-top: 12vh;
}

.muted { color: #95a8be; }

input[type="text"], input[type="email"], input[type="password"], textarea, select {
    width: 100%;
    background: #0e1620;
    color: #f4f9ff;
    border: 1px solid #273b53;
    border-radius: 11px;
    padding: 11px 12px;
    margin-top: 8px;
}

input[type="file"] {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    border-radius: 11px;
    border: 1px dashed #335074;
    background: #0c141d;
    color: #cfdeef;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #4da3ff;
    box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.16);
}

textarea { min-height: 110px; resize: vertical; }

button, .btn {
    display: inline-block;
    background: #4ea4ff;
    color: #08101a;
    border: 0;
    border-radius: 11px;
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
}

button:hover, .btn:hover { opacity: 0.95; }

.btn-secondary {
    background: #151f2b;
    color: #eaf2ff;
    border: 1px solid #2b435f;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.admin-layout {
    display: block;
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 270px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0f161f;
    border-right: 1px solid #24364d;
    padding: 18px 14px 14px;
    overflow-y: auto;
}

.admin-brand {
    padding: 6px 8px 14px;
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.admin-brand-logo {
    width: 156px !important;
    max-width: 156px !important;
    max-height: 44px !important;
    height: 44px !important;
    display: block;
    object-fit: contain;
}

.admin-brand-subtitle {
    margin-top: 8px;
    color: #9ab2c9;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.admin-nav {
    display: grid;
    gap: 8px;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 10px;
    background: #121c28;
    border: 1px solid #25384f;
    color: #deebfb;
    font-weight: 500;
}

.admin-nav-link:hover {
    background: #182637;
    border-color: #3b5f88;
}

.admin-nav-link.is-active {
    background: #1a3656;
    border-color: #4e82ba;
}

.admin-nav-icon {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px;
    min-height: 16px;
    flex: 0 0 16px;
    display: inline-flex;
    overflow: hidden;
}

.admin-nav-icon svg {
    width: 16px !important;
    height: 16px !important;
    display: block;
}

.admin-sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
}

.admin-nav-link-logout {
    border-color: #583737;
    background: #211719;
}

.admin-nav-link-logout:hover {
    background: #2a1d21;
    border-color: #7a4e54;
}

.admin-content {
    margin-left: 270px;
    padding: 28px;
    max-width: 1400px;
    width: 100%;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
}

.card {
    background: #111a26;
    border: 1px solid #263a51;
    border-radius: 14px;
    padding: 18px;
}

.card + .card {
    margin-top: 14px;
}

.page-toolbar {
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-title {
    margin: 22px 0 12px;
}

.table-wrap {
    border-radius: 14px;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #121b27;
    border: 1px solid #263a51;
    border-radius: 14px;
    overflow: hidden;
}

th, td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #223447;
    vertical-align: middle;
}

th {
    color: #9eb3c8;
    font-weight: 600;
    background: #152233;
}

tr:hover td {
    background: rgba(36, 56, 79, 0.18);
}

td .btn {
    margin-right: 8px;
    margin-bottom: 6px;
}

td .btn:last-child {
    margin-right: 0;
}

.flash {
    margin-bottom: 16px;
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid #23384f;
}

.flash-success { background: #153727; color: #a7f6c7; border-color: #2a6f4d; }
.flash-error { background: #3b1b1b; color: #ffc5c5; border-color: #814242; }

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

label {
    display: block;
    font-weight: 600;
    color: #d6e5f6;
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.inline-actions form {
    margin: 0;
}

.gallery-sort-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
}

.gallery-item {
    background: #0f141b;
    border: 1px solid #2a3d52;
    border-radius: 10px;
    padding: 8px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.gallery-item.is-dragging {
    opacity: 0.35;
}

.gallery-item.is-drop-target {
    border-color: #4da3ff;
    box-shadow: inset 0 0 0 1px rgba(77, 163, 255, 0.35);
}

.gallery-sort-list.is-sorting .gallery-item {
    cursor: grabbing;
}

.gallery-item-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.gallery-order-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 22px;
    border-radius: 99px;
    background: #1a2838;
    border: 1px solid #355273;
    color: #d5e6fa;
    font-size: 12px;
    font-weight: 700;
}

.gallery-thumb-badge {
    display: none;
    align-items: center;
    justify-content: center;
    height: 22px;
    padding: 0 8px;
    border-radius: 99px;
    background: #193925;
    border: 1px solid #2a7248;
    color: #a8eec7;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.gallery-drag-hint {
    font-size: 12px;
    color: #9aaec4;
    margin-bottom: 6px;
}

.gallery-preview-image {
    width: 100%;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #1e2936;
    display: block;
}

.gallery-remove-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 13px;
}

.gallery-drop-placeholder {
    min-height: 138px;
    border-radius: 10px;
    border: 2px dashed #4da3ff;
    background: rgba(77, 163, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(77, 163, 255, 0.25);
}

.download-form-card {
    max-width: 980px;
}

.download-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.download-form br {
    display: none;
}

.download-current-link {
    display: inline-block;
    max-width: 100%;
    word-break: break-all;
}

@media (max-width: 980px) {
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar {
        position: relative;
        top: auto;
        left: auto;
        bottom: auto;
        width: auto;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid #24364d;
        overflow-y: visible;
    }
    .admin-content { margin-left: 0; }
    .admin-sidebar-footer { margin-top: 12px; }
}

@media (max-width: 780px) {
    .grid-2 { grid-template-columns: 1fr; }
    .admin-content { padding: 16px; }
}
