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

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: #1f1f1f;
    --bg-hover: #2a2a2a;
    --accent-primary: #00d4ff;
    --accent-secondary: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #6b6b6b;
    --border-color: #2a2a2a;
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-primary);
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(0, 212, 255, 0.05) 0%, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 0;
    overflow-x: hidden;
    position: relative;
}

/* Efeito de partículas no fundo */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, rgba(0, 212, 255, 0.3), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(124, 58, 237, 0.3), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.2), transparent);
    background-size: 200% 200%;
    animation: particleMove 20s ease infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes particleMove {
    0%, 100% { background-position: 0% 0%, 100% 100%, 50% 50%; }
    50% { background-position: 100% 0%, 0% 100%, 50% 50%; }
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 30px 20px;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 50px;
    padding: 40px 0 30px;
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: 2px;
    box-shadow: var(--shadow-glow);
}

.logo-container {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo {
    width: 80px;
    height: 80px;
    animation: logoFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(0, 212, 255, 0.4));
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}

h1 {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 10px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    animation: fadeInDown 0.6s ease;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 0.5px;
    animation: fadeInDown 0.8s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading */
.loading {
    text-align: center;
    padding: 80px 20px;
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 30px;
    border: 4px solid var(--bg-secondary);
    border-top: 4px solid var(--accent-primary);
    border-right: 4px solid var(--accent-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: var(--shadow-glow);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-size: 16px;
}

.hidden {
    display: none !important;
}

/* Steps */
.step {
    display: none;
    animation: fadeInUp 0.5s ease;
}

.step.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step {
    position: relative;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 25px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.back-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateX(-3px);
}

.back-btn:active {
    transform: translateX(-1px);
}

.back-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.step h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 30px;
    text-align: center;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Brokers Grid */
.brokers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.broker-btn {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 25px 15px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    letter-spacing: 0.5px;
}

.broker-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--accent-gradient);
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 0;
}

.broker-btn:hover::before {
    left: 0;
    opacity: 0.15;
}

.broker-btn:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--accent-primary);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.5),
        var(--shadow-glow);
    background: var(--bg-hover);
}

.broker-btn:active {
    transform: translateY(-2px) scale(1);
}

.broker-btn span {
    position: relative;
    z-index: 1;
}

/* Analysis Options */
.analysis-options {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 30px;
}

.analysis-btn {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 35px 30px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    width: 100%;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.analysis-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.analysis-btn:hover::before {
    opacity: 0.1;
}

.analysis-btn:hover {
    transform: translateY(-8px);
    border-color: var(--accent-primary);
    box-shadow: 
        0 16px 48px rgba(0, 0, 0, 0.6),
        var(--shadow-glow);
    background: var(--bg-hover);
}

.analysis-btn:active {
    transform: translateY(-4px);
}

.analysis-btn .icon {
    font-size: 64px;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 212, 255, 0.3));
    animation: iconFloat 3s ease-in-out infinite;
}

