/* RDAP.nu - Nordic Slate Theme */

:root {
    /* Nordic Slate - Light Mode */
    --color-sidebar: #1e293b;
    --color-sidebar-text: #f8fafc;
    --color-sidebar-muted: #94a3b8;

    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-header: #dbeafe;
    --bg-highlight: #f0f9ff;
    --bg-card: #f8fafc;

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    --link: #2563eb;
    --link-hover: #1d4ed8;
    --link-visited: #4f46e5;

    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --source-rdap: #dbeafe;
    --source-whois: #fef3c7;
    --source-both: #d1fae5;

    --accent: #3b82f6;
    --accent-hover: #2563eb;

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;

    --radius: 6px;
    --radius-lg: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Nordic Slate - Dark Mode */
        --color-sidebar: #0f172a;
        --color-sidebar-text: #f1f5f9;
        --color-sidebar-muted: #64748b;

        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-header: #1e3a5f;
        --bg-highlight: #1e293b;
        --bg-card: #1e293b;

        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #94a3b8;

        --link: #60a5fa;
        --link-hover: #93c5fd;
        --link-visited: #a5b4fc;

        --border: #334155;
        --border-strong: #475569;

        --source-rdap: #1e3a5f;
        --source-whois: #422006;
        --source-both: #064e3b;

        --accent: #3b82f6;
        --accent-hover: #60a5fa;
    }
}

/* Reset & Base */
* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    margin: 0;
    padding: 0;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

a:visited {
    color: var(--link-visited);
}

