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

body {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', monospace;
    line-height: 1.6;
    color: #2d3748;
    background: #f7fafc;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
    color: #1a202c;
    font-weight: 300;
    letter-spacing: -0.02em;
}

header p {
    font-size: 1rem;
    color: #718096;
    font-weight: 400;
}

#changeApiKey {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 0.85rem;
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #4a5568;
}

#changeApiKey:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

/* Modal Styles */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 40px;
    border: 1px solid #e2e8f0;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #1a202c;
    font-weight: 400;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin: 20px 0;
    border: 1px solid #e2e8f0;
    font-family: inherit;
    font-size: 0.9rem;
    background: #f7fafc;
}

.modal-content input:focus {
    outline: none;
    border-color: #4299e1;
    background: white;
}

.api-help {
    margin-top: 15px;
}

.api-help a {
    color: #4299e1;
    text-decoration: none;
}

.api-help a:hover {
    text-decoration: underline;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    background: white;
    color: #4a5568;
}

.btn-primary {
    background: #1a202c;
    color: white;
    border-color: #1a202c;
}

.btn-primary:hover {
    background: #2d3748;
    border-color: #2d3748;
}

.btn-success {
    background: #38a169;
    color: white;
    border-color: #38a169;
}

.btn-success:hover {
    background: #2f855a;
    border-color: #2f855a;
}

.btn-secondary {
    background: #718096;
    color: white;
    border-color: #718096;
}

.btn-secondary:hover {
    background: #4a5568;
    border-color: #4a5568;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Upload Section */
.upload-section {
    margin-bottom: 40px;
}

.upload-area {
    border: 2px dashed #cbd5e0;
    padding: 60px 20px;
    text-align: center;
    background: white;
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #a0aec0;
    background: #f7fafc;
}

.upload-area.dragover {
    border-color: #4299e1;
    background: #ebf8ff;
}

.upload-content {
    color: #4a5568;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.upload-content h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-weight: 400;
}

.upload-content p {
    margin-bottom: 20px;
    color: #718096;
}

/* File Info Section */
.file-info-section {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 30px;
    margin-bottom: 40px;
}

.file-info {
    margin-bottom: 30px;
}

.file-info h3 {
    margin-bottom: 20px;
    color: #1a202c;
    font-weight: 400;
}

.file-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.info-item {
    background: #f7fafc;
    padding: 15px;
    border: 1px solid #edf2f7;
}

.info-label {
    font-weight: 400;
    color: #718096;
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.info-value {
    font-size: 1rem;
    color: #1a202c;
    font-weight: 500;
}

.preview-container h4 {
    margin-bottom: 15px;
    color: #1a202c;
    font-weight: 400;
}

/* Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
}

.data-table th {
    background: #f7fafc;
    font-weight: 500;
    color: #4a5568;
}

.data-table tr:nth-child(even) {
    background: #f7fafc;
}

.data-table tr:hover {
    background: #edf2f7;
}

/* Control Section */
.control-section {
    text-align: center;
    margin-bottom: 40px;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Loading Indicator */
.loading {
    text-align: center;
    padding: 40px;
    background: white;
    border: 1px solid #e2e8f0;
    margin-bottom: 40px;
}

.spinner {
    border: 2px solid #edf2f7;
    border-top: 2px solid #4299e1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

#loadingText {
    color: #718096;
    font-size: 0.9rem;
}

/* Code Section */
.code-section {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 30px;
    margin-bottom: 40px;
}

.code-section h3 {
    margin-bottom: 20px;
    color: #1a202c;
    font-weight: 400;
}

.code-container {
    background: #1a202c;
    border: 1px solid #2d3748;
    overflow: auto;
    max-height: 500px;
}

.code-container pre {
    margin: 0;
    padding: 20px;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* Results Section */
.results-section {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 30px;
    margin-bottom: 40px;
}

.results-section h3 {
    margin-bottom: 20px;
    color: #1a202c;
    font-weight: 400;
}

.result-item {
    margin-bottom: 30px;
    padding: 20px;
    background: #f7fafc;
    border: 1px solid #edf2f7;
    border-left: 4px solid #4299e1;
}

.result-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 15px;
    color: #1a202c;
}

.result-content {
    overflow: auto;
}

.result-content pre {
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #2d3748;
    white-space: pre-wrap;
    margin: 0;
}

/* Plot Container */
.plot-container {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 15px;
    margin-top: 15px;
}

.plot-container img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.inline-plot {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 15px auto;
    border: 1px solid #e2e8f0;
}

/* Error Container */
.error-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.error-message {
    background: #e53e3e;
    color: white;
    padding: 15px 20px;
    border: 1px solid #c53030;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    font-size: 0.9rem;
}

.error-icon {
    font-size: 1rem;
}

.close-error {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: auto;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-error:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .upload-area {
        padding: 40px 15px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 250px;
    }
    
    #changeApiKey {
        position: static;
        margin-top: 15px;
    }
    
    .file-info-grid {
        grid-template-columns: 1fr;
    }
    
    .error-container {
        right: 10px;
        left: 10px;
    }
    
    .error-message {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 30px 20px;
    }
    
    .code-container pre {
        font-size: 0.8rem;
        padding: 15px;
    }
    
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

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

::-webkit-scrollbar-track {
    background: #edf2f7;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
} 