/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0d1421 0%, #1a1f2e 50%, #16213e 100%);
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(45deg, #00e676, #00bcd4, #03a9f4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #4caf50;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Main Panel */
.main-panel {
    flex: 1;
    padding: 20px;
}

.panel-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Input Groups */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-row {
    display: flex;
    gap: 12px;
}

.input-row .input-group {
    flex: 1;
}

.input-label {
    font-size: 14px;
    font-weight: 500;
    color: #b0bec5;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.select-input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 16px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

.select-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: #00e676;
    box-shadow: 0 0 0 2px rgba(0, 230, 118, 0.2);
}

/* Analyze Button */
.analyze-btn {
    background: linear-gradient(135deg, #00e676 0%, #00bcd4 100%);
    border: none;
    border-radius: 16px;
    padding: 20px;
    color: white;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 24px rgba(0, 230, 118, 0.3);
    position: relative;
    overflow: hidden;
}

.analyze-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.analyze-btn:hover::before {
    left: 100%;
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 230, 118, 0.4);
}

.analyze-btn:active {
    transform: translateY(0);
}

.analyze-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 20px;
}

/* Loading Animation */
.loading-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #00e676;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    color: #00e676;
    font-weight: 500;
}

/* Error Container */
.error-container {
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
    border-radius: 12px;
    padding: 16px;
    color: #ff5722;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Signal Display */
.signal-display {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
}

.signal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.signal-header h3 {
    font-size: 16px;
    color: #b0bec5;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.signal-time {
    font-size: 12px;
    color: #78909c;
}

.signal-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.signal-value {
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 3px;
    transition: all 0.3s ease;
}

.signal-value.buy {
    color: #00e676;
    text-shadow: 0 0 20px rgba(0, 230, 118, 0.5);
    animation: pulse-green 2s infinite;
}

.signal-value.sell {
    color: #ff5722;
    text-shadow: 0 0 20px rgba(255, 87, 34, 0.5);
    animation: pulse-red 2s infinite;
}

.signal-value.ready {
    color: #90a4ae;
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

.signal-reason {
    font-size: 14px;
    color: #b0bec5;
    font-style: italic;
    line-height: 1.4;
}

/* Confidence Section */
.confidence-section {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.confidence-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: #b0bec5;
}

.confidence-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff5722 0%, #ff9800 50%, #00e676 100%);
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

/* Technical Indicators */
.indicators-section {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.indicators-section h4 {
    font-size: 16px;
    color: #b0bec5;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.indicators-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.indicator-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.indicator-label {
    font-size: 12px;
    color: #78909c;
    text-transform: uppercase;
}

.indicator-value {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

/* Signal History */
.history-section {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.history-section h4 {
    font-size: 16px;
    color: #b0bec5;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.signal-history {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.empty-history {
    text-align: center;
    color: #666;
    padding: 20px;
    font-style: italic;
}

.signal-log {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.signal-log:hover {
    background: rgba(255, 255, 255, 0.08);
}

.signal-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.signal-log-time {
    font-size: 12px;
    color: #78909c;
}

.signal-log-result {
    font-size: 14px;
    font-weight: 600;
}

.signal-log.buy .signal-log-result {
    color: #00e676;
}

.signal-log.sell .signal-log-result {
    color: #ff5722;
}

.signal-log-confidence {
    font-size: 12px;
    color: #b0bec5;
}

/* Market Data Section */
.market-data-section {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.market-data-section h4 {
    font-size: 16px;
    color: #b0bec5;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.market-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.market-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.market-label {
    font-size: 14px;
    color: #78909c;
}

.market-value {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    text-align: center;
    margin-top: auto;
}

.footer p {
    font-size: 12px;
    color: #78909c;
}

/* Scrollbar Styling */
.signal-history::-webkit-scrollbar {
    width: 4px;
}

.signal-history::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.signal-history::-webkit-scrollbar-thumb {
    background: rgba(0, 230, 118, 0.3);
    border-radius: 2px;
}

.signal-history::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 230, 118, 0.5);
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        max-width: 100%;
    }
    
    .header {
        padding: 16px;
    }
    
    .main-panel {
        padding: 16px;
    }
    
    .logo {
        font-size: 20px;
    }
    
    .input-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .signal-value {
        font-size: 32px;
    }
    
    .analyze-btn {
        padding: 18px;
        font-size: 16px;
    }
    
    .indicators-grid {
        grid-template-columns: 1fr;
    }
}

/* PWA Styles */
@media (display-mode: standalone) {
    .header {
        padding-top: 40px; /* Account for status bar */
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #0a0e1a 0%, #1a1f2e 50%, #16213e 100%);
    }
}