/* ==========================================
   LyCo Studio — Admin Panel
   ========================================== */

:root {
    --bg: #0f1117;
    --bg-panel: #181b25;
    --bg-input: #1e2130;
    --bg-hover: #242838;

    --gold: #e8c47c;
    --gold-dim: #a08550;
    --blue: #5b9cf6;
    --red: #f05656;
    --green: #4ecb71;

    --text: #e0e0e8;
    --text-sec: #8890a4;
    --text-muted: #4e5468;

    --border: rgba(255, 255, 255, 0.08);
    --radius: 8px;

    --font: 'Noto Sans SC', 'Sora', sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

/* ========================================
   HEADER
   ======================================== */

.admin-header {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-row {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.back-link {
    color: var(--text-sec);
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: color 0.2s;
}

.back-link:hover { color: var(--gold); }

.header-title {
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
    color: var(--text);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gold);
    color: #111;
    border-color: var(--gold);
}

.btn-primary:hover {
    background: var(--gold-dim);
    border-color: var(--gold-dim);
}

.btn-ghost {
    background: transparent;
    color: var(--text-sec);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.btn-danger {
    background: transparent;
    color: var(--red);
    border-color: rgba(240, 86, 86, 0.2);
}

.btn-danger:hover {
    background: rgba(240, 86, 86, 0.1);
}

.btn-sm {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
}

/* ========================================
   MAIN & PANELS
   ======================================== */

.admin-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.panel-title {
    font-size: 0.95rem;
    font-weight: 600;
}

/* ========================================
   GAME LIST
   ======================================== */

.game-list {
    display: flex;
    flex-direction: column;
}

.game-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.game-item:last-child { border-bottom: none; }
.game-item:hover { background: var(--bg-hover); }

.game-item-emoji {
    font-size: 1.6rem;
    width: 2.5rem;
    text-align: center;
    flex-shrink: 0;
}

.game-item-info {
    flex: 1;
    min-width: 0;
}

.game-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
}

.game-item-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.game-item-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
    vertical-align: middle;
}

.game-item-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.empty-hint {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========================================
   FORM
   ======================================== */

.game-form {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group.flex-2 { flex: 2; }

.form-group label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-sec);
}

.req { color: var(--red); }
.hint { color: var(--text-muted); font-weight: 300; }

.form-group input[type="text"],
.form-group textarea {
    font-family: var(--font);
    font-size: 0.88rem;
    padding: 0.55rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--gold-dim);
}

.form-group textarea {
    resize: vertical;
    min-height: 70px;
}

.color-input-wrap {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-input-wrap input[type="color"] {
    width: 36px;
    height: 36px;
    padding: 2px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

.color-input-wrap input[type="text"] {
    flex: 1;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-sec);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--gold);
    width: 16px;
    height: 16px;
}

.form-actions {
    display: flex;
    gap: 0.8rem;
    padding-top: 0.5rem;
}

/* ========================================
   PREVIEW
   ======================================== */

.preview-area {
    padding: 2rem;
    display: flex;
    justify-content: center;
}

.preview-card {
    max-width: 380px;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #1a1d2e;
    border: 1px solid rgba(255,255,255,0.06);
}

.preview-visual {
    aspect-ratio: 16/9;
    background: #111320;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    position: relative;
    overflow: hidden;
}

.preview-visual img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-accent {
    height: 3px;
}

.preview-body {
    padding: 1.2rem 1.4rem;
}

.preview-body h3 {
    font-size: 1.05rem;
    margin-bottom: 0.2rem;
}

.preview-body .sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.preview-body .desc {
    font-size: 0.82rem;
    color: var(--text-sec);
    line-height: 1.6;
    margin-bottom: 0.8rem;
}

.preview-body .tags {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.preview-body .tags span {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 100px;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.06);
}

/* ========================================
   TOAST
   ======================================== */

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    font-size: 0.85rem;
    color: var(--text);
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }

/* ========================================
   AUTH OVERLAY
   ======================================== */

.auth-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s, visibility 0.4s;
}

.auth-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.auth-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.auth-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.auth-desc {
    font-size: 0.82rem;
    color: var(--text-sec);
    margin-bottom: 1.5rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.auth-input {
    font-family: var(--font);
    font-size: 0.95rem;
    padding: 0.7rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    outline: none;
    text-align: center;
    letter-spacing: 0.15em;
    transition: border-color 0.2s;
}

.auth-input:focus {
    border-color: var(--gold);
}

.auth-btn {
    padding: 0.7rem;
    font-size: 0.9rem;
}

.auth-error {
    font-size: 0.8rem;
    color: var(--red);
    margin-top: 1rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.auth-error.visible {
    opacity: 1;
}

.auth-back {
    display: inline-block;
    margin-top: 1.2rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.auth-back:hover {
    color: var(--gold);
}

.auth-input.shake {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 640px) {
    .header-row {
        flex-wrap: wrap;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .form-row {
        flex-direction: column;
    }

    .admin-main {
        padding: 1rem;
    }
}
