/* ============================================================
   ADMIN PANEL — GalaxySeven
   Styles for the admin control panel page.
   ============================================================ */

:root {
    --ap-bg: #0d1117;
    --ap-card-bg: rgba(17, 24, 39, 0.9);
    --ap-border: #30363d;
    --ap-accent: #9333ea;
    --ap-accent-light: #a855f7;
    --ap-text: #e5e7eb;
    --ap-text-dim: #8b949e;
    --ap-green: #22c55e;
    --ap-red: #dc2626;
    --ap-yellow: #f59e0b;
    --ap-orange: #f97316;
    --ap-bg: #0a0c14;
    --ap-surface: #141824;
    --ap-surface2: #1c2030;
    --ap-border: #2a3040;
    --ap-gold: #f0c040;
    --ap-gold-dim: #8a7030;
    --ap-blue: #4a90d9;
    --ap-green: #4ade80;
    --ap-red: #f87171;
    --ap-purple: #a78bfa;
    --ap-text: #e2e8f0;
    --ap-text-dim: #8892a6;
    --ap-common: #c0c0c0;
    --ap-rare: #4169e1;
    --ap-restricted: #4169e1;
    --ap-classified: #9400d3;
    --ap-epic: #9400d3;
    --ap-covert: #eb4b4b;
    --ap-legendary: #ffd700;
}

/* ── Container ──────────────────────────────── */
.admin-panel-container {
    max-width: 900px;
    margin: 20px auto 60px;
    padding: 0 20px;
}

.admin-panel-header {
    text-align: center;
    margin-bottom: 30px;
}

.admin-panel-header h1 {
    font-family: "Maven Pro", sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--ap-text);
    margin-bottom: 6px;
}

.admin-panel-header p {
    color: var(--ap-text-dim);
    font-size: 0.9rem;
}

/* ── Tabs ───────────────────────────────────── */
.admin-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid var(--ap-border);
}

.admin-tab {
    flex: 1;
    padding: 14px 20px;
    text-align: center;
    cursor: pointer;
    background: transparent;
    color: var(--ap-text-dim);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: "Montserrat", sans-serif;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
}

.admin-tab:hover {
    color: var(--ap-text);
    background: rgba(147, 51, 234, 0.05);
}

.admin-tab.active {
    color: var(--ap-accent-light);
    border-bottom-color: var(--ap-accent);
}

/* ── Tab Content ────────────────────────────── */
.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

/* ── Cards ──────────────────────────────────── */
.admin-card {
    background: var(--ap-card-bg);
    border: 1px solid var(--ap-border);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.admin-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ap-text);
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ap-border);
}

/* ── Config Row ─────────────────────────────── */
.admin-config-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    gap: 20px;
}

.admin-config-info {
    flex: 1;
}

.admin-config-label {
    display: block;
    font-weight: 600;
    color: var(--ap-text);
    margin-bottom: 4px;
}

.admin-config-desc {
    display: block;
    color: var(--ap-text-dim);
    font-size: 0.85rem;
}

/* ── Toggle Switch ──────────────────────────── */
.admin-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.admin-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.admin-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #374151;
    transition: 0.3s;
    border-radius: 28px;
}

.admin-toggle-slider::before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    transition: 0.3s;
    border-radius: 50%;
}

.admin-toggle input:checked + .admin-toggle-slider {
    background: var(--ap-accent);
}

.admin-toggle input:checked + .admin-toggle-slider::before {
    transform: translateX(24px);
}

/* ── Search Row ─────────────────────────────── */
.admin-search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

/* ── Form Grid ──────────────────────────────── */
.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

