:root {
    --blue-50: #eff6ff;
    --blue-600: #2563eb;
    --blue-700: #1d4ed8;
    --blue-100: #dbeafe;
    --blue-200: #bfdbfe;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-900: #111827;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --panel: #ffffff;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.12);
    --radius-xl: 14px;
    --radius-lg: 12px;
    --radius-md: 10px;
}

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

body {
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

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

.header {
    background: linear-gradient(90deg, var(--blue-600) 0%, var(--blue-700) 100%);
    color: white;
    padding: 20px 32px;
    border-radius: 0;
    margin: 0 -20px 28px;
    box-shadow: var(--shadow-md);
}

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

.header p {
    opacity: 0.9;
    font-size: 0.9rem;
    color: #dbeafe;
}

.input-section,
.progress-section,
.results-section {
    background: var(--panel);
    padding: 28px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.input-section::before,
.progress-section::before,
.results-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--blue-600), var(--blue-700));
}

.input-section h2,
.progress-section h2,
.results-section h2,
.modal-content h2 {
    margin-bottom: 18px;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--gray-600);
}

.url-textarea {
    width: 100%;
    min-height: 160px;
    padding: 16px;
    border: 2px solid var(--blue-200);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--blue-50);
}

.url-textarea:focus {
    outline: none;
    border-color: var(--blue-600);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

.btn {
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
    color: white;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1e40af, var(--blue-700));
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--blue-50);
    color: #1e3a8a;
    border-color: var(--blue-200);
}

.btn-secondary:hover {
    background: #dbeafe;
    border-color: var(--blue-200);
    color: #1e40af;
}

.btn-danger {
    background: var(--red-500);
    color: white;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--red-600);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
}

.api-config {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.api-config input {
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    font-size: 14px;
    width: 300px;
}

.api-config label {
    font-weight: 600;
    color: var(--gray-600);
}

.progress-section {
    display: none;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.progress-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-badge {
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
    border: 1px solid transparent;
}

.stat-badge.total {
    background: var(--gray-100);
    color: var(--gray-600);
    border-color: var(--gray-200);
}

.stat-badge.success {
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

.stat-badge.error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.progress-bar-container {
    background: var(--gray-200);
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #2563eb);
    transition: width 0.3s ease;
    width: 0%;
}

.current-url {
    font-size: 13px;
    color: var(--gray-600);
    margin-top: 8px;
}

.log-viewer {
    max-height: 220px;
    overflow-y: auto;
    background: #f8fafc;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 15px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
    font-size: 12px;
    margin-top: 18px;
}

.log-entry {
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.log-entry.success {
    color: var(--green-600);
}

.log-entry.error {
    color: var(--red-600);
}

.log-entry.info {
    color: var(--blue-600);
}

.results-section {
    display: none;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.table-container {
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: #ffffff;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    background: #f8fafc;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-600);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-700);
}

tr:hover {
    background: #f8fafc;
}

.url-cell {
    color: var(--blue-600);
    text-decoration: none;
}

.url-cell:hover {
    text-decoration: underline;
}

.status-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-icon.success {
    background: var(--green-500);
}

.status-icon.error {
    background: var(--red-500);
}

.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: #111827;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
}

.tooltip:hover::after {
    opacity: 1;
}

.empty-state {
    text-align: center;
    padding: 60px;
    color: #64748b;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-200);
    border-top: 3px solid var(--blue-600);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.error-details {
    font-size: 12px;
    color: var(--red-600);
    margin-top: 5px;
}

.truncate {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.check-result {
    font-size: 13px;
    line-height: 1.5;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: #f8fafc;
}

.check-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #cbd5e0;
}

.check-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.check-header {
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
}

.check-content {
    color: #1f2937;
}

.check-reason {
    color: #64748b;
    font-style: italic;
    margin-top: 4px;
    padding-left: 12px;
    border-left: 2px solid #cbd5e0;
}

.check-suggestion {
    color: var(--green-600);
    margin-top: 4px;
}

.check-no-issue {
    color: var(--green-600);
    font-style: italic;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    overflow-y: auto;
}

.modal-content {
    position: relative;
    background-color: #fff;
    margin: 60px auto;
    padding: 28px;
    width: min(90%, 1200px);
    max-height: 80vh;
    overflow-y: auto;
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
}

.close-modal {
    position: absolute;
    top: 18px;
    right: 22px;
    font-size: 28px;
    font-weight: bold;
    color: #64748b;
    cursor: pointer;
}

.html-preview {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    padding: 15px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: #f8fafc;
    white-space: pre-wrap;
    overflow-x: auto;
}

.view-html-btn {
    background: #f8fafc;
    color: #475569;
    border: 1px solid var(--gray-200);
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 6px;
}

.view-html-btn:hover {
    background: #eff6ff;
    border-color: #c7d2fe;
    color: #1e3a8a;
}

@media (max-width: 768px) {
    .container {
        padding: 20px 16px 32px;
    }

    .header {
        padding: 22px 20px;
    }

    .header h1 {
        font-size: 1.7rem;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .api-config {
        flex-direction: column;
        align-items: stretch;
    }

    .api-config input {
        width: 100%;
    }

    .progress-header,
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
