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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    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;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

.messages {
    padding: 20px 40px;
}

.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.alert-error {
    background-color: #fee;
    border-left: 4px solid #c33;
    color: #c33;
}

.alert-success {
    background-color: #efe;
    border-left: 4px solid #3c3;
    color: #3c3;
}

.upload-section {
    padding: 40px;
}

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

.file-label {
    display: block;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-input-wrapper {
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    transition: all 0.3s ease;
    background: #f8f9ff;
}

.file-label:hover .file-input-wrapper {
    border-color: #764ba2;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.file-label.drag-over .file-input-wrapper {
    border-color: #764ba2;
    background: #e8ebff;
    transform: scale(1.02);
}

.file-input-wrapper svg {
    color: #667eea;
    margin-bottom: 20px;
}

.file-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.file-subtext {
    font-size: 0.95rem;
    color: #666;
}

input[type="file"] {
    display: none;
}

.file-name {
    margin-top: 15px;
    padding: 12px 20px;
    background: #e8f5e9;
    border-radius: 8px;
    color: #2e7d32;
    font-weight: 500;
    display: none;
}

.date-group {
    margin-top: 20px;
    text-align: left;
}

.date-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.date-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.date-input:focus {
    outline: none;
    border-color: #667eea;
}

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

.btn-submit {
    width: 100%;
    padding: 18px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    margin-top: 20px;
}

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

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

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.info-section {
    padding: 40px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.info-section h2 {
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.info-section h3 {
    color: #555;
    font-size: 1.3rem;
    margin: 30px 0 15px 0;
}

.info-section h4 {
    color: #667eea;
    font-size: 1rem;
    margin-bottom: 10px;
}

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

.info-section ol li {
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.example-download-section {
    padding: 30px 40px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.example-download {
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.example-download p {
    color: #555;
    font-size: 1rem;
    margin: 0;
    font-weight: 500;
}

.btn-example {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(40, 167, 69, 0.3);
}

.btn-example:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.btn-example svg {
    flex-shrink: 0;
}

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

.column-group {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.column-group ul {
    list-style: none;
    margin-top: 10px;
}

.column-group ul li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: #555;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
}

.column-group ul li:last-child {
    border-bottom: none;
}

.column-group ul li::before {
    content: "•";
    position: absolute;
    left: 10px;
    color: #667eea;
    font-weight: bold;
}

.footer {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    color: #666;
    font-size: 0.9rem;
}

/* Statistics Panel */
.stats-panel {
    margin: 25px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border-radius: 12px;
    border: 1px solid #e0e5f0;
}

.stats-panel h3 {
    color: #333;
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.stats-grid-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.stats-section {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stats-section h4 {
    color: #667eea;
    font-size: 0.95rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.9rem;
}

.stat-label {
    color: #555;
    font-weight: 500;
}

.stat-count {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 36px;
    text-align: center;
}

.stat-item.stat-warning {
    background: #fff3e0;
}

.stat-item.stat-warning .stat-count {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.stat-warnings {
    margin-top: 12px;
    padding: 12px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
}

.stat-warnings-header {
    font-weight: 600;
    color: #f57c00;
    font-size: 0.9rem;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ffe082;
}

.stat-warnings .stat-item {
    background: #fff3e0;
}

.stat-unknown-list {
    padding: 8px 12px;
    background: #fff;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #666;
    line-height: 1.6;
    margin-top: 8px;
}

.stat-region-header {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    padding: 10px 12px 6px 12px;
    margin-top: 4px;
    border-bottom: 1px solid #e0e0e0;
}

.stat-region-header:first-child {
    margin-top: 0;
}

.stat-region-total {
    color: #667eea;
    font-weight: 600;
}

.stat-item-indented {
    margin-left: 12px;
    background: #f0f4ff;
}

.region-note {
    font-size: 0.85rem;
    color: #666;
    margin-top: 12px;
    font-style: italic;
}

/* Stats Table */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

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

.stats-table th {
    padding: 12px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.stats-table th:first-child {
    text-align: left;
    padding-left: 15px;
}

.stats-table th:last-child {
    border-right: none;
}

.stats-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
}

.stats-table tbody tr:last-child {
    border-bottom: none;
}

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

.stats-table td {
    padding: 12px 10px;
    text-align: center;
    color: #555;
    border-right: 1px solid #f0f0f0;
}

.stats-table td:first-child {
    text-align: left;
    padding-left: 15px;
    font-weight: 600;
    color: #333;
}

.stats-table td:last-child {
    border-right: none;
}

.stats-table .region-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stats-table .region-total {
    color: #667eea;
    font-weight: 600;
    font-size: 0.85rem;
}

.stats-table .test-count {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3px 10px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.8rem;
    min-width: 28px;
}

.stats-table .test-count-zero {
    background: #e0e0e0;
    color: #999;
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .upload-section,
    .info-section,
    .example-download-section {
        padding: 25px;
    }

    .file-input-wrapper {
        padding: 40px 20px;
    }

    .columns-grid {
        grid-template-columns: 1fr;
    }

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

    .stats-grid-row {
        grid-template-columns: 1fr;
    }

    .stats-table {
        font-size: 0.8rem;
    }

    .stats-table th,
    .stats-table td {
        padding: 8px 5px;
    }

    .stats-table th:first-child,
    .stats-table td:first-child {
        padding-left: 10px;
    }

    .stats-table .test-count {
        padding: 2px 6px;
        font-size: 0.75rem;
    }
}
