* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    padding: 30px;
}

section {
    margin-bottom: 40px;
}

h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8em;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

h3 {
    color: #764ba2;
    margin: 20px 0 10px 0;
    font-size: 1.3em;
}

h4 {
    color: #555;
    margin: 10px 0;
    font-size: 1.1em;
}

.upload-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 1.05em;
}

.help-text {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

.form-group select,
.form-group input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

/* Hide default file input */
.custom-file-upload input[type="file"] {
    display: none;
}

.custom-file-upload {
    position: relative;
}

.file-upload-label {
    display: flex;
    align-items: center;
    width: 100%;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s;
    min-height: 52px;
}

.file-upload-label:hover {
    border-color: #667eea;
}

.file-upload-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 30px;
    font-weight: 600;
    font-size: 1.1em;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-upload-button:hover {
    background: linear-gradient(135deg, #7b8fed 0%, #8b5bb5 100%);
}

.file-upload-text {
    flex: 1;
    padding: 16px 20px;
    background: white;
    color: #666;
    font-size: 1em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.form-group select:focus,
.form-group input[type="file"]:focus {
    outline: none;
    border-color: #667eea;
}

.file-info {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.file-info p {
    margin-bottom: 8px;
    color: #555;
}

.file-info ul {
    list-style-position: inside;
    color: #666;
    line-height: 1.6;
}

.file-info li {
    margin: 5px 0;
}

.auto-detect-note {
    margin-top: 12px;
    padding: 10px;
    background: #f0f7ff;
    border-left: 3px solid #4CAF50;
    border-radius: 4px;
    color: #2c5f2d;
    font-size: 0.95em;
}

.note {
    margin-top: 8px;
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

.btn-primary,
.btn-secondary {
    padding: 14px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
    margin: 5px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

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

.example-section {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px dashed #ddd;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.example-section .btn-secondary {
    flex: 0 1 auto;
    min-width: 200px;
}

.result-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s;
}

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

.data-info {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #764ba2;
}

.data-info ul {
    list-style-position: inside;
    color: #666;
    line-height: 1.8;
}

.plot-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-buttons {
    text-align: center;
    margin-top: 20px;
}

.error-section {
    background: #fff3f3;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.error-message {
    color: #c0392b;
    font-weight: 600;
    font-size: 1.1em;
}

footer {
    background: #f8f9fa;
    padding: 30px;
    border-top: 3px solid #eee;
}

.info-section ol {
    margin-left: 20px;
    line-height: 1.8;
    color: #666;
}

.format-examples {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.format-box {
    flex: 1;
    min-width: 280px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #eee;
}

.format-box pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.5;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 1em;
    }

    main {
        padding: 20px;
    }

    .upload-section,
    .result-section {
        padding: 20px;
    }

    .format-examples {
        flex-direction: column;
    }

    .action-buttons .btn-secondary {
        display: block;
        width: 100%;
        margin: 5px 0;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* Analysis section styles */
.analysis-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 10px;
}

.tab-button {
    padding: 12px 24px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    color: #555;
    transition: all 0.3s ease;
    border-bottom: none;
    margin-bottom: -2px;
}

.tab-button:hover {
    background: #f0f0f0;
    border-color: #667eea;
}

.tab-button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.tab-content {
    display: none;
    padding: 20px;
    background: white;
    border-radius: 10px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stats-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stats-table th,
.stats-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.stats-table th {
    font-weight: 600;
    font-size: 1em;
}

.stats-table tbody tr:hover {
    background: #f5f5f5;
}

.stats-table tbody tr.significant {
    background: #fff3cd;
}

.stats-table tbody tr.significant:hover {
    background: #ffeaa7;
}

.note {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    border-radius: 4px;
}

.extraction-method {
    margin-top: 15px;
    padding: 10px;
    background: #e8f4f8;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.extraction-method summary {
    cursor: pointer;
    color: #667eea;
    font-weight: 600;
    padding: 5px;
    list-style: none;
}

.extraction-method summary::-webkit-details-marker {
    display: none;
}

.extraction-method summary::before {
    content: '▶ ';
    display: inline-block;
    transition: transform 0.3s;
}

.extraction-method[open] summary::before {
    transform: rotate(90deg);
}

.method-details {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 5px;
    line-height: 1.6;
}

.method-details ol {
    margin-left: 20px;
    margin-top: 10px;
}

.method-details li {
    margin-bottom: 8px;
}

.method-details strong {
    color: #764ba2;
}

.note-box {
    margin-top: 15px;
    padding: 10px;
    background: #fff9e6;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    font-size: 0.95em;
}
