/* ========================================
   Aviator AI Interface
   ======================================== */

#aviator-ai-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    z-index: 100001;
    background: linear-gradient(180deg, #0a0a0f 0%, #0f0f1a 50%, #0a0a0f 100%);
    display: flex;
    flex-direction: column;
    font-family: 'Outfit', -apple-system, sans-serif;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

#aviator-ai-screen.slide-down {
    transform: translateY(100%);
}

/* Header */
.ai-header {
    padding: 16px 20px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.ai-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-logo-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #f5a623, #ff8c00);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #0a0a0f;
}

.ai-header-title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.ai-header-title span {
    color: #f5a623;
}

.ai-clock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: #f5a623;
    text-shadow: 0 0 10px rgba(245, 166, 35, 0.4);
}

/* Candle History Strip */
.ai-candles-section {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.ai-candles-label {
    padding: 0 20px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.35);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-candles-strip {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ai-candles-strip::-webkit-scrollbar {
    display: none;
}

.ai-candle {
    flex-shrink: 0;
    padding: 5px 10px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255,255,255,0.04);
    white-space: nowrap;
    transition: transform 0.2s;
}

.ai-candle.purple {
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.25);
    text-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
}

.ai-candle.pink {
    color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.25);
    text-shadow: 0 0 8px rgba(236, 72, 153, 0.3);
}

.ai-candle.blue {
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.15);
}

/* Status Bar */
.ai-status-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.ai-status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
}

.ai-status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

.ai-status-dot.green { background: #00e676; box-shadow: 0 0 6px #00e676; }
.ai-status-dot.yellow { background: #ffab40; box-shadow: 0 0 6px #ffab40; }
.ai-status-dot.red { background: #ff5252; box-shadow: 0 0 6px #ff5252; }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Main Content */
.ai-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    gap: 20px;
    min-height: 0;
}

/* Aviator Icon */
.ai-aviator-icon {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, #1a1a2e, #2a2a45);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(245, 166, 35, 0.2);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    position: relative;
    overflow: hidden;
}

.ai-aviator-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(245, 166, 35, 0.08));
    border-radius: 20px;
}

.ai-aviator-icon i {
    font-size: 36px;
    color: #ff5252;
    z-index: 1;
}

.ai-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    text-align: center;
}

.ai-subtitle {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    text-align: center;
    line-height: 1.5;
    max-width: 300px;
}

/* Operate Button */
.ai-operate-btn {
    width: 100%;
    max-width: 320px;
    padding: 16px 32px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #f5a623, #ff8c00);
    color: #0a0a0f;
    font-size: 1.1rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 24px rgba(245, 166, 35, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-operate-btn:active {
    transform: scale(0.97);
}

/* Analysis Section */
.ai-analysis {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 360px;
}

.ai-analysis.active {
    display: flex;
}

.ai-analysis-step {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s, transform 0.4s;
}

.ai-analysis-step.show {
    opacity: 1;
    transform: translateY(0);
}

.ai-analysis-step .step-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.ai-analysis-step .step-icon.loading {
    background: rgba(245, 166, 35, 0.1);
    color: #f5a623;
    animation: spin-icon 1s linear infinite;
}

.ai-analysis-step .step-icon.done {
    background: rgba(0, 230, 118, 0.1);
    color: #00e676;
}

@keyframes spin-icon {
    to { transform: rotate(360deg); }
}

.ai-analysis-step .step-text {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
}

.ai-analysis-step .step-text.done {
    color: #00e676;
}

/* Result Card */
.ai-result-card {
    display: none;
    width: 100%;
    max-width: 360px;
    background: linear-gradient(145deg, #1a1a2e 0%, #12121a 100%);
    border: 1px solid rgba(245, 166, 35, 0.2);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    animation: fadeScaleIn 0.5s ease;
}

.ai-result-card.active {
    display: block;
}

@keyframes fadeScaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.ai-result-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(245, 166, 35, 0.12), rgba(255, 140, 0, 0.06));
    border-bottom: 1px solid rgba(245, 166, 35, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-result-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f5a623;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-result-precision {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(0, 230, 118, 0.1);
    color: #00e676;
    border: 1px solid rgba(0, 230, 118, 0.2);
}

.ai-result-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255,255,255,0.02);
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.04);
}

.ai-result-row .label {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-result-row .value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
}

