/* Crawler Admin - Ahrefs-style Professional Design */

:root {
    --primary: #1a56db;
    --primary-hover: #1e429f;
    --primary-light: #e1effe;

    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border: #e5e7eb;
    --border-dark: #d1d5db;

    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    --success: #059669;
    --success-bg: #d1fae5;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --error: #dc2626;
    --error-bg: #fee2e2;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

    --radius: 6px;
    --radius-lg: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-secondary);
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-logo {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.header-logo span {
    color: var(--primary);
}

.header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 500px;
    margin: 0 24px;
}

.header-search input {
    flex: 1;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
}

.header-search input:focus {
    border-color: var(--primary);
}

.header-search button {
    height: 36px;
    padding: 0 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.header-search button:hover {
    background: var(--primary-hover);
}

.header-nav {
    display: flex;
    gap: 8px;
}

.header-nav a {
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
}

.header-nav a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.header-nav a.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

/* Main content */
.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.page-title small {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 8px;
}

/* Metric cards */
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.metric-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.metric-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.metric-delta {
    font-size: 12px;
    margin-top: 8px;
}

.metric-delta.positive {
    color: var(--success);
}

.metric-delta.negative {
    color: var(--error);
}

.metric-breakdown {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 400;
}

/* Cards/Sections */
.card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.card-actions {
    display: flex;
    gap: 8px;
}

.card-body {
    padding: 0;
}

.card-body.padded {
    padding: 20px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
}

.data-table th:hover {
    background: var(--bg-tertiary);
}

.data-table th.sorted-asc::after {
    content: ' ↑';
}

.data-table th.sorted-desc::after {
    content: ' ↓';
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: var(--bg-secondary);
}

.data-table .number {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.data-table .domain {
    font-weight: 500;
}

.data-table .url {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--text-secondary);
}

.data-table .time-ago {
    color: var(--text-muted);
    font-size: 13px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.pagination-buttons {
    display: flex;
    gap: 4px;
}

.pagination-buttons button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.pagination-buttons button:hover:not(:disabled) {
    background: var(--bg-tertiary);
}

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

/* Paginator with page numbers */
.paginator {
    display: flex;
    gap: 4px;
}

.paginator-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.paginator-btn:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--border-dark);
}

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

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

/* Form inputs */
.form-input,
.form-select {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-select:hover {
    border-color: var(--border-dark);
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

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

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

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

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

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

.btn-success:hover {
    background: #047857;
    border-color: #047857;
}

.btn-warning {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
}

.btn-warning:disabled {
    background: #fcd34d;
    border-color: #fcd34d;
    cursor: not-allowed;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 13px;
}

/* Progress bar */
.progress-container {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
}

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

.progress-title {
    font-size: 16px;
    font-weight: 600;
}

.progress-percent {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-message {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-pending {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-running {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-completed {
    background: var(--success-bg);
    color: var(--success);
}

.badge-failed {
    background: var(--error-bg);
    color: var(--error);
}

/* Resource breakdown */
.resource-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.resource-row:last-child {
    border-bottom: none;
}

.resource-type {
    width: 120px;
    font-weight: 500;
}

.resource-bar {
    flex: 1;
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin: 0 16px;
    overflow: hidden;
}

.resource-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.resource-count {
    width: 100px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.resource-percent {
    width: 60px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Charts placeholder */
.chart-container {
    padding: 20px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* Empty state */
.empty-state {
    padding: 48px 24px;
    text-align: center;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state-text {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--text-muted);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

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

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-primary);
}

.tab {
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Grid layout */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 1024px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Welcome page */
.welcome {
    max-width: 600px;
    margin: 80px auto;
    text-align: center;
}

.welcome h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 16px;
}

.welcome p {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 16px;
}

.welcome-search {
    display: flex;
    gap: 8px;
    max-width: 500px;
    margin: 0 auto;
}

.welcome-search input {
    flex: 1;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    outline: none;
}

.welcome-search input:focus {
    border-color: var(--primary);
}

.welcome-search button {
    height: 48px;
    padding: 0 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

.welcome-search button:hover {
    background: var(--primary-hover);
}

/* Metric card links */
.metric-card-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.metric-card-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* External link icon */
.ext-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    margin-left: 4px;
    opacity: 0.5;
    transition: opacity 0.15s, color 0.15s;
}

.ext-link:hover {
    opacity: 1;
    color: var(--primary);
}

/* Register domain link icon */
.register-link {
    color: var(--success);
    text-decoration: none;
    font-size: 12px;
    margin-left: 4px;
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.15s;
}

.register-link:hover {
    opacity: 1;
}

/* Arrow icon in headers */
.icon-arrow {
    font-size: 12px;
    opacity: 0.6;
    margin-left: 2px;
}
