/* Serverit Suomessa – tyylit (Suomen lipun sinivalkoinen) */

:root {
    --color-bg: #f0f4f8;
    --color-surface: #fff;
    --color-text: #1a1a2e;
    --color-text-muted: #4a5568;
    --color-primary: #003580;
    --color-primary-hover: #002a6b;
    --color-border: #c5d4e8;
    --color-error: #b91c1c;
    --color-success: #15803d;
    --color-neutral: #6366f1;
    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 53, 128, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
}

.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1.25rem 0;
    box-shadow: var(--shadow);
}

.site-header h1 {
    margin: 0 0 0.25rem 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.site-header h1 a {
    color: var(--color-primary);
    text-decoration: none;
}

.site-header h1 a:hover {
    text-decoration: underline;
}

.tagline {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.site-nav {
    margin-top: 1rem;
}

.site-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.5rem;
}

.site-nav a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.site-nav a:hover {
    text-decoration: underline;
}

.main {
    flex: 1;
    padding: 2rem 0;
}

.site-footer {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 1rem 0;
    margin-top: auto;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.site-footer p {
    margin: 0;
}

.site-footer a {
    color: var(--color-primary);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* Lomakkeet */
.check-form-section,
.latest-checks,
.result-page,
.badge-page {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.check-form-section h2,
.latest-checks h2,
.result-page h2,
.badge-page h2 {
    margin-top: 0;
    font-size: 1.25rem;
}

.check-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.check-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    width: 100%;
}

.check-form input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.check-form input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.2);
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}

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

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

.btn-secondary {
    background: var(--color-border);
    color: var(--color-text);
}

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

.btn-small {
    padding: 0.35rem 0.65rem;
    font-size: 0.875rem;
}

/* Taulukot */
.table-wrap {
    overflow-x: auto;
    margin: 1rem 0;
}

.checks-table,
.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.checks-table th,
.checks-table td,
.detail-table th,
.detail-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.checks-table th,
.detail-table th {
    font-weight: 600;
    background: var(--color-bg);
}

.checks-table tbody tr:hover,
.detail-table tbody tr:hover {
    background: #fafaf9;
}

code {
    font-family: ui-monospace, monospace;
    font-size: 0.9em;
    background: var(--color-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

/* Tulokset */
.result-meta {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.result-status {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.result-status-smile {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}

.result-status-neutral {
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.result-status-sad {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.result-status-error {
    background: #f5f5f5;
    border: 1px solid var(--color-border);
}

.result-icon {
    font-size: 3rem;
    margin-right: 0.5rem;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

.override-note {
    display: block;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.error-message {
    color: var(--color-error);
    margin: 0.5rem 0 0 0;
}

.result-note {
    margin: 0.75rem 0 0 0;
    font-size: 0.95rem;
    color: var(--color-text-muted);
    line-height: 1.45;
}

.whois-meta {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.whois-meta strong {
    color: var(--color-text);
}

.recheck-form {
    margin: 1rem 0;
}

.result-details h3 {
    font-size: 1.1rem;
    margin: 1.25rem 0 0.5rem 0;
}

.result-details h3:first-of-type {
    margin-top: 0;
}

.detail-table td a {
    color: var(--color-primary);
    text-decoration: none;
}

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

.whois-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.whois-section h3 {
    font-size: 1.1rem;
    margin: 0 0 0.75rem 0;
}

.whois-output {
    background: var(--color-bg);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.8rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 24rem;
    overflow-y: auto;
}

.mx-block {
    margin-bottom: 1rem;
}

.host-chain {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
}

.badge-link {
    margin-top: 1.5rem;
}

/* Viestit */
.message {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.message-error {
    background: #fef2f2;
    color: var(--color-error);
    border: 1px solid #fecaca;
}

/* Sivutus */
.pagination ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.pagination li a {
    color: var(--color-primary);
    text-decoration: none;
}

.pagination li a:hover {
    text-decoration: underline;
}

.pagination-info {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* Badge-sivu */
.badge-preview {
    margin: 1rem 0;
}

.badge-meta {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.badge-code-note {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin: 0 0 0.5rem 0;
}

.badge-img {
    display: block;
}

.badge-code {
    margin: 1rem 0;
}

.badge-code pre {
    background: var(--color-bg);
    padding: 1rem;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.85rem;
}

.badge-code code {
    background: none;
    padding: 0;
}

/* Info-sivu */
.info-page {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.info-page h2 {
    margin-top: 0;
    font-size: 1.25rem;
}

.info-page h3 {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.5rem 0;
}

.info-page h3:first-of-type {
    margin-top: 0;
}

.info-intro {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.info-page p {
    margin: 0 0 0.75rem 0;
}

.changelog-entry + .changelog-entry {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.changelog-entry h2 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.changelog-entry ul {
    margin: 0.25rem 0 0 0;
    padding-left: 1.25rem;
}

.changelog-entry li {
    margin-bottom: 0.35rem;
}

/* Tilastot-sivu */
.stats-page {
    margin-bottom: 2rem;
}

.stats-page h2 {
    margin-top: 0;
    font-size: 1.25rem;
}

.stats-intro {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

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

.stats-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.stats-card h3 {
    font-size: 1.1rem;
    margin: 0 0 0.35rem 0;
}

.stats-desc {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin: 0 0 1rem 0;
}

.chart-wrap {
    min-height: 220px;
    margin-bottom: 0.75rem;
}

.chart-wrap.chart-line {
    min-height: 200px;
}

.chart-fallback {
    margin: 0;
    padding: 1rem;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.stats-legend li {
    margin: 0.25rem 0;
}

.legend-dot {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    background: var(--color-primary);
    margin-right: 0.35rem;
    vertical-align: middle;
}

.stats-card-full {
    margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
    .check-form {
        flex-direction: column;
        align-items: stretch;
    }

    .check-form input[type="text"] {
        min-width: 100%;
    }

    .checks-table th:nth-child(2),
    .checks-table td:nth-child(2) {
        display: none;
    }
}
