/* Gallery Admin Panel Styles */

.gallery-admin-btn {
    display: none; /* shown via JS in dev mode */
    position: absolute;
    top: 6px;
    right: 40px;
    z-index: 10;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 6px;
    color: #ccc;
    cursor: pointer;
    padding: 4px 7px;
    font-size: 15px;
    line-height: 1;
    transition: background 0.2s, color 0.2s;
}
.gallery-admin-btn:hover {
    background: rgba(255,255,255,0.22);
    color: #fff;
}
.mobile-device .gallery-admin-btn {
    display: none !important;
}

/* ── Modal overlay ── */
.ga-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.72);
    justify-content: center;
    align-items: center;
}
.ga-modal-overlay.show {
    display: flex;
}
.ga-modal {
    background: #1a1d23;
    border-radius: 12px;
    width: 92vw;
    max-width: 1100px;
    height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* ── Header ── */
.ga-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.ga-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #e0e0e0;
}
.ga-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.ga-dirty-badge {
    display: none;
    font-size: 11px;
    color: #ffb74d;
    background: rgba(255,183,77,0.12);
    border: 1px solid rgba(255,183,77,0.3);
    border-radius: 4px;
    padding: 2px 8px;
}
.ga-dirty-badge.show {
    display: inline-block;
}
.ga-save-btn {
    background: #4caf50;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.ga-save-btn:hover { background: #43a047; }
.ga-save-btn:disabled {
    background: #555;
    cursor: not-allowed;
}
.ga-close-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: #aaa;
    cursor: pointer;
    padding: 4px 10px;
    font-size: 17px;
    line-height: 1;
    transition: color 0.2s, border-color 0.2s;
}
.ga-close-btn:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

/* ── Body layout ── */
.ga-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Left panel: categories ── */
.ga-categories {
    width: 240px;
    min-width: 200px;
    border-right: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}