.analysis-btn:nth-child(2) .icon {
    animation-delay: 0.5s;
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.analysis-btn h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.analysis-btn p {
    font-size: 15px;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
    line-height: 1.6;
}

.analysis-btn:hover p {
    color: var(--text-primary);
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 60px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 13px;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

/* Debug mode (fora do Telegram) */
body:not(.telegram-web-app) {
    background: var(--bg-primary);
}

body:not(.telegram-web-app) .container {
    background: transparent;
}

/* Animações de entrada */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.broker-btn {
    animation: slideIn 0.5s ease backwards;
}

.broker-btn:nth-child(1) { animation-delay: 0.1s; }
.broker-btn:nth-child(2) { animation-delay: 0.2s; }
.broker-btn:nth-child(3) { animation-delay: 0.3s; }
.broker-btn:nth-child(4) { animation-delay: 0.4s; }
.broker-btn:nth-child(5) { animation-delay: 0.5s; }
.broker-btn:nth-child(6) { animation-delay: 0.6s; }
.broker-btn:nth-child(7) { animation-delay: 0.7s; }
.broker-btn:nth-child(8) { animation-delay: 0.8s; }
.broker-btn:nth-child(9) { animation-delay: 0.9s; }
.broker-btn:nth-child(10) { animation-delay: 1.0s; }
.broker-btn:nth-child(11) { animation-delay: 1.1s; }
.broker-btn:nth-child(12) { animation-delay: 1.2s; }

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Mobile First - 100% focado em celular */
.container {
    padding: 20px 15px;
    max-width: 100%;
}

header {
    padding: 30px 0 25px;
    margin-bottom: 40px;
}

.logo {
    width: 70px;
    height: 70px;
}

h1 {
    font-size: 36px;
}

.back-btn {
    padding: 10px 18px;
    font-size: 14px;
    margin-bottom: 20px;
}

.subtitle {
    font-size: 15px;
}

.step h2 {
    font-size: 24px;
    margin-bottom: 25px;
}

/* Grid de corretoras - 2 colunas no mobile */
.brokers-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.broker-btn {
    padding: 22px 12px;
    font-size: 14px;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Botões de análise - otimizados para touch */
.analysis-options {
    gap: 20px;
}

.analysis-btn {
    padding: 30px 20px;
    min-height: 180px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.analysis-btn .icon {
    font-size: 56px;
    margin-bottom: 12px;
}

.analysis-btn h3 {
    font-size: 22px;
    margin-bottom: 10px;
}

.analysis-btn p {
    font-size: 14px;
    line-height: 1.5;
}

/* Melhorar área de toque */
button, .broker-btn, .analysis-btn {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 212, 255, 0.2);
    user-select: none;
    -webkit-user-select: none;
}

/* Safe area para iPhone X e superiores */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
    
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Otimizações para telas pequenas */
@media (max-width: 480px) {
    h1 {
        font-size: 32px;
    }
    
    .step h2 {
        font-size: 22px;
    }
    
    .broker-btn {
        padding: 20px 10px;
        font-size: 13px;
        min-height: 65px;
    }
    
    .analysis-btn {
        padding: 25px 18px;
        min-height: 170px;
    }
    
    .analysis-btn .icon {
        font-size: 48px;
    }
}

/* Landscape mode */
@media (max-height: 500px) and (orientation: landscape) {
    header {
        padding: 20px 0 15px;
        margin-bottom: 25px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .brokers-grid {
        gap: 12px;
    }
    
    .broker-btn {
        padding: 15px 10px;
        min-height: 60px;
    }
}

/* Form Groups */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* Timeframe Buttons */
.timeframe-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.timeframe-btn {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 15px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.timeframe-btn:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.timeframe-btn.active {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* Market Buttons */
.market-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.market-btn {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 15px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.market-btn:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.market-btn.active {
    background: var(--accent-gradient);
    border-color: var(--accent-primary);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* Input Field */
.input-field {
    width: 100%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 15px 18px;
    font-size: 16px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.input-field::placeholder {
    color: var(--text-muted);
}

/* Primary Button */
.btn-primary {
    background: var(--accent-gradient);
    border: none;
    border-radius: 12px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(0, 212, 255, 0.4),
        var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Signal Result */
.signal-result {
    text-align: center;
    padding: 20px 0;
}

.signal-info {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
}

.info-item .label {
    color: var(--text-secondary);
    font-size: 14px;
}

.info-item .value {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

/* Chart Container */
.chart-container {
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.chart-container img {
    width: 100%;
    height: auto;
    display: block;
}

/* Monitoring Message */
.monitoring-message {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-top: 20px;
}

.monitoring-message p {
    color: var(--text-secondary);
    margin: 5px 0;
}

/* Signal Result Final */
.signal-result-final {
    text-align: center;
    padding: 20px 0;
}

.result-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* No Opportunity */
.no-opportunity {
    text-align: center;
    padding: 40px 20px;
}

.no-opportunity h2 {
    color: var(--text-primary);
    margin: 20px 0;
}

/* Progress Message */
.progress-message {
    color: var(--text-primary);
    font-size: 16px;
    text-align: center;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 2px solid var(--border-color);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.5s ease, pulseGlow 2s ease-in-out infinite;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.2);
}

.progress-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.1), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(0, 212, 255, 0.2);
        border-color: var(--border-color);
    }
    50% {
        box-shadow: 0 4px 30px rgba(0, 212, 255, 0.4);
        border-color: rgba(0, 212, 255, 0.5);
    }
}

/* Animação de typing para mensagens */
.progress-message.typing {
    animation: fadeInUp 0.5s ease, pulseGlow 2s ease-in-out infinite, typing 0.5s ease;
}

@keyframes typing {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading spinner animado */
.progress-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 212, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

.progress-text {
    display: inline-block;
    vertical-align: middle;
}

/* Barra de progresso */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 10px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: progressShine 1.5s infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