@media (max-width: 640px) {
    .admin-form-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Inputs ─────────────────────────────────── */
.admin-input {
    padding: 10px 14px;
    border: 1px solid var(--ap-border);
    background: rgba(10, 14, 26, 0.9);
    color: var(--ap-text);
    font-family: "Montserrat", sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    flex: 1;
}

.admin-input:focus {
    border-color: var(--ap-accent);
}

.admin-input::placeholder {
    color: var(--ap-text-dim);
}

.admin-input-sm {
    padding: 8px 10px;
    font-size: 0.85rem;
    text-align: center;
}

.admin-select {
    padding: 10px 14px;
    border: 1px solid var(--ap-border);
    background: rgba(10, 14, 26, 0.9);
    color: var(--ap-text);
    font-family: "Montserrat", sans-serif;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

/* ── Buttons ────────────────────────────────── */
.admin-btn {
    padding: 10px 20px;
    border: none;
    font-family: "Montserrat", sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.admin-btn-primary {
    background: var(--ap-accent);
    color: #fff;
}

.admin-btn-primary:hover {
    background: var(--ap-accent-light);
}

.admin-btn-secondary {
    background: rgba(55, 65, 81, 0.6);
    color: var(--ap-text);
    border: 1px solid var(--ap-border);
}

.admin-btn-secondary:hover {
    background: rgba(75, 85, 99, 0.6);
}

.admin-btn-success {
    background: #166534;
    color: #bbf7d0;
}

.admin-btn-success:hover {
    background: #1a7f3e;
}

.admin-btn-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid #f59e0b;
}

.admin-btn-warning:hover {
    background: rgba(245, 158, 11, 0.25);
}

.admin-btn-danger {
    background: rgba(220, 38, 38, 0.15);
    color: #fca5a5;
    border: 1px solid #dc2626;
}

.admin-btn-danger:hover {
    background: rgba(220, 38, 38, 0.3);
}

.admin-btn-small {
    padding: 6px 14px;
    font-size: 0.8rem;
    background: var(--ap-accent);
    color: #fff;
}

.admin-btn-small:hover {
    background: var(--ap-accent-light);
}

/* ── Message ────────────────────────────────── */
.admin-message {
    margin-top: 10px;
    font-size: 0.85rem;
    min-height: 20px;
}

.admin-message-success {
    color: var(--ap-green);
}

.admin-message-error {
    color: var(--ap-red);
}

.admin-message-info {
    color: var(--ap-text-dim);
}

/* ── User List ──────────────────────────────── */
.admin-user-list {
    margin-top: 10px;
}

.admin-no-results {
    color: var(--ap-text-dim);
    text-align: center;
    padding: 16px;
}

.admin-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--ap-border);
    margin-bottom: 6px;
    background: rgba(10, 14, 26, 0.5);
    transition: background 0.15s;
    gap: 12px;
}

.admin-user-row:hover {
    background: rgba(147, 51, 234, 0.08);
}

.admin-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.admin-user-name {
    font-weight: 600;
    color: var(--ap-text);
    font-size: 0.95rem;
}

.admin-user-id {
    color: var(--ap-text-dim);
    font-size: 0.75rem;
}

.admin-user-balance {
    color: var(--ap-yellow);
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

/* ── Badges ─────────────────────────────────── */
.admin-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 6px;
    vertical-align: middle;
}

.admin-badge-admin {
    background: rgba(147, 51, 234, 0.2);
    color: #c084fc;
    border: 1px solid #7c3aed;
}

.admin-badge-banned {
    background: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
    border: 1px solid #dc2626;
}

.admin-badge-moderator {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid #3b82f6;
}

.admin-badge-designer {
    background: rgba(168, 85, 247, 0.2);
    color: #d8b4fe;
    border: 1px solid #a855f7;
}

.admin-badge-associate {
    background: rgba(250, 204, 21, 0.2);
    color: #fde68a;
    border: 1px solid #eab308;
}

/* ── Modal ──────────────────────────────────── */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-modal-content {
    background: var(--ap-card-bg);
    border: 1px solid var(--ap-border);
    padding: 30px;
    max-width: 520px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.admin-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--ap-text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.admin-modal-close:hover {
    color: var(--ap-text);
}

.admin-modal-userid {
    color: var(--ap-text-dim);
    font-size: 0.8rem;
    margin: 4px 0;
}

.admin-modal-balance {
    color: var(--ap-yellow);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 16px;
}

/* ── Action Groups ──────────────────────────── */
.admin-action-group {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--ap-border);
}

.admin-action-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.admin-action-group h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ap-text-dim);
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-danger-zone {
    background: rgba(220, 38, 38, 0.05);
    border: 1px solid rgba(220, 38, 38, 0.2);
    padding: 14px;
    border-radius: 4px;
}

.admin-danger-zone h3 {
    color: var(--ap-red);
}

/* ── Item Management ────────────────────────── */
.admin-item-table-wrap {
    overflow-x: auto;
    margin-top: 12px;
}

.admin-item-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-item-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: var(--ap-text-dim);
    border-bottom: 2px solid var(--ap-border);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.admin-item-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
    color: var(--ap-text);
    vertical-align: middle;
}

.admin-item-table tr:hover td {
    background: rgba(147, 51, 234, 0.04);
}

.admin-item-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    display: block;
    background: rgba(0,0,0,0.4);
}

.admin-no-image {
    display: inline-block;
    width: 48px;
    height: 48px;
    line-height: 48px;
    text-align: center;
    background: rgba(0,0,0,0.3);
    color: var(--ap-text-dim);
    font-size: 0.7rem;
}

.admin-tier-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.admin-item-table code {
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    font-size: 0.8rem;
    color: var(--ap-accent-light);
}

.admin-form-grid-2col {
    grid-template-columns: 1fr 1fr;
}

.admin-form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-form-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ap-text-dim);
}

.admin-required {
    color: var(--ap-red);
}

.admin-input-color {
    padding: 4px 8px;
    height: 42px;
    cursor: pointer;
    width: 100%;
}

.admin-input-file {
    padding: 8px 10px;
    border: 1px solid var(--ap-border);
    background: rgba(10, 14, 26, 0.9);
    color: var(--ap-text);
    font-family: "Montserrat", sans-serif;
    font-size: 0.85rem;
    flex: 1;
}

