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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background: #f5f7fa;
    color: #1a202c;
    line-height: 1.6;
    letter-spacing: -0.3px;
}

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

/* HEADER & HERO */

.header {
    background: linear-gradient(135deg, #0066ff 0%, #0052cc 100%);
    color: white;
    padding: 60px 20px;
    text-align: center;
    margin-bottom: 40px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.header h1 {
    font-size: 2.2em;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.header .subtitle {
    font-size: 1.05em;
    opacity: 0.95;
    font-weight: 400;
}

/* MAIN LAYOUT */

.main-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 60px;
}

/* CARDS & PANELS */

.status-card,
.controls-card,
.download-card,
.results-card {
    background: white;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
    padding: 28px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.2s ease;
}

.status-card:hover,
.controls-card:hover,
.download-card:hover,
.results-card:hover {
    border-color: #d0d8e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* STATUS SECTION */

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e8ecf1;
}

.status-header h2 {
    font-size: 1.3em;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
}

.status-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-badge.idle {
    background: #e7f3ff;
    color: #0066ff;
    border-color: #bbd7ff;
}

.status-badge.running {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
    animation: pulse 1.5s ease-in-out infinite;
}

.status-badge.completed {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.status-badge.error {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* STATISTICS GRID */

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

.stat-item {
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border: 1px solid #e8ecf1;
    border-radius: 8px;
    border-left: 4px solid #0066ff;
    transition: all 0.3s ease;
    cursor: default;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    border-color: #d0d8e0;
}

.stat-item.success {
    border-left-color: #28a745;
}

.stat-item.success .stat-value {
    color: #28a745;
}

.stat-item.error {
    border-left-color: #dc3545;
}

.stat-item.error .stat-value {
    color: #dc3545;
}

.stat-label {
    font-size: 0.85em;
    color: #687280;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2.2em;
    font-weight: 700;
    color: #0066ff;
    line-height: 1;
}

/* PROGRESS BAR */

.progress-section {
    margin: 24px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e8ecf1;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.9em;
    color: #687280;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e8ecf1;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0066ff 0%, #0052cc 100%);
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 10px;
}

.status-message {
    padding: 16px;
    background: #e7f3ff;
    border-left: 3px solid #0066ff;
    border-radius: 4px;
    color: #004bb0;
    font-size: 0.95em;
    min-height: 20px;
}

/* BUTTONS */

.controls-card {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #0066ff 0%, #0052cc 100%);
    color: white;
    border: none;
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
    transform: translateY(-1px);
}

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

.btn-secondary {
    background: white;
    color: #1a202c;
    border: 1px solid #d0d8e0;
}

.btn-secondary:hover {
    background: #f8f9fa;
    border-color: #0066ff;
    color: #0066ff;
}

.btn-download {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
    text-decoration: none;
    display: inline-flex;
}

.btn-download:hover {
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    transform: translateY(-1px);
}

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

/* DOWNLOAD SECTION */

.download-card {
    background: linear-gradient(135deg, #e7f3ff 0%, #f0f7ff 100%);
    border: 1px solid #bbd7ff;
}

.download-card h3 {
    margin-bottom: 16px;
    color: #0066ff;
    font-size: 1.1em;
}

.download-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* TABLE SECTION */

.results-card h3 {
    margin-bottom: 20px;
    color: #1a202c;
    font-size: 1.2em;
    font-weight: 600;
}

.table-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input,
.filter-select {
    padding: 10px 14px;
    border: 1px solid #d0d8e0;
    border-radius: 6px;
    font-size: 0.95em;
    transition: all 0.2s ease;
    font-family: inherit;
}

.search-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.search-input {
    flex: 1;
    min-width: 220px;
}

.filter-select {
    min-width: 150px;
}

/* TABLE WRAPPER */

.table-wrapper {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 6px;
    border: 1px solid #e1e8ed;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.results-table thead {
    background: linear-gradient(135deg, #f8f9fa 0%, #f0f5fa 100%);
    border-bottom: 2px solid #d0d8e0;
}

.results-table th {
    padding: 14px;
    text-align: left;
    font-weight: 600;
    color: #1a202c;
    white-space: nowrap;
    border-right: 1px solid #e1e8ed;
}

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

.results-table td {
    padding: 12px 14px;
    color: #3a4555;
    border-right: 1px solid #e8ecf1;
    border-bottom: 1px solid #e8ecf1;
}

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

.results-table tbody tr {
    transition: background-color 0.2s ease;
}

.results-table tbody tr:hover {
    background-color: #f8fafb;
}

.results-table tbody tr:nth-child(odd) {
    background-color: #fafbfc;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}
/* PAGINATION */

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #d0d8e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9em;
    font-weight: 500;
    color: #1a202c;
}

.pagination button:hover:not(:disabled) {
    background: #0066ff;
    color: white;
    border-color: #0066ff;
}

.pagination button.active {
    background: #0066ff;
    color: white;
    border-color: #0066ff;
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .page-info {
    display: flex;
    align-items: center;
    color: #687280;
    font-size: 0.9em;
    margin: 0 12px;
}

/* FOOTER */

.footer {
    text-align: center;
    color: white;
    margin-top: 60px;
    padding: 40px 20px;
    background: rgba(0, 0, 0, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9em;
}

/* ANIMATIONS */

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

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

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

/* RESPONSIVE DESIGN */

@media (max-width: 1024px) {
    .container {
        max-width: 100%;
    }

    .status-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .header {
        padding: 40px 20px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .header .subtitle {
        font-size: 0.95em;
    }

    .status-card,
    .controls-card,
    .download-card,
    .results-card {
        padding: 20px;
    }

    .status-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .stat-value {
        font-size: 1.8em;
    }

    .controls-card {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .table-controls {
        flex-direction: column;
    }

    .search-input {
        min-width: auto;
    }

    .results-table {
        font-size: 0.85em;
    }

    .results-table th,
    .results-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.4em;
    }

    .header .subtitle {
        font-size: 0.85em;
    }

    .main-panel {
        gap: 16px;
    }

    .status-card,
    .controls-card,
    .download-card,
    .results-card {
        padding: 16px;
        border-radius: 6px;
    }

    .stat-value {
        font-size: 1.4em;
    }

    .stat-label {
        font-size: 0.75em;
    }

    .pagination button {
        padding: 6px 10px;
        font-size: 0.85em;
    }

    .results-table {
        font-size: 0.8em;
    }

    .results-table th,
    .results-table td {
        padding: 8px 6px;
    }
}

/* DARK MODE SUPPORT */

@media (prefers-color-scheme: dark) {
    body {
        background: #0f1419;
        color: #e4e6eb;
    }

    .header {
        background: linear-gradient(135deg, #0052cc 0%, #003d99 100%);
    }

    .status-card,
    .controls-card,
    .results-card {
        background: #1a1f26;
        border-color: #2d3748;
    }

    .status-card:hover,
    .controls-card:hover,
    .results-card:hover {
        border-color: #3d4758;
    }

    .download-card {
        background: linear-gradient(135deg, #1a2332 0%, #0f1b2b 100%);
        border-color: #2d4169;
    }

    .progress-section {
        background: #2d3748;
        border-color: #3d4758;
    }

    .search-input,
    .filter-select {
        background: #2d3748;
        color: #e4e6eb;
        border-color: #3d4758;
    }

    .search-input:focus,
    .filter-select:focus {
        border-color: #0066ff;
        box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.2);
    }

    .results-table {
        background: #1a1f26;
    }

    .results-table thead {
        background: #2d3748;
        border-color: #3d4758;
    }

    .results-table th {
        color: #cbd5e0;
        border-color: #3d4758;
    }

    .results-table td {
        color: #cbd5e0;
        border-color: #2d3748;
    }

    .results-table tbody tr:hover {
        background-color: #2d3748;
    }

    .results-table tbody tr:nth-child(odd) {
        background-color: #1a1f26;
    }

    .pagination button {
        background: #2d3748;
        color: #e4e6eb;
        border-color: #3d4758;
    }

    .pagination button:hover:not(:disabled) {
        background: #0066ff;
        border-color: #0066ff;
    }

    .pagination button.active {
        background: #0066ff;
        border-color: #0066ff;
    }

    .pagination .page-info {
        color: #a0aec0;
    }

    .btn-secondary {
        background: #2d3748;
        color: #e4e6eb;
        border-color: #3d4758;
    }

    .btn-secondary:hover {
        background: #3d4758;
        border-color: #0066ff;
        color: #0066ff;
    }
}
