/* ===== CSS Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #fff;
    color: #202124;
    line-height: 1.58;
    font-size: 14px;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== HOME PAGE ===== */
.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.logo-section {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    font-size: 72px;
    font-weight: 400;
    letter-spacing: -2px;
    color: #202124;
}

.logo-accent {
    color: #1a73e8;
}

.tagline {
    color: #5f6368;
    font-size: 16px;
    margin-top: 8px;
}

.search-form-home {
    width: 100%;
    max-width: 584px;
}

.search-box-wrapper-home {
    position: relative;
    width: 100%;
    margin-bottom: 16px;
}

.search-input-home {
    width: 100%;
    padding: 14px 20px 14px 48px;
    font-size: 16px;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    outline: none;
    background: #fff;
    transition: box-shadow 0.2s;
}

.search-input-home:hover,
.search-input-home:focus {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
    border-color: rgba(223, 225, 229, 0);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* ===== DOMAIN SELECTOR (HOME PAGE) ===== */
.domain-selector-home {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}

.domain-radio {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid #dadce0;
    border-radius: 16px;
    font-size: 13px;
    color: #3c4043;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.domain-radio:hover {
    background: #f1f3f4;
    border-color: #1a73e8;
}

.domain-radio input[type="radio"] {
    display: none;
}

.domain-radio:has(input:checked) {
    background: #e8f0fe;
    border-color: #1a73e8;
    color: #1a73e8;
    font-weight: 500;
}

.domain-radio small {
    color: #70757a;
    font-size: 11px;
}

/* ===== SEARCH BUTTONS ===== */
.search-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-search {
    padding: 10px 24px;
    font-size: 14px;
    background-color: #1a73e8;
    border: 1px solid #1a73e8;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-search:hover {
    background-color: #1765cc;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-stats {
    padding: 10px 24px;
    font-size: 14px;
    background-color: #f8f9fa;
    border: 1px solid #dadce0;
    border-radius: 4px;
    color: #3c4043;
    cursor: pointer;
    font-weight: 500;
    display: inline-block;
    transition: all 0.2s;
}

.btn-stats:hover {
    background-color: #f1f3f4;
    border-color: #bdc1c6;
}

.btn-small {
    padding: 4px 12px;
    font-size: 12px;
    background: #e8f0fe;
    color: #1a73e8;
    border-radius: 4px;
    border: 1px solid #d2e3fc;
}

.btn-small:hover {
    background: #d2e3fc;
}

.home-footer {
    position: fixed;
    bottom: 20px;
    text-align: center;
    color: #70757a;
    font-size: 13px;
}

.home-footer-sub {
    margin-top: 4px;
    font-size: 12px;
    color: #9aa0a6;
}

/* ===== SUGGESTIONS DROPDOWN ===== */
.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dfe1e5;
    border-top: none;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 4px 6px rgba(32, 33, 36, 0.28);
    z-index: 100;
    overflow: hidden;
}

.suggestion-item {
    padding: 8px 16px 8px 48px;
    cursor: pointer;
    font-size: 14px;
    color: #202124;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestion-item:hover {
    background-color: #f8f9fa;
}

.suggestion-domain {
    color: #70757a;
    font-size: 12px;
    margin-left: auto;
}

.suggestion-desc {
    color: #70757a;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

/* ===== RESULTS PAGE HEADER ===== */
.results-header {
    border-bottom: 1px solid #ebebeb;
    padding: 12px 20px 0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 50;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-bottom: 8px;
}

.logo-small {
    font-size: 24px;
    font-weight: 500;
    white-space: nowrap;
}

.search-form-results {
    flex: 1;
    max-width: 700px;
}

.search-box-wrapper {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    font-size: 16px;
    border: 1px solid #dfe1e5;
    border-radius: 24px;
    outline: none;
    background: #fff;
}

.search-input:focus {
    box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
    border-color: rgba(223, 225, 229, 0);
}

.header-links {
    display: flex;
    gap: 16px;
    white-space: nowrap;
}

.header-links a {
    color: #5f6368;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

.header-links a:hover {
    background: #f1f3f4;
    color: #1a73e8;
}

.search-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0 0;
    margin-left: 100px;
}

.results-info {
    color: #70757a;
    font-size: 13px;
}

.clear-filter {
    color: #d93025;
    font-size: 12px;
    margin-left: 4px;
}

.sort-link {
    padding: 6px 12px;
    color: #5f6368;
    font-size: 13px;
    border-bottom: 3px solid transparent;
    margin-left: 4px;
}

.sort-link:hover {
    color: #1a73e8;
}

.sort-link.active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
    font-weight: 500;
}