.admin-item-image-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--ap-border);
}

.admin-item-image-section > label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ap-text-dim);
    margin-bottom: 8px;
}

.admin-image-upload-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.admin-image-preview-wrap {
    margin-top: 10px;
    text-align: center;
    min-height: 80px;
    border: 1px dashed var(--ap-border);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
}

.admin-image-preview-wrap img {
    max-width: 200px;
    max-height: 120px;
    object-fit: contain;
}

.admin-text-dim {
    color: var(--ap-text-dim);
    font-size: 0.85rem;
}

.admin-modal-wide {
    max-width: 640px;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 640px) {
    .admin-panel-container {
        padding: 0 10px;
    }

    .admin-card {
        padding: 16px;
    }

    .admin-config-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-search-row {
        flex-direction: column;
    }

    .admin-user-row {
        flex-wrap: wrap;
    }
}

/* ── Section Manager ─────────────────────────── */
.admin-section-list {
    margin-top: 12px;
}

.admin-section-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-section-item {
    background: var(--ap-surface2);
    border: 1px solid var(--ap-border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.admin-section-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.admin-section-item-icon {
    font-size: 1.3rem;
}

.admin-section-item-name {
    font-weight: 600;
    color: var(--ap-text);
    font-size: 0.95rem;
}

.admin-section-item-order {
    color: var(--ap-text-dim);
    font-size: 0.75rem;
    margin-left: 8px;
}

.admin-section-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.admin-section-banner-thumb {
    width: 80px;
    height: 40px;
    object-fit: cover;
    border: 1px solid var(--ap-border);
    flex-shrink: 0;
}

/* Case item in unassigned list */
.admin-case-item {
    /* inherits admin-section-item */
}

.admin-case-thumb {
    width: 48px;
    height: 32px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--ap-border);
}

.admin-case-info {
    flex: 1;
    min-width: 150px;
}

.admin-case-name {
    display: block;
    font-weight: 600;
    color: var(--ap-text);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-case-meta {
    display: block;
    color: var(--ap-text-dim);
    font-size: 0.7rem;
    margin-top: 2px;
}

/* ═══ UNSASSIGNED GRID (4 cols × 5 rows) ═══ */
.sm-case-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

@media (max-width: 900px) {
    .sm-case-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .sm-case-grid {
        grid-template-columns: 1fr;
    }
}

.sm-case-card {
    display: flex;
    flex-direction: column;
    background: var(--ap-surface2);
    border: 2px solid var(--ap-border);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    position: relative;
    user-select: none;
    overflow: hidden;
}
.sm-case-card:hover {
    border-color: var(--ap-accent-light);
    box-shadow: 0 0 12px rgba(147, 51, 234, 0.2);
}
.sm-case-card:has(.sm-case-checkbox:checked) {
    border-color: var(--ap-accent);
    box-shadow: 0 0 14px rgba(147, 51, 234, 0.35);
}

.sm-case-checkbox {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    z-index: 2;
    accent-color: var(--ap-accent);
}

.sm-case-card-img {
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: var(--ap-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sm-case-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sm-case-card-info {
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-height: 52px;
}

.sm-case-card-name {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--ap-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sm-case-card-meta {
    font-size: 0.68rem;
    color: var(--ap-text-dim);
}

.sm-case-card-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 6px;
    margin-top: 3px;
    align-self: flex-start;
    background: rgba(240, 192, 64, 0.15);
    color: var(--ap-gold);
    border: 1px solid rgba(240, 192, 64, 0.3);
}
.sm-case-card-badge-official {
    background: rgba(74, 144, 217, 0.15);
    color: var(--ap-blue);
    border: 1px solid rgba(74, 144, 217, 0.3);
}

/* ═══ MULTI-SELECT TOOLBAR ═══ */
.sm-multiselect-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(147, 51, 234, 0.08);
    border: 1px solid var(--ap-accent);
    margin-bottom: 12px;
    flex-wrap: wrap;
}

#sm-selected-count {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--ap-accent-light);
    white-space: nowrap;
}

/* ═══ PAGINATION ═══ */
.sm-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 0;
    flex-wrap: wrap;
}

.sm-page-btn {
    min-width: 32px;
    height: 32px;
    padding: 4px 8px;
    border: 1px solid var(--ap-border);
    background: rgba(10, 14, 26, 0.7);
    color: var(--ap-text);
    font-family: "Montserrat", sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.sm-page-btn:hover:not(:disabled) {
    border-color: var(--ap-accent);
    color: var(--ap-accent-light);
}
.sm-page-btn.active {
    background: var(--ap-accent);
    border-color: var(--ap-accent);
    color: #fff;
}
.sm-page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.sm-page-ellipsis {
    min-width: 32px;
    text-align: center;
    color: var(--ap-text-dim);
    font-size: 0.85rem;
}

.sm-page-info {
    margin-left: 8px;
    font-size: 0.8rem;
    color: var(--ap-text-dim);
    font-weight: 600;
}
