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

:root {
    --primary-color: #1DA1F2;
    --secondary-color: #E1306C;
    --success-color: #10B981;
    --error-color: #EF4444;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Card Sections */
.upload-section, .progress-section, .results-section, .error-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 800px;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Platform Selector */
.platform-selector {
    margin-bottom: 30px;
}

.platform-selector h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.platform-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.platform-option input[type="radio"] {
    display: none;
}

.platform-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.platform-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.platform-option input[type="radio"]:checked + .platform-card {
    border-color: var(--primary-color);
    background-color: rgba(29, 161, 242, 0.05);
}

.platform-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.platform-name {
    font-weight: 600;
    color: var(--text-primary);
}

/* File Upload Area */
.file-upload-area {
    margin-bottom: 30px;
}

#csvFile {
    display: none;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 60px 40px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: var(--bg-color);
}

.file-upload-label:hover {
    border-color: var(--primary-color);
    background-color: rgba(29, 161, 242, 0.02);
}

.file-upload-label.has-file {
    border-color: var(--success-color);
    background-color: rgba(16, 185, 129, 0.05);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.upload-text {
    text-align: center;
}

.upload-text strong {
    display: block;
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.upload-text small {
    color: var(--text-secondary);
}

.file-name {
    margin-top: 15px;
    color: var(--success-color);
    font-weight: 600;
    display: none;
}

.file-name.show {
    display: block;
}

/* Buttons */
.analyze-button, .download-button, .reset-button {
    padding: 14px 32px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.analyze-button {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), #1a8cd8);
    color: white;
    justify-content: center;
    position: relative;
}

.analyze-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(29, 161, 242, 0.3);
}

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

.analyze-button.loading .button-text {
    visibility: hidden;
}

.button-loader {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

.analyze-button.loading .button-loader {
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.download-button {
    background-color: var(--success-color);
    color: white;
}

.download-button:hover {
    background-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.3);
}

.download-icon {
    width: 20px;
    height: 20px;
}

.reset-button {
    background-color: var(--bg-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.reset-button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Progress Section */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-message {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.log-container {
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.log-container h4 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.log-content {
    background-color: var(--bg-color);
    border-radius: 6px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    max-height: 200px;
    overflow-y: auto;
    color: var(--text-secondary);
}

.log-entry {
    margin-bottom: 5px;
    padding: 2px 0;
}

/* Results Section */
.results-info {
    margin-bottom: 30px;
    text-align: center;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background-color: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.results-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
}

.results-preview {
    margin-top: 30px;
}

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--bg-color);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
}

td {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

tr:hover {
    background-color: rgba(29, 161, 242, 0.02);
}

/* Error Section */
.error-section {
    text-align: center;
}

.error-section h3 {
    color: var(--error-color);
    margin-bottom: 20px;
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 0 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .upload-section, .progress-section, .results-section, .error-section {
        padding: 25px;
    }
    
    .platform-options {
        grid-template-columns: 1fr;
    }
    
    .results-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .results-actions button {
        width: 100%;
    }
}