#ga-cat-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}
.ga-cat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 3px solid transparent;
    user-select: none;
}
.ga-cat-item:hover { background: rgba(255,255,255,0.04); }
.ga-cat-item.active {
    background: rgba(76,175,80,0.1);
    border-left-color: #4caf50;
}
.ga-cat-item.drag-over {
    background: rgba(76,175,80,0.18);
    border-left-color: #81c784;
}
.ga-cat-drag-handle {
    color: #555;
    cursor: grab;
    font-size: 14px;
    flex-shrink: 0;
}
.ga-cat-drag-handle:active { cursor: grabbing; }
.ga-cat-info {
    flex: 1;
    min-width: 0;
}
.ga-cat-name {
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ga-cat-desc {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ga-cat-count {
    font-size: 11px;
    color: #666;
    flex-shrink: 0;
}

/* ── Right panel: images ── */
.ga-images-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ga-images-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.ga-images-toolbar h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
}
.ga-add-image-btn {
    background: rgba(76,175,80,0.15);
    border: 1px solid rgba(76,175,80,0.3);
    color: #81c784;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.ga-add-image-btn:hover {
    background: rgba(76,175,80,0.25);
}

/* ── Game Config section (collapsible) ── */
.ga-config-section {
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.ga-config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.ga-config-header:hover {
    background: rgba(255,255,255,0.04);
}
.ga-config-title {
    font-size: 12px;
    font-weight: 600;
    color: #999;
}
.ga-config-toggle {
    font-size: 10px;
    color: #666;
    transition: transform 0.2s;
}
.ga-config-toggle.open {
    transform: rotate(90deg);
}
.ga-config-body {
    padding: 0 16px 12px;
}
.ga-config-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin-bottom: 10px;
}
.ga-config-field label {
    display: block;
    font-size: 11px;
    color: #888;
    margin-bottom: 3px;
}
.ga-config-field input,
.ga-config-field select {
    width: 100%;
    background: #252830;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    color: #ccc;
    padding: 5px 8px;
    font-size: 12px;
    box-sizing: border-box;
    font-family: 'Inter', monospace;
}
.ga-config-field select {
    cursor: pointer;
}
.ga-config-save-btn {
    background: #2196f3;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.ga-config-save-btn:hover { background: #1976d2; }
.ga-config-save-btn:disabled {
    background: #555;
    cursor: not-allowed;
}

/* Default background selector */
.ga-bg-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.ga-bg-selector label {
    font-size: 12px;
    color: #999;
}
.ga-bg-selector select {
    flex: 1;
    background: #252830;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    color: #ccc;
    padding: 4px 8px;
    font-size: 12px;
}

/* Image grid */
.ga-image-grid {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    align-content: start;
}

/* Image card */
.ga-image-card {
    background: #22252b;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: grab;
    user-select: none;
}
.ga-image-card:active { cursor: grabbing; }
.ga-image-card:hover {
    border-color: rgba(255,255,255,0.15);
}
.ga-image-card.drag-over {
    border-color: #4caf50;
    box-shadow: 0 0 0 2px rgba(76,175,80,0.3);
}
.ga-image-card.dragging {
    opacity: 0.4;
}
.ga-image-card.is-cover {
    border-color: #ffb74d;
    box-shadow: 0 0 0 1px rgba(255,183,77,0.3);
}
.ga-image-card.is-bg {
    border-color: #42a5f5;
    box-shadow: 0 0 0 1px rgba(66,165,245,0.3);
}
.ga-image-card.is-cover.is-bg {
    border-color: #ffb74d;
    box-shadow: 0 0 0 1px rgba(255,183,77,0.3), 0 0 0 3px rgba(66,165,245,0.25);
}
.ga-image-card.is-hidden {
    opacity: 0.4;
}
.ga-image-card.is-hidden .ga-image-thumb {
    filter: grayscale(0.6);
}
.ga-image-thumb {
    width: 100%;
    aspect-ratio: 3/2;
    object-fit: cover;
    display: block;
    background: #181a1f;
    border-radius: 8px 8px 0 0;
}
.ga-image-info {
    padding: 8px;
}
.ga-image-name {
    font-size: 11px;
    font-weight: 600;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
    cursor: text;
}
.ga-image-name:hover {
    color: #fff;
}
.ga-image-name-input {
    width: 100%;
    font-size: 11px;
    font-weight: 600;
    color: #ddd;
    background: #14161a;
    border: 1px solid rgba(76,175,80,0.4);
    border-radius: 3px;
    padding: 1px 4px;
    margin-bottom: 6px;
    box-sizing: border-box;
    font-family: inherit;
    outline: none;
}
.ga-image-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.ga-image-actions button {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px;
    color: #aaa;
    font-size: 10px;
    padding: 2px 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.ga-image-actions button:hover {
    background: rgba(255,255,255,0.12);
    color: #ddd;
}
.ga-image-actions button.active {
    background: rgba(255,183,77,0.15);
    border-color: rgba(255,183,77,0.3);
    color: #ffb74d;
}
.ga-image-actions .ga-btn-move {
    color: #64b5f6;
    border-color: rgba(100,181,246,0.2);
}
.ga-image-actions .ga-btn-move:hover {
    background: rgba(100,181,246,0.15);
    color: #90caf9;
}
.ga-move-select {
    background: #14161a;
    border: 1px solid rgba(76,175,80,0.4);
    border-radius: 4px;
    color: #ddd;
    font-size: 10px;
    padding: 2px 4px;
    cursor: pointer;
    outline: none;
}
.ga-image-actions .ga-btn-delete {
    color: #e57373;
    border-color: rgba(229,115,115,0.2);
}
.ga-image-actions .ga-btn-delete:hover {
    background: rgba(229,115,115,0.15);
    color: #ef5350;
}
.ga-cat-hidden-count {
    color: #999;
    font-size: 10px;
}

/* ── Category actions (edit / hide buttons) ── */
.ga-cat-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 4px;
}
.ga-cat-edit-btn,
.ga-cat-hide-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px;
    color: #aaa;
    font-size: 11px;
    padding: 2px 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    line-height: 1.4;
}
.ga-cat-edit-btn:hover,
.ga-cat-hide-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #ddd;
}
.ga-cat-hide-btn.active {
    background: rgba(255,183,77,0.15);
    border-color: rgba(255,183,77,0.3);
    color: #ffb74d;
}

