/* ══════════════════════════════════════════════════════════
   Water Flow — Puzzle Lab & Level Editor Stylesheet
   ══════════════════════════════════════════════════════════ */

.lab-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    background: #07192C url('../assets/images/innerpage.png') no-repeat center top / cover;
}

/* Background Video (innervideo.mp4) */
.lab-bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    pointer-events: none;
    z-index: 0;
}

/* Subtle ambient underwater light rays effect */
.lab-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 15%, rgba(56, 189, 248, 0.15) 0%, rgba(7, 25, 44, 0.3) 55%, rgba(4, 14, 26, 0.65) 100%);
    pointer-events: none;
    z-index: 1;
}

/* ── Top Bar ─────────────────────────────────────────────── */
.lab__top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(11, 27, 43, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 180, 216, 0.15);
    z-index: 10;
}

.lab__back-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
}

.lab__back-btn:active {
    transform: scale(0.92);
}

.lab__back-btn svg {
    width: 20px;
    height: 20px;
}

.lab__title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #00B4D8 0%, #90E0EF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

/* ── Tab Switcher ────────────────────────────────────────── */
.lab__tabs {
    display: flex;
    padding: 8px 16px;
    gap: 8px;
    background: rgba(11, 27, 43, 0.5);
    z-index: 10;
}

.lab__tab {
    flex: 1;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #94A3B8;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.lab__tab.active {
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.25) 0%, rgba(0, 119, 182, 0.25) 100%);
    border-color: #00B4D8;
    color: #FFFFFF;
    box-shadow: 0 0 12px rgba(0, 180, 216, 0.2);
}

/* ── Content Viewport ────────────────────────────────────── */
.lab__content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-sizing: border-box;
    position: relative;
    z-index: 5;
}

/* ── Tab 1: Community Master Challenges ─────────────────── */
.lab__community-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lab-comm-card {
    background: linear-gradient(145deg, rgba(19, 45, 72, 0.7) 0%, rgba(11, 27, 43, 0.7) 100%);
    border: 1px solid rgba(0, 180, 216, 0.2);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.lab-comm-card:hover {
    border-color: #00B4D8;
    transform: translateY(-2px);
}

.lab-comm-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lab-comm-name {
    font-size: 16px;
    font-weight: 800;
    color: #FFFFFF;
}

.lab-comm-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #94A3B8;
}

.lab-comm-diff {
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
}

.lab-comm-diff.Easy { background: rgba(16, 185, 129, 0.2); color: #10B981; }
.lab-comm-diff.Medium { background: rgba(245, 158, 11, 0.2); color: #F59E0B; }
.lab-comm-diff.Hard { background: rgba(239, 68, 68, 0.2); color: #EF4444; }
.lab-comm-diff.Expert { background: rgba(168, 85, 247, 0.2); color: #A855F7; }

.lab-comm-btn-play {
    padding: 10px 18px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #00B4D8 0%, #0077B6 100%);
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.35);
    transition: transform 0.15s ease;
}

.lab-comm-btn-play:active {
    transform: scale(0.94);
}

/* ── Tab 2: Level Editor Canvas & Palette ────────────────── */
.lab-editor-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.lab-editor-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.lab-grid-size-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 180, 216, 0.3);
    background: rgba(0, 180, 216, 0.1);
    color: #ADE8F4;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.lab-editor-grid {
    display: grid;
    gap: 4px;
    padding: 12px;
    background: #0B1B2B;
    border: 1px solid rgba(0, 180, 216, 0.25);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    user-select: none;
}

.lab-editor-cell {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    color: #E2E8F0;
    transition: all 0.15s ease;
    position: relative;
}

.lab-editor-cell:hover {
    border-color: #00B4D8;
    background: rgba(0, 180, 216, 0.1);
}

.lab-editor-cell.src {
    background: radial-gradient(circle, #00B4D8 0%, #0077B6 100%);
    border: 1px solid #90E0EF;
    color: #FFFFFF;
}

.lab-editor-cell.dst {
    background: radial-gradient(circle, #10B981 0%, #047857 100%);
    border: 1px solid #6EE7B7;
    color: #FFFFFF;
}

/* Palette Tools */
.lab-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
    padding: 12px;
    background: rgba(11, 27, 43, 0.6);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.lab-palette-btn {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #94A3B8;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.lab-palette-btn.active {
    background: #00B4D8;
    color: #FFFFFF;
    border-color: #90E0EF;
    box-shadow: 0 0 10px rgba(0, 180, 216, 0.5);
}

.lab-editor-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.lab-btn-test {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.lab-btn-code {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 180, 216, 0.3);
    background: rgba(0, 180, 216, 0.15);
    color: #ADE8F4;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

/* ── Tab 3: Import Level Code ────────────────────────────── */
.lab-import-box {
    background: rgba(11, 27, 43, 0.7);
    border: 1px solid rgba(0, 180, 216, 0.2);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.lab-import-title {
    font-size: 16px;
    font-weight: 800;
    color: #FFFFFF;
}

.lab-import-desc {
    font-size: 13px;
    color: #94A3B8;
    line-height: 1.4;
}

.lab-import-input {
    width: 100%;
    padding: 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(0, 180, 216, 0.3);
    border-radius: 12px;
    color: #FFFFFF;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    box-sizing: border-box;
}

.lab-import-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #00B4D8 0%, #0077B6 100%);
    color: #FFFFFF;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 180, 216, 0.35);
}

/* Share Code Dialog Overlay */
.lab-code-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(6, 14, 24, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.lab-code-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.lab-code-card {
    background: #0E2238;
    border: 1px solid rgba(0, 180, 216, 0.3);
    border-radius: 20px;
    padding: 24px;
    width: 90%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.lab-code-val {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 180, 216, 0.2);
    border-radius: 10px;
    padding: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #FFD700;
    word-break: break-all;
    width: 100%;
    box-sizing: border-box;
}

.lab-code-copy-btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: #00B4D8;
    color: #FFFFFF;
    font-weight: 800;
    cursor: pointer;
}
