* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --secondary-color: #6366f1;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-bg: #0f172a;
    --card-bg: #1e293b;
    --card-bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    min-height: 100vh;
    padding: 16px;
    color: var(--text-primary);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

header h1 {
    font-size: 1.75rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.user-info {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.user-greeting {
    display: inline-block;
    color: var(--text-primary);
    font-size: 0.95rem;
    background: rgba(59, 130, 246, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.controls {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    border: 1px solid var(--border-color);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-group label,
.radio-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.control-group select {
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    background: var(--dark-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.control-group select:hover {
    border-color: var(--primary-color);
    background: var(--card-bg);
    transform: translateY(-2px);
}

.control-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.control-group select:focus-visible {
    outline: none;
}

.control-group select option {
    background: var(--dark-bg);
    color: var(--text-primary);
}

/* Radio buttons styling */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: var(--dark-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.radio-option:hover {
    border-color: var(--primary-color);
    background: var(--card-bg);
    transform: translateX(4px);
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.radio-option input[type="radio"]:focus {
    outline: none;
}

.radio-option input[type="radio"]:focus-visible ~ .radio-custom {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.radio-option:focus-within {
    outline: none;
}

.radio-option input[type="radio"]:disabled ~ .radio-custom {
    opacity: 0.5;
    cursor: not-allowed;
}

.radio-option input[type="radio"]:disabled {
    cursor: not-allowed;
}

.radio-option:has(input[type="radio"]:disabled) {
    cursor: not-allowed;
    opacity: 0.6;
}

.radio-option:has(input[type="radio"]:disabled):hover {
    transform: none;
    border-color: var(--border-color);
}

.radio-custom {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    margin-right: 14px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.radio-option input[type="radio"]:checked ~ .radio-custom {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.radio-option input[type="radio"]:checked ~ .radio-custom::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.radio-option input[type="radio"]:checked ~ .radio-text {
    color: var(--primary-color);
    font-weight: 600;
}

.radio-option:has(input[type="radio"]:checked) {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
}

.radio-text {
    font-size: 1.05rem;
    color: var(--text-primary);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.btn-primary:focus {
    outline: none;
}

.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3), 0 0 0 4px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
}

.btn-icon {
    font-size: 1.2rem;
}

.loading {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid var(--border-color);
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--danger-color);
    margin-bottom: 20px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.hidden {
    display: none !important;
}

.controls-hidden {
    display: none !important;
}

/* Auth error styling */
.auth-error-container {
    text-align: center;
    padding: 40px;
}

.auth-error-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.auth-error-title {
    color: #ef4444;
    margin-bottom: 16px;
    font-size: 1.5rem;
    font-weight: 600;
}

.auth-error-message {
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 12px;
}

.analysis-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.summary-card,
.market-conditions-card,
.scenarios-card,
.entry-points-card,
.warnings-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.summary-card h2,
.market-conditions-card h2,
.scenarios-card h2,
.entry-points-card h2,
.warnings-card h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.summary-card h2 {
    text-align: center;
    font-size: 1.6rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding: 16px;
    background: var(--dark-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.summary-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    border-color: var(--primary-color);
}

.summary-item .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.summary-item .value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.action-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem !important;
    font-weight: 700 !important;
}

.action-badge.buy {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.action-badge.sell {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.conditions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (min-width: 480px) {
    .conditions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .conditions-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.condition-item {
    text-align: center;
    padding: 20px;
    background: var(--dark-bg);
    border-radius: 12px;
    border: 2px solid var(--border-color);
}

.condition-item .label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.bullish { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.badge.bearish { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.badge.neutral { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.badge.high { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.badge.medium { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.badge.low { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.badge.positive { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.badge.negative { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

.scenario {
    background: var(--dark-bg);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    border-left: 4px solid var(--border-color);
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.scenario:hover {
    box-shadow: var(--shadow);
    transform: translateX(4px);
    background: var(--card-bg-hover);
}

.scenario.conservative {
    border-left-color: var(--success-color);
}

.scenario.moderate {
    border-left-color: var(--warning-color);
}

.scenario.aggressive {
    border-left-color: var(--danger-color);
}

.scenario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.scenario-type {
    display: flex;
    align-items: center;
    gap: 8px;
}

.scenario-icon {
    font-size: 1.5rem;
}

.scenario-type h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    text-transform: uppercase;
}

.probability {
    font-size: 1.5rem;
    font-weight: 700;
}

.probability.high { color: #6ee7b7; }
.probability.medium { color: #fcd34d; }
.probability.low { color: #fca5a5; }

.scenario-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-item .label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
}

.detail-item .value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.reasoning {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.reasoning h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.reasoning ul {
    list-style: none;
    padding: 0;
}

.reasoning li {
    padding: 6px 0 6px 24px;
    position: relative;
    color: var(--text-primary);
    line-height: 1.5;
}

.reasoning li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #93c5fd;
    font-weight: bold;
}

.entry-point {
    background: var(--dark-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    align-items: center;
    border: 2px solid var(--border-color);
    transition: all 0.2s;
}

.entry-point:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
    background: var(--card-bg-hover);
}

.entry-number {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.entry-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.entry-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.entry-reasoning {
    color: var(--text-secondary);
    line-height: 1.4;
}

.entry-allocation {
    text-align: center;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.1rem;
}

.warnings-card {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.warnings-card h2 {
    color: #fcd34d;
}

#warnings-list {
    list-style: none;
    padding: 0;
}

#warnings-list li {
    padding: 12px 0;
    border-bottom: 1px solid rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

#warnings-list li:last-child {
    border-bottom: none;
}

footer {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    opacity: 0.8;
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    header {
        padding: 16px;
        margin-bottom: 16px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }
    
    .controls {
        padding: 20px;
        margin-bottom: 16px;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .summary-card,
    .market-conditions-card,
    .scenarios-card,
    .entry-points-card,
    .warnings-card {
        padding: 16px;
    }

    .summary-card h2 {
        font-size: 1.35rem;
    }

    .market-conditions-card h2,
    .scenarios-card h2,
    .entry-points-card h2,
    .warnings-card h2 {
        font-size: 1.25rem;
    }
    
    .scenario-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .entry-point {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 12px;
    }
    
    .entry-allocation {
        justify-self: center;
        width: 100%;
    }

    .radio-option {
        padding: 14px 16px;
    }

    .radio-text {
        font-size: 1rem;
    }
}