/* ===== RESULTS ===== */
.results-container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    gap: 40px;
}

.results-main {
    flex: 1;
    max-width: 700px;
    margin-left: 100px;
}

.result-item {
    margin-bottom: 28px;
}

.result-url-line {
    font-size: 12px;
    color: #202124;
    margin-bottom: 2px;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 6px;
}

.favicon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.result-domain {
    color: #202124;
    font-size: 14px;
}

.result-path {
    color: #5f6368;
    font-size: 12px;
}

.result-title {
    margin: 2px 0 4px;
}

.result-title a {
    color: #1a0dab;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.3;
}

.result-title a:hover {
    text-decoration: underline;
}

.result-title a:visited {
    color: #681da8;
}

.result-snippet {
    color: #4d5156;
    font-size: 14px;
    line-height: 1.58;
    word-break: break-word;
}

.result-snippet mark {
    background-color: transparent;
    color: #202124;
    font-weight: 700;
}

.result-meta {
    margin-top: 6px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.result-meta span {
    font-size: 12px;
    color: #70757a;
}

.meta-score {
    opacity: 0.6;
}

/* ===== PDF RESULT STYLING ===== */
.result-pdf {
    border-left: 3px solid #d32f2f;
    padding-left: 16px;
}

.result-pdf-icon {
    flex-shrink: 0;
    vertical-align: middle;
}

.result-filename {
    font-family: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;
    font-size: 12px;
    color: #5f6368;
    margin-left: auto;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-filename-kw {
    margin: 4px 0 2px 0;
    padding: 3px 8px;
    background: #fff8e1;
    border-radius: 4px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.kw-label {
    font-weight: 600;
    color: #e65100;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.kw-text {
    color: #5f6368;
}

.kw-text mark {
    background: #fff3c4;
    color: #202124;
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}

.result-source {
    margin: 4px 0 2px 0;
    font-size: 12px;
    color: #70757a;
    display: flex;
    align-items: center;
    gap: 4px;
}

.source-label {
    font-weight: 600;
    color: #5f6368;
    font-size: 11px;
}

.source-link {
    color: #1a73e8;
    text-decoration: none;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.source-count {
    color: #5f6368;
    font-size: 11px;
    font-weight: 500;
}

/* ===== LOGO PDF ICON ===== */
.logo-pdf-icon {
    vertical-align: -4px;
    margin-right: 4px;
}

.logo-pdf-icon-home {
    vertical-align: middle;
    margin-right: 8px;
    margin-bottom: 8px;
}

/* ===== SEARCH TIPS (HOME & RESULTS) ===== */
.search-tips {
    text-align: center;
    margin-top: 14px;
    font-size: 12px;
    color: #9aa0a6;
}

.search-tips span {
    margin-right: 6px;
}

.search-tips code {
    font-size: 11px;
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 3px;
    color: #5f6368;
    margin: 0 2px;
}

.tools-hint {
    font-size: 11px;
    color: #9aa0a6;
    margin-left: auto;
}

.tools-hint code {
    font-size: 11px;
    background: #f1f3f4;
    padding: 1px 4px;
    border-radius: 2px;
    color: #5f6368;
}

.tools-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tools-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.active-clear {
    color: #d93025;
    font-size: 12px;
}

/* ===== NO RESULTS ===== */
.no-results {
    padding: 40px 0;
}

.no-results h2 {
    color: #202124;
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 16px;
}

.no-results a {
    color: #1a73e8;
}

.no-results ul {
    margin-top: 12px;
    padding-left: 20px;
    color: #5f6368;
}

.no-results li {
    margin-bottom: 4px;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 40px 0;
    padding: 20px;
}

.page-link {
    padding: 8px 14px;
    color: #1a73e8;
    font-size: 14px;
    border-radius: 4px;
}

.page-link:hover {
    background-color: #f1f3f4;
}

.page-link.current {
    font-weight: 700;
    color: #202124;
    background-color: #e8f0fe;
}

/* ===== SIDEBAR ===== */
.results-sidebar {
    width: 260px;
    flex-shrink: 0;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section h4 {
    font-size: 14px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #ebebeb;
}

.filter-link {
    display: block;
    padding: 4px 8px;
    font-size: 13px;
    color: #1a73e8;
    border-radius: 4px;
    margin-bottom: 2px;
}

.filter-link:hover {
    background-color: #f1f3f4;
}

.filter-link.active {
    background-color: #e8f0fe;
    font-weight: 500;
}

.filter-count {
    color: #70757a;
    font-size: 12px;
}

/* ===== TAG BADGES ===== */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #f1f3f4;
    border-radius: 12px;
    font-size: 12px;
    color: #3c4043;
}

/* ===== STATS PAGE ===== */
.stats-container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
}

.stats-title {
    font-size: 24px;
    font-weight: 400;
    color: #202124;
    margin-bottom: 8px;
}

.stats-subtitle {
    font-size: 13px;
    color: #70757a;
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border: 1px solid #ebebeb;
    transition: transform 0.15s;
}

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

.stat-card-success {
    border-left: 3px solid #34a853;
}

.stat-card-info {
    border-left: 3px solid #1a73e8;
}

.stat-card-warning {
    border-left: 3px solid #fbbc04;
}

.stat-card-danger {
    border-left: 3px solid #ea4335;
}

.stat-value {
    font-size: 28px;
    font-weight: 500;
    color: #1a73e8;
}

.stat-card-success .stat-value { color: #34a853; }
.stat-card-warning .stat-value { color: #e37400; }
.stat-card-danger .stat-value { color: #ea4335; }

.stat-label {
    font-size: 13px;
    color: #5f6368;
    margin-top: 4px;
}

.stats-section {
    margin-bottom: 32px;
}

.stats-section h3 {
    font-size: 18px;
    font-weight: 400;
    color: #202124;
    margin-bottom: 12px;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th, .stats-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #ebebeb;
}

.stats-table th {
    font-weight: 500;
    color: #5f6368;
    font-size: 13px;
    text-transform: uppercase;
    background: #f8f9fa;
}

.stats-table a {
    color: #1a73e8;
}

.stats-table a:hover {
    text-decoration: underline;
}

.url-cell {
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.domain-list {
    list-style: none;
    padding: 0;
}

.domain-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f4;
    color: #3c4043;
}

/* ===== PROGRESS BARS ===== */
.progress-bar-container {
    margin: 12px 0;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: #f1f3f4;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
}

.progress-fill {
    height: 100%;
    transition: width 0.5s ease;
}

.progress-fill.indexed {
    background: #1a73e8;
}

.progress-fill.crawled {
    background: #34a853;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
    color: #5f6368;
}

.legend-indexed { color: #1a73e8; font-weight: 500; }
.legend-crawled { color: #34a853; font-weight: 500; }

/* Mini progress bars (in tables) */
.mini-progress {
    width: 60px;
    height: 6px;
    background: #f1f3f4;
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
}

.mini-progress-fill {
    height: 100%;
    background: #1a73e8;
    border-radius: 3px;
    transition: width 0.3s;
}

/* ===== STATUS BADGES ===== */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-running {
    background: #e6f4ea;
    color: #137333;
}

.status-completed {
    background: #e8f0fe;
    color: #1967d2;
}

.status-crawled, .status-indexed {
    background: #e6f4ea;
    color: #137333;
}

.status-failed, .status-permanently_failed {
    background: #fce8e6;
    color: #c5221f;
}

.status-discovered {
    background: #fef7e0;
    color: #e37400;
}

.status-skipped {
    background: #f1f3f4;
    color: #5f6368;
}

.status-paused, .status-stopped {
    background: #fef7e0;
    color: #e37400;
}

.status-idle {
    background: #f1f3f4;
    color: #5f6368;
}

.status-crawling {
    background: #e6f4ea;
    color: #137333;
    animation: pulse 2s infinite;
}

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

/* ===== FOOTER ===== */
.results-footer {
    text-align: center;
    padding: 20px;
    color: #70757a;
    font-size: 13px;
    border-top: 1px solid #ebebeb;
    margin-top: 40px;
}

.results-footer a {
    color: #1a73e8;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .results-container {
        flex-direction: column;
        padding: 12px;
    }

    .results-main {
        margin-left: 0;
        max-width: 100%;
    }

    .results-sidebar {
        width: 100%;
    }

    .search-tools {
        margin-left: 0;
        flex-direction: column;
        gap: 4px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .header-links {
        display: none;
    }

    .logo {
        font-size: 48px;
    }

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

    .stats-table {
        display: block;
        overflow-x: auto;
    }

    .domain-selector-home {
        flex-direction: column;
        align-items: center;
    }
}
