:root {
    --sidebar-width: 260px;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.admin-body {
    background: #f4f6f9;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    flex-shrink: 0;
}

.admin-content {
    min-width: 0;
}

.admin-sidebar .nav-link.active {
    color: #fff !important;
}

.login-body {
    background: linear-gradient(135deg, #0d6efd 0%, #1f2937 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 1rem;
}

.stat-card {
    border-radius: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.recent-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
}

.media-grid-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    background: #f1f3f5;
}

.upload-preview-grid {
    display: none;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    background: #f8f9fa;
}

.upload-preview-grid.is-visible {
    display: flex;
}

.upload-dropzone {
    position: relative;
    border: 2px dashed #ced4da;
    border-radius: 0.75rem;
    padding: 1.5rem 1rem;
    background: #f8f9fa;
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-dropzone.is-dragover {
    border-color: #0d6efd;
    background: #eef4ff;
}

.upload-dropzone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-dropzone-content {
    pointer-events: none;
}

.upload-dropzone-icon {
    font-size: 2rem;
    color: #6c757d;
    display: block;
    margin-bottom: 0.5rem;
}

.upload-dropzone.is-dragover .upload-dropzone-icon {
    color: #0d6efd;
}

.upload-preview-item {
    position: relative;
    width: 72px;
    flex-shrink: 0;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
    background: #fff;
}

.upload-preview-thumb {
    width: 72px;
    height: 72px;
    background: #f1f3f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-preview-thumb img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    display: block;
}

.upload-preview-placeholder {
    font-size: 1.25rem;
    color: #adb5bd;
}

.upload-preview-meta {
    padding: 0.25rem 0.35rem 0.35rem;
}

.upload-preview-name {
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.upload-preview-info {
    font-size: 0.6rem;
    color: #6c757d;
    line-height: 1.2;
}

.upload-preview-index {
    position: absolute;
    top: 0.2rem;
    left: 0.2rem;
    z-index: 2;
    background: rgba(13, 110, 253, 0.9);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
}

.upload-progress-panel {
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    background: #f8f9fa;
    padding: 1rem 1.25rem;
}

.upload-progress-bar-wrap {
    height: 1.5rem;
}

.upload-progress-log {
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 0.25rem 0.75rem;
}

.upload-progress-panel--done {
    border-color: #badbcc;
    background: #f3faf5;
}

.upload-progress-panel--error {
    border-color: #f1aeb5;
    background: #fff5f5;
}

.embed-html-output {
    resize: vertical;
    min-height: 3.5rem;
}

.embed-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.75rem;
    max-height: 340px;
    overflow-y: auto;
    padding: 0.75rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
}

.embed-preview-item {
    min-width: 0;
    text-align: center;
}

.embed-preview-item a {
    display: block;
}

.embed-preview-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
    background: #fff;
}

.embed-preview-video,
.upload-preview-video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 0.375rem;
    border: 1px solid #dee2e6;
    background: #000;
}

.embed-preview-name {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.7rem;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 991.98px) {
    #admin-wrapper {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        min-height: auto;
    }
}

.admin-locations-map {
    height: calc(100vh - 260px);
    min-height: 420px;
}

.admin-locations-map-wrap .locations-map {
    height: calc(100vh - 260px);
    min-height: 420px;
}

.locations-map-wrap {
    position: relative;
}

.locations-map-wrap.is-loading .locations-map {
    opacity: 0.35;
}

.map-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.72);
    color: #212529;
    font-weight: 600;
    text-align: center;
}

.map-error-alert {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    z-index: 25;
}

.map-engine-toolbar .btn.active {
    background-color: #212529;
    border-color: #212529;
    color: #fff;
}

.locations-map .cesium-viewer,
.locations-map .cesium-widget {
    width: 100%;
    height: 100%;
}

.cesium-map-popup {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    width: min(280px, calc(100% - 2rem));
    padding: 1rem 1.25rem 1rem 1rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.15);
}

.cesium-map-popup-close {
    position: absolute;
    top: 0.35rem;
    right: 0.5rem;
    border: 0;
    background: transparent;
    font-size: 1.25rem;
    line-height: 1;
    color: #6c757d;
    cursor: pointer;
}

.cesium-map-popup-body .map-popup a {
    display: inline-block;
    margin-top: 0.35rem;
}

.map-popup a {
    text-decoration: none;
    font-weight: 600;
}