code {
    font-family: "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.875em;
    background: var(--bg-secondary);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.tagline {
    color: var(--text-muted);
    margin: 0;
}

/* Search box */
.search-box {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-primary);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.search-box input[type="text"] {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.search-box input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-box select {
    padding: 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
}

.search-box button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: white;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-box button:hover {
    background: var(--accent-hover);
}

/* Results */
.results {
    margin-top: 2rem;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.results-header {
    padding: 1rem 1.5rem;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.results-header h2 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.results-header code {
    background: var(--bg-primary);
    padding: 0.125rem 0.5rem;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Source status indicators */
.source-status {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
}

.source-status .source {
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-weight: 500;
}

.source-status .source.available {
    background: var(--source-both);
    color: #065f46;
}

.source-status .source.unavailable {
    background: #fee2e2;
    color: #991b1b;
}

.source-status .source.registry {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

@media (prefers-color-scheme: dark) {
    .source-status .source.available {
        color: #a7f3d0;
    }
    .source-status .source.unavailable {
        background: #7f1d1d;
        color: #fecaca;
    }
}

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

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}

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

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

/* Badge */
.badge {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    text-transform: uppercase;
}

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

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

/* Panels */
.tab-panels {
    padding: 1.5rem;
}

.panel.hidden {
    display: none;
}

/* View toggle (Merged / Side-by-side) */
.view-controls {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    padding: 0.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    width: fit-content;
}

.view-option {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: all 0.15s;
}

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

.view-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.view-option:has(input:checked) {
    color: var(--text-primary);
    background: var(--bg-primary);
    box-shadow: var(--shadow);
}

/* Data card */
.data-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.data-card-header {
    padding: 0.75rem 1rem;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Field table (RPSL-style) */
.field-table {
    width: 100%;
    border-collapse: collapse;
}

.field-table tr {
    border-bottom: 1px solid var(--border);
}

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

.field-table th,
.field-table td {
    padding: 0.5rem 1rem;
    text-align: left;
    vertical-align: top;
}

.field-table th {
    width: 150px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-family: "SF Mono", Consolas, monospace;
    cursor: help;
    white-space: nowrap;
}

.field-table th:hover {
    color: var(--text-secondary);
}

.field-table td {
    color: var(--text-primary);
    word-break: break-word;
}

.field-table td code {
    background: var(--bg-secondary);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
}

/* Source indicator */
.source-indicator {
    width: 60px;
    text-align: right;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-muted);
    font-family: "SF Mono", Consolas, monospace;
    padding-right: 1rem !important;
}

.source-indicator.rdap {
    color: #2563eb;
}

.source-indicator.whois {
    color: #d97706;
}

/* Compare table */
/* Compare table scroll wrapper for mobile */
.compare-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    table-layout: fixed;
    min-width: 400px;
}

.compare-table thead {
    background: var(--bg-secondary);
}

.compare-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

.compare-table th:first-child {
    width: 140px;
    font-family: "SF Mono", Consolas, monospace;
    font-weight: 500;
}

.compare-table tbody th,
.compare-table tbody td {
    padding: 0.5rem 1rem;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
    word-break: break-word;
    overflow-wrap: break-word;
}

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

/* Rows that match: muted to de-emphasize */
.compare-table tr.matches td {
    color: var(--text-muted);
}

/* Rows that differ: highlight with left accent border */
.compare-table tr.differs {
    border-left: 3px solid var(--warning);
}

.compare-table tr.differs th,
.compare-table tr.differs td {
    color: var(--text-primary);
}

.compare-table .no-value {
    color: var(--text-muted);
    font-style: italic;
}

/* No column background colors - keep it clean */
.compare-table .rdap-value,
.compare-table .whois-value {
    background: transparent;
}

/* Related links */
.related-links {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.related-links h4 {
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.related-links ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.related-links li a {
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.related-links li a::after {
    content: "↗";
    font-size: 0.75em;
    opacity: 0.5;
}

/* Raw panels */
.raw-panels {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.raw-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.raw-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.raw-header h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.copy-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
}

.copy-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.copy-btn:disabled {
    cursor: default;
}

.raw-panel pre {
    margin: 0;
    padding: 1rem;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 0.75rem;
    overflow-x: auto;
    max-height: 400px;
}

.raw-panel code {
    font-family: "SF Mono", Consolas, monospace;
    background: none;
    padding: 0;
}

/* Messages */
.error-message {
    padding: 1rem;
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
}

.warning-message {
    padding: 1rem;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

@media (prefers-color-scheme: dark) {
    .error-message {
        color: #fecaca;
        background: #7f1d1d;
        border-color: #991b1b;
    }
    .warning-message {
        color: #fde68a;
        background: #78350f;
        border-color: #92400e;
    }
}

.no-data {
    color: var(--text-muted);
    font-style: italic;
    padding: 1rem 0;
}

/* Spinner */
.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Utility */
.hidden {
    display: none !important;
}

/* Footer */
footer {
    margin-top: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

footer a {
    color: var(--link);
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .search-box {
        flex-wrap: wrap;
    }

    .search-box input[type="text"] {
        width: 100%;
    }

    .search-box select,
    .search-box button {
        flex: 1;
    }

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

    .field-table th {
        width: 110px;
        font-size: 0.8125rem;
    }

    .tabs {
        overflow-x: auto;
    }

    .view-controls {
        width: 100%;
    }

    .view-option {
        flex: 1;
        justify-content: center;
    }

    .compare-table {
        font-size: 0.75rem;
    }

    .compare-table th,
    .compare-table td {
        padding: 0.375rem 0.5rem;
    }

    .compare-table th:first-child {
        width: 70px;
    }

    .compare-table code {
        font-size: 0.6875rem;
    }

    .related-links ul {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Content pages (about, etc.) */
.content-page {
    max-width: 700px;
}

.content-page h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.content-page h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 2rem 0 1rem;
    color: var(--text-primary);
}

.content-page p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.content-page ul {
    margin: 0 0 1.5rem;
    padding-left: 1.5rem;
}

.content-page li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.content-page section {
    margin-bottom: 2rem;
}

.content-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

/* Print styles */
@media print {
    .tabs,
    .view-controls,
    .copy-btn,
    .related-links {
        display: none;
    }

    .panel.hidden {
        display: block !important;
    }

    .results {
        box-shadow: none;
        border: 1px solid #000;
    }
}