.ai-result-row .value.green { color: #00e676; }
.ai-result-row .value.purple { color: #a855f7; }
.ai-result-row .value.pink { color: #ec4899; }
.ai-result-row .value.gold { color: #f5a623; }

.ai-result-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    text-align: center;
}

.ai-result-footer p {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.3);
}

/* New analysis button */
.ai-new-btn {
    width: 100%;
    max-width: 360px;
    padding: 14px;
    border: 1px solid rgba(245, 166, 35, 0.3);
    border-radius: 12px;
    background: rgba(245, 166, 35, 0.08);
    color: #f5a623;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.ai-new-btn.active {
    display: flex;
}

.ai-new-btn:active {
    background: rgba(245, 166, 35, 0.15);
}

/* Bottom pull-up button (visible when iframe is showing) */
#ai-pull-up-btn {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100002;
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 0 0 env(safe-area-inset-bottom, 8px);
    background: linear-gradient(0deg, #0a0a0f 60%, transparent);
    pointer-events: auto;
}

#ai-pull-up-btn.active {
    display: flex;
}

.pull-up-handle {
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    margin-bottom: 8px;
}

.pull-up-inner {
    width: 90%;
    max-width: 400px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #f5a623, #ff8c00);
    border-radius: 14px 14px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 -4px 20px rgba(245, 166, 35, 0.3);
}

.pull-up-inner span {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0a0a0f;
    font-family: 'Outfit', sans-serif;
}

.pull-up-inner i {
    font-size: 14px;
    color: #0a0a0f;
}

#ai-pull-up-btn.blink .pull-up-inner {
    animation: blink-btn 1s ease-in-out infinite;
}

@keyframes blink-btn {
    0%, 100% { opacity: 1; box-shadow: 0 -4px 20px rgba(245, 166, 35, 0.3); }
    50% { opacity: 0.6; box-shadow: 0 -4px 30px rgba(245, 166, 35, 0.6); }
}

/* Candle type selector */
.ai-candle-selector {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 360px;
}

.ai-candle-selector.active {
    display: flex;
}

.ai-candle-selector p {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    text-align: center;
}

.ai-candle-btns {
    display: flex;
    gap: 12px;
    width: 100%;
}

.ai-candle-btn {
    flex: 1;
    padding: 16px;
    border-radius: 14px;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: 'Outfit', sans-serif;
}

.ai-candle-btn.purple-btn {
    background: rgba(168, 85, 247, 0.08);
    border-color: rgba(168, 85, 247, 0.3);
    color: #a855f7;
}

.ai-candle-btn.purple-btn:active {
    background: rgba(168, 85, 247, 0.2);
}

.ai-candle-btn.pink-btn {
    background: rgba(236, 72, 153, 0.08);
    border-color: rgba(236, 72, 153, 0.3);
    color: #ec4899;
}

.ai-candle-btn.pink-btn:active {
    background: rgba(236, 72, 153, 0.2);
}

.ai-candle-btn .candle-btn-icon {
    font-size: 28px;
}

.ai-candle-btn .candle-btn-label {
    font-size: 0.9rem;
    font-weight: 700;
}

.ai-candle-btn .candle-btn-range {
    font-size: 0.7rem;
    opacity: 0.6;
    font-family: 'JetBrains Mono', monospace;
}

/* Botão "Ver Aviator" no seletor de velas */
.ai-view-game-btn {
    width: 100%;
    padding: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
    margin-top: 4px;
}

.ai-view-game-btn:active {
    background: rgba(255,255,255,0.08);
}

/* Botão "Fazer Entrada no Aviator" após resultado */
.ai-go-game-btn {
    display: none;
    width: 100%;
    max-width: 360px;
    padding: 16px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #f5a623, #ff8c00);
    color: #0a0a0f;
    font-size: 1rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 24px rgba(245, 166, 35, 0.4);
    transition: transform 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-go-game-btn.active {
    display: flex;
}

.ai-go-game-btn:active {
    transform: scale(0.97);
}

/* Responsive */
@media (max-height: 600px) {
    .ai-aviator-icon { width: 60px; height: 60px; }
    .ai-aviator-icon i { font-size: 28px; }
    .ai-title { font-size: 1.2rem; }
    .ai-main { padding: 16px 20px; gap: 14px; }
}
