/* Reset and base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

h1 {
    text-align: center;
    color: #1890ff;
    margin-bottom: 40px;
    font-size: 2.5rem;
    font-weight: 600;
}

h2 {
    color: #262626;
    font-size: 1.5rem;
    margin-bottom: 20px;
    font-weight: 500;
}

h3 {
    color: #595959;
    font-size: 1.2rem;
    margin-bottom: 15px;
    font-weight: 500;
}

/* Navigation and page layout */
.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.back-link {
    display: inline-block;
    color: #1890ff;
    text-decoration: none;
    margin-bottom: 20px;
    font-size: 14px;
    transition: color 0.2s;
}

.back-link:hover {
    color: #40a9ff;
    text-decoration: underline;
}

.page-header h1 {
    margin-bottom: 10px;
}

.page-header p {
    color: #595959;
    font-size: 16px;
    margin: 0;
}

/* Tools grid for main page */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 32px;
    margin-top: 40px;
}

.tool-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.tool-card h2 {
    color: #1890ff;
    margin-bottom: 16px;
    font-size: 1.4rem;
}

.tool-card p {
    color: #595959;
    margin-bottom: 20px;
    line-height: 1.7;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
}

.feature-list li {
    color: #595959;
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
}

.feature-list li:before {
    content: "✓";
    color: #52c41a;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* Help text */
.help-text {
    margin-top: 12px;
    padding: 12px 16px;
    background-color: #f6ffed;
    border: 1px solid #b7eb8f;
    border-radius: 4px;
}

.help-text p {
    margin: 0;
    color: #52c41a;
    font-size: 14px;
}

/* Sections */
.section {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Form elements */
.form-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.url-input, .domain-input {
    flex: 1;
    min-width: 300px;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.url-input:focus, .domain-input:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.url-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.url-textarea:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background-color: #1890ff;
    color: white;
}

.btn-primary:hover {
    background-color: #40a9ff;
}

.btn-primary:active {
    background-color: #0958d9;
}

.btn-secondary {
    background-color: #f5f5f5;
    color: #595959;
    border: 1px solid #d9d9d9;
}

.btn-secondary:hover {
    background-color: #fafafa;
    border-color: #40a9ff;
    color: #1890ff;
}

.btn-large {
    padding: 12px 24px;
    font-size: 16px;
    width: 100%;
    margin-top: 16px;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background-color: #1890ff;
    transition: width 0.3s ease;
    border-radius: 4px;
}

#progress-text {
    font-size: 14px;
    color: #595959;
}

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

.export-buttons {
    display: flex;
    gap: 8px;
}

.results-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    padding: 16px;
    background-color: #fafafa;
    border-radius: 4px;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 12px;
    color: #8c8c8c;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: #262626;
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: 4px;
    border: 1px solid #f0f0f0;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: white;
}

.results-table th {
    background-color: #fafafa;
    padding: 12px;
    text-align: left;
    font-weight: 500;
    color: #262626;
    border-bottom: 1px solid #f0f0f0;
}

.results-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

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

.url-link {
    color: #1890ff;
    text-decoration: none;
    word-break: break-all;
}

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

.anchor-text {
    max-width: 200px;
    word-break: break-word;
    color: #595959;
}

.type-badge, .status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.type-dofollow {
    background-color: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.type-nofollow {
    background-color: #fff2e8;
    color: #fa8c16;
    border: 1px solid #ffd591;
}

.location-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.location-external {
    background-color: #fff0f6;
    color: #eb2f96;
    border: 1px solid #ffadd2;
}

.location-internal {
    background-color: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.error-cell {
    color: #ff4d4f;
    font-style: italic;
}

.status-badge {
    font-size: 11px;
}

.status-200 {
    background-color: #f6ffed;
    color: #52c41a;
}

.status-404 {
    background-color: #fff2f0;
    color: #ff4d4f;
}

.status-unknown {
    background-color: #f0f0f0;
    color: #8c8c8c;
}

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

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #1890ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.loading-overlay p {
    color: #595959;
    font-size: 16px;
    margin: 0;
}

/* Error messages */
.error-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    max-width: 400px;
}

.error-message {
    background-color: #fff2f0;
    border: 1px solid #ffccc7;
    border-radius: 4px;
    padding: 12px 16px;
    color: #ff4d4f;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #ff4d4f;
    cursor: pointer;
    margin-left: 12px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background-color: rgba(255, 77, 79, 0.1);
    border-radius: 50%;
}

/* Utility classes */
.hidden {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .form-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .url-input, .domain-input {
        min-width: auto;
    }
    
    .results-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .results-stats {
        justify-content: space-around;
    }
    
    .export-buttons {
        justify-content: center;
    }
    
    .error-container {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .section {
        padding: 16px;
    }
    
    .results-table {
        font-size: 12px;
    }
    
    .results-table th,
    .results-table td {
        padding: 8px;
    }
}