/* Hidden category row */
.ga-cat-item.is-hidden {
    opacity: 0.4;
}

/* Inline edit inputs for category name/description */
.ga-cat-edit-input {
    width: 100%;
    background: #14161a;
    border: 1px solid rgba(76,175,80,0.4);
    border-radius: 4px;
    color: #ddd;
    font-family: 'Inter', sans-serif;
    padding: 3px 6px;
    box-sizing: border-box;
}
.ga-cat-edit-input.ga-cat-name-input {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
}
.ga-cat-edit-input.ga-cat-desc-input {
    font-size: 11px;
}
.ga-cat-edit-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}
.ga-cat-edit-save,
.ga-cat-edit-cancel {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px;
    color: #aaa;
    font-size: 10px;
    padding: 2px 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.ga-cat-edit-save {
    background: rgba(76,175,80,0.15);
    border-color: rgba(76,175,80,0.3);
    color: #81c784;
}
.ga-cat-edit-save:hover { background: rgba(76,175,80,0.25); }
.ga-cat-edit-cancel:hover {
    background: rgba(255,255,255,0.12);
    color: #ddd;
}

/* ── Add category button + footer ── */
.ga-cat-footer {
    padding: 10px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.ga-add-cat-btn {
    width: 100%;
    background: rgba(76,175,80,0.15);
    border: 1px dashed rgba(76,175,80,0.3);
    color: #81c784;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.ga-add-cat-btn:hover {
    background: rgba(76,175,80,0.25);
}

/* ── Prompt edit inline ── */
.ga-prompt-editor {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    background: #1e2128;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 16px;
    width: 460px;
    max-width: 90vw;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.ga-prompt-editor.show { display: block; }
.ga-prompt-editor h4 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #e0e0e0;
}
.ga-prompt-textarea {
    width: 100%;
    min-height: 120px;
    background: #14161a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: #ddd;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    padding: 10px;
    resize: vertical;
    box-sizing: border-box;
}
.ga-prompt-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 10px;
}
.ga-prompt-actions button {
    border: none;
    border-radius: 5px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}
.ga-prompt-save-btn {
    background: #4caf50;
    color: #fff;
}
.ga-prompt-save-btn:hover { background: #43a047; }
.ga-prompt-cancel-btn {
    background: rgba(255,255,255,0.08);
    color: #aaa;
}
.ga-prompt-cancel-btn:hover {
    background: rgba(255,255,255,0.14);
    color: #ddd;
}

/* Empty state */
.ga-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #555;
    font-size: 14px;
}

/* Admin token modal */
.ga-token-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10002;
    background: rgba(0,0,0,0.6);
    justify-content: center;
    align-items: center;
}
.ga-token-overlay.show { display: flex; }
.ga-token-box {
    background: #1e2128;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 24px;
    width: 360px;
    max-width: 90vw;
}
.ga-token-box h3 {
    margin: 0 0 12px;
    font-size: 15px;
    color: #e0e0e0;
}
.ga-token-input {
    width: 100%;
    padding: 8px 12px;
    background: #14161a;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: #ddd;
    font-size: 13px;
    box-sizing: border-box;
    margin-bottom: 12px;
}
.ga-token-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.ga-token-actions button {
    border: none;
    border-radius: 5px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
}
.ga-token-ok {
    background: #4caf50;
    color: #fff;
}
.ga-token-cancel {
    background: rgba(255,255,255,0.08);
    color: #aaa;
}
