/* ============================================================================
   Global Styles & Reset
   ============================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --success-color: #16a34a;
    --success-dark: #15803d;
    --danger-color: #dc2626;
    --warning-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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: var(--text-primary);
}

/* ============================================================================
   Container
   ============================================================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* ============================================================================
   Header
   ============================================================================ */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 30px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

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

.btn-history {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 10px 25px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-history:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* ============================================================================
   Input Section
   ============================================================================ */
.input-section {
    padding: 40px 30px;
    border-bottom: 1px solid var(--border-color);
}

.input-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.input-method h2 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

#domains-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Courier New', monospace;
    resize: vertical;
    transition: border-color 0.3s;
    margin-bottom: 15px;
}

#domains-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Batch Name Input */
.batch-name-wrapper {
    margin-top: 15px;
}

.batch-name-wrapper label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

#batch-name-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

#batch-name-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.file-upload-wrapper {
    margin-top: 15px;
}

.file-upload-btn {
    width: 100%;
    padding: 40px 20px;
    background: var(--bg-light);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.file-upload-btn:hover {
    border-color: var(--primary-color);
    background: #f0f7ff;
}

.hint {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ============================================================================
   Buttons
   ============================================================================ */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e5e7eb;
}

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

.btn-success:hover {
    background: var(--success-dark);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

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

/* ============================================================================
   Progress Section
   ============================================================================ */
.progress-section {
    padding: 40px 30px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.progress-section h2 {
    margin-bottom: 20px;
    text-align: center;
}

.progress-bar-container {
    position: relative;
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #60a5fa);
    border-radius: 15px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.progress-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.progress-note {
    text-align: center;
    color: var(--warning-color);
    font-size: 0.85rem;
    font-style: italic;
}

/* ============================================================================
   Results Section
   ============================================================================ */
.results-section {
    padding: 40px 30px;
    border-bottom: 1px solid var(--border-color);
}

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

.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid var(--primary-color);
}

.summary-card.indexed {
    border-left-color: var(--success-color);
}

.summary-card.not-indexed {
    border-left-color: var(--danger-color);
}

.summary-card .label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.summary-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.results-table-wrapper {
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.results-table thead {
    background: var(--bg-light);
}

.results-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.results-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.results-table tbody tr:hover {
    background: var(--bg-light);
}

.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-indexed {
    background: #d1fae5;
    color: var(--success-dark);
}

.status-not-indexed {
    background: #fee2e2;
    color: var(--danger-color);
}

.status-badge-small {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    background: var(--success-color);
    color: white;
}

/* ============================================================================
   History Modal
   ============================================================================ */
.history-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.history-modal-content {
    background: white;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

.history-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.history-modal-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s;
}

.btn-close:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.history-list {
    padding: 20px 30px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
    display: grid;
    gap: 15px;
}

.history-item {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s;
}

.history-item:hover {
    box-shadow: var(--shadow);
    transform: translateX(5px);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-item-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.history-item-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.history-item-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.history-item-actions {
    display: flex;
    gap: 10px;
}

.history-item-actions .btn {
    padding: 6px 15px;
    font-size: 0.85rem;
}

.loading-text {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

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

/* ============================================================================
   Loading Overlay
   ============================================================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay p {
    color: white;
    font-size: 1.2rem;
    margin-top: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px 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); }
}

/* ============================================================================
   Responsive Design
   ============================================================================ */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .header-title h1 {
        font-size: 2rem;
    }

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

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .results-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .history-modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .history-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .history-item-actions {
        width: 100%;
        flex-direction: column;
    }

    .history-item-actions .btn {
        width: 100%;
    }
}
