/* ================================
   style.css - KIEMLUAKHONGKHO
   ================================ */

/* === BASE STYLE === */
* {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #03060c;
    color: #f1f5f9;
    overflow: hidden;
    touch-action: manipulation;
    transition: background-color 0.4s ease, color 0.4s ease;
}

input, select, textarea {
    font-size: 16px !important;
    user-select: text !important;
}

/* === GLASS CLASSES === */
.glass-panel {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.4s ease;
}

.glass-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:active {
    transform: scale(0.97);
}

/* === GRADIENTS === */
.gradient-gold {
    background: linear-gradient(135deg, #fff176 0%, #f59e0b 50%, #d97706 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gradient-vip {
    background: linear-gradient(135deg, #fcd34d 0%, #ef4444 50%, #7e22ce 100%);
}

.text-gradient-vip {
    background: linear-gradient(135deg, #fcd34d 0%, #ef4444 50%, #7e22ce 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* === SCROLL === */
.app-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    padding-bottom: 95px;
}

.app-scroll::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
.app-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.app-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.feedback-scroll {
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    overflow-y: hidden;
}
.feedback-item {
    scroll-snap-align: center;
}

/* === ANIMATIONS === */
.fade-in {
    animation: fadeIn 0.4s ease forwards;
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === TAB SYSTEM === */
.page-tab {
    display: none;
}
.page-tab.active {
    display: block;
    animation: fadeIn 0.4s ease forwards;
}

.nav-btn {
    color: #64748b;
    transition: all 0.3s ease;
    position: relative;
}
.nav-btn.active {
    color: #06b6d4;
    transform: translateY(-3px);
}
.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 3px;
    background: #06b6d4;
    border-radius: 3px;
    box-shadow: 0 0 10px #06b6d4;
}

/* === LIGHT MODE OVERRIDES === */
body.light-mode {
    background-color: #e2e8f0;
    color: #0f172a;
}
body.light-mode .glass-panel,
body.light-mode header.glass-panel,
body.light-mode footer.glass-panel {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
}
body.light-mode .glass-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 1) 0%, rgba(241, 245, 249, 1) 100%);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}
body.light-mode .text-white,
body.light-mode .text-slate-200,
body.light-mode .text-slate-300 {
    color: #0f172a !important;
}
body.light-mode .text-slate-400 {
    color: #475569 !important;
}
body.light-mode .bg-slate-900,
body.light-mode .bg-slate-950,
body.light-mode .bg-\[\#070a12\] {
    background-color: #ffffff !important;
}
body.light-mode .border-slate-800,
body.light-mode .border-white\/5,
body.light-mode .border-white\/10 {
    border-color: rgba(0, 0, 0, 0.1) !important;
}
body.light-mode .bg-slate-800 {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}
body.light-mode .shadow-mobile-frame {
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.2), 0 0 30px rgba(6, 182, 212, 0.1);
}

/* === TOOL FREE OVERRIDES (hh.html) === */
:root {
    --accent-cyan: #00e5ff;
    --accent-blue: #2979ff;
    --accent-gold: #ffd700;
    --accent-green: #00e676;
    --accent-red: #ff3d00;
    --glass-bg: rgba(10, 15, 30, 0.65);
    --glass-border: rgba(255, 255, 255, 0.15);
}

body.light-mode :root {
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.2);
}

#toolViewContainer {
    font-family: 'Plus Jakarta Sans', sans-serif;
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
}

#gameIframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 1;
}

#botWrap {
    position: absolute;
    top: 70px;
    left: 20px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    transform-origin: center;
    transition: opacity 0.4s ease, transform 0.5s;
    transform: scale(var(--bot-scale, 1)) rotate(var(--bot-rotation, 0deg));
}

#botWrap.hidden-tool {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.5) rotate(var(--bot-rotation, 0deg)) !important;
}

#botPanel {
    width: 350px;
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(200%);
    border: 1px solid var(--glass-border);
    border-top: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
    cursor: grab;
}

#botPanel:active {
    cursor: grabbing;
}

.bot-badge {
    background: rgba(0, 229, 255, 0.1);
    color: var(--accent-cyan);
    padding: 5px 14px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.5px;
    border: 1px solid rgba(0, 229, 255, 0.25);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.15);
}

#statusDot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
    animation: pulseTool 2s infinite;
}

@keyframes pulseTool {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.5);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 230, 118, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 230, 118, 0);
    }
}

#summaryLine {
    font-size: 13px;
    font-weight: 800;
    margin: 15px 0;
    text-align: center;
    color: var(--accent-gold);
}

.bot-info-container {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.bot-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0;
    font-size: 13px;
    color: #94a3b8;
    font-weight: 600;
}

.bot-val {
    font-weight: 900;
    color: #fff;
    font-size: 16px;
}

#botInputArea {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    width: 100%;
}

#sessionInput {
    flex: 1;
    min-width: 0;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
    outline: none;
    font-weight: 700;
    font-size: 14px;
}

#btnNext, #btnAnalyze {
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
}

#btnNext {
    background: rgba(255, 215, 0, 0.1);
    color: var(--accent-gold);
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 0 12px;
    font-size: 12px;
}

#btnAnalyze {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
    padding: 0 15px;
    font-size: 13px;
}

#historyBox {
    padding: 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.hist-title {
    color: #64748b;
    font-size: 10px;
    text-transform: uppercase;
    margin-bottom: 10px;
    font-weight: 800;
    text-align: center;
}

.hist-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.hist-top {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.hist-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-check {
    flex: 1;
    padding: 6px 0;
    border-radius: 6px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.btn-check.win {
    color: var(--accent-green);
    border-color: rgba(0, 230, 118, 0.2);
}

.btn-check.lose {
    color: var(--accent-red);
    border-color: rgba(255, 61, 0, 0.2);
}

.bot-control-group {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-rotate {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    padding: 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

#sizeSlider {
    flex: 1;
    height: 4px;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

#sizeSlider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--accent-cyan);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

#toolToggleBtn {
    position: absolute;
    bottom: 25px;
    right: 25px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10000;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

#botHistoryModal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(8px);
}

#botHistoryModal.show {
    opacity: 1;
    pointer-events: all;
}

.bot-modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-top: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.bot-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.bot-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
}

.bot-modal-body {
    padding: 10px 22px;
    overflow-y: auto;
    flex: 1;
}

.bot-modal-footer {
    padding: 15px 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.bot-stat-box {
    text-align: center;
}

.bot-stat-lbl {
    font-size: 10px;
    color: #64748b;
    font-weight: 700;
}

.bot-stat-val {
    font-size: 16px;
    font-weight: 900;
}