/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
    min-height: 100vh;
    line-height: 1.6;
}

/* Header */
header {
    text-align: center;
    padding: 2rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: #888;
    font-size: 1rem;
}

/* Main Layout */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Section Styles */
section {
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

section h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

/* Upload Section */
.upload-section {
    text-align: center;
}

.upload-container {
    margin-top: 1rem;
}

.file-input {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    padding: 1rem;
    border: 2px dashed rgba(79, 172, 254, 0.5);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: #888;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input:hover,
.file-input:focus {
    border-color: #4facfe;
    color: #fff;
    outline: none;
}

.hint {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #666;
}

/* Config Section */
.config-section {
    margin-top: 2rem;
}

.config-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    color: #aaa;
}

.form-group select,
.form-group input {
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 1rem;
}

.form-group select:focus,
.form-group input:focus {
    border-color: #4facfe;
    outline: none;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 0.5rem;
}

.stat-value.positive {
    color: #4caf50;
}

.stat-value.negative {
    color: #f44336;
}

.stat-label {
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Chart Section */
.chart-section {
    margin-top: 2rem;
    min-height: 400px;
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}

/* Loading Section */
.loading-section {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loader {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #4facfe;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loadingText {
    color: #888;
}

/* Error Section */
.error-section {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid #f44336;
    padding: 1.5rem 2rem;
    border-radius: 8px;
    text-align: center;
}

.error-message {
    color: #f44336;
}

#errorMessage {
    display: block;
    margin-bottom: 1rem;
}

#retryBtn {
    padding: 0.5rem 1rem;
    background: #f44336;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

#retryBtn:hover {
    background: #d32f2f;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 1rem;
    }

    .config-container,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 300px;
    }
}

/* Stock Details Section */
.stock-details-section {
    margin-top: 2rem;
    max-height: 300px;
    overflow-y: auto;
}

.stock-details-section table {
    width: 100%;
    border-collapse: collapse;
}

.stock-details-section th,
.stock-details-section td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stock-details-section th {
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    color: #888;
}

.stock-details-section tr:hover {
    background: rgba(255, 255, 255, 0.02);
}
