:root {
    /* colour palette */
    --primary: #1976d2;
    --primary-light: #63a4ff;
    --border-radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
        Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* Minimal Header */
.header-minimal {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0 1rem 0;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    box-shadow: 0 2px 6px rgba(25, 118, 210, 0.08);
}
.logo-title {
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    letter-spacing: 2px;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 1rem 2rem 1rem;
    max-width: 480px;
    margin: 0 auto;
}

/* Search Card */
.search-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 24px rgba(25, 118, 210, 0.08);
    padding: 1.25rem 1rem 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 0.5rem;
    animation: fadeInCard 0.6s cubic-bezier(.4,0,.2,1);
}
@keyframes fadeInCard {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
}

.search-label {
    font-size: 1.12rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--primary);
}

.search-fields {
    display: flex;
    gap: 0.5rem;
}
.search-fields select {
    flex: 0 0 50%;
    max-width: 50%;
    min-width: 0;
}
.search-fields input[type="search"] {
    flex: 0 0 50%;
    max-width: 50%;
    min-width: 0;
}
@media (max-width: 600px) {
    .search-fields select,
    .search-fields input[type="search"] {
        flex: 0 0 50%;
        max-width: 50%;
        min-width: 0;
    }
}

.search-form select,
.search-form input[type="search"] {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    width: 100%;
    background: #f9faff;
}

.search-form input[type="search"] {
    flex: 2;
}

.search-form button,
.search-btn {
    padding: 0.9rem 0;
    font-size: 1.1rem;
    border: none;
    border-radius: var(--border-radius);
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 0.7rem;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.10);
    transition: background 0.3s, box-shadow 0.3s, transform 0.15s;
}
.search-form button:active,
.search-btn:active {
    background: var(--primary-light);
    box-shadow: 0 1px 3px rgba(25, 118, 210, 0.08);
    transform: scale(0.98);
}

/* Status Card - reused existing styles, but ensure mobile layout spacing */
.search-status-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fffbe7;
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 12px rgba(255, 193, 7, 0.10);
    padding: 1.1rem 1rem 1.1rem 1rem;
    margin-top: 0.5rem;
    transition: box-shadow 0.2s, background 0.3s;
    cursor: pointer;
    outline: none;
    position: relative;
    overflow: hidden;
}
.search-status-card:active {
    box-shadow: 0 1px 4px rgba(255, 193, 7, 0.06);
}
.status-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    position: relative;
    margin-right: 0.5rem;
    padding: 0;
}
.status-icon svg {
    width: 32px;
    height: 32px;
    display: block;
}
.spinner {
    display: block;
}
@keyframes spinner-rotate {
    100% {
        transform: rotate(360deg);
    }
}
.status-ongoing .status-icon {
    background: #fff3e0;
}
.status-finished {
    background: #e8f5e9;
    box-shadow: 0 2px 12px rgba(56, 142, 60, 0.10);
}
.status-finished .status-icon {
    background: #e8f5e9;
}
.status-error {
    background: #ffebee;
    box-shadow: 0 2px 12px rgba(229, 57, 53, 0.10);
}
.status-error .status-icon {
    background: #ffebee;
}

.status-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    gap: 0.25rem;
}
.status-label {
    font-size: 1.07rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
    color: #ff9800;
    transition: color 0.3s;
}
.status-finished .status-label {
    color: #388e3c;
}
.status-error .status-label {
    color: #e53935;
}
.status-name {
    font-size: 0.98rem;
    color: #333;
}
@media (max-width: 600px) {
    .search-status-card {
        padding: 1rem 0.5rem 1rem 0.5rem;
    }
    .status-icon {
        width: 28px;
        height: 28px;
        font-size: 1.2rem;
        margin-right: 0.3rem;
    }
    .status-label {
        font-size: 1rem;
    }
    .status-name {
        font-size: 0.93rem;
    }
}


.search-status-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}
.search-status-label {
    font-size: 0.98rem;
    font-weight: 500;
    color: #888;
}
.search-status-info {
    font-size: 1.05rem;
    font-weight: 600;
    color: #222;
    display: flex;
    gap: 0.5rem;
}
.search-status-state {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--primary);
    margin-top: 0.15rem;
}

/* Responsive tweaks */
@media (max-width: 600px) {
    .main-content {
        padding: 1rem 0.5rem 1.5rem 0.5rem;
        max-width: 100vw;
    }
    .search-card, .search-status-card {
        padding: 1rem 0.5rem 1rem 0.5rem;
    }
    .logo-title {
        font-size: 1.5rem;
    }
    .search-form button, .search-btn {
        font-size: 1rem;
        padding: 0.8rem 0;
    }
    .search-status-info {
        font-size: 0.97rem;
    }
}

/* Hide old header class */
.header { display: none; }

/* Search container */
.search-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Inputs */
.search-form select,
.search-form input[type="search"] {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: var(--border-radius);
    width: 100%;
}

.search-form input[type="search"] {
    flex: 1;
}

.search-form button {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: none;
    border-radius: var(--border-radius);
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: background 0.3s;
}

.search-form button:hover,
.search-form button:focus-visible {
    background: var(--primary-light);
}

/* Desktop & tablets (≥ 600px) */

/* Login styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(120deg, #f0f6fa 0%, #e3eefd 100%);
}
.login-form {
    background: #fff;
    padding: 2.5rem 2rem 2rem 2rem;
    border-radius: 1.2rem;
    box-shadow: 0 4px 24px rgba(25, 118, 210, 0.08);
    min-width: 320px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.login-title {
    margin: 0 0 1.5rem 0;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: #1976d2;
    letter-spacing: 1px;
}
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.input-group label {
    font-weight: 500;
    color: #333;
}
.input-group input {
    padding: 0.75rem 1rem;
    border: 1px solid #b6c6e3;
    border-radius: 0.7rem;
    font-size: 1rem;
    outline: none;
    transition: border 0.2s;
    background: #f7faff;
}
.input-group input:focus {
    border-color: #1976d2;
    background: #fff;
}
.login-btn {
    padding: 0.8rem 1rem;
    background: #1976d2;
    color: #fff;
    border: none;
    border-radius: 0.7rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: background 0.2s;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.08);
}
.login-btn:hover,
.login-btn:focus-visible {
    background: #1252a2;
}

/* Search Status Card styles */
.search-status-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: #fff;
    border-radius: 1.2rem;
    box-shadow: 0 4px 24px rgba(25, 118, 210, 0.08);
    padding: 1.5rem 2rem;
    margin: 1.5rem 0 0 0;
    text-decoration: none;
    transition: box-shadow 0.18s, transform 0.18s;
    cursor: pointer;
    min-width: 0;
    border-left: 8px solid #1976d2;
}
.search-status-card:hover, .search-status-card:focus-visible {
    box-shadow: 0 8px 32px rgba(25, 118, 210, 0.13);
    transform: translateY(-2px) scale(1.02);
    border-left-color: #1252a2;
}
.search-status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: #f0f6fa;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(25, 118, 210, 0.06);
    margin-right: 0.5rem;
}
.search-status-icon .dot {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffc107;
    box-shadow: 0 0 0 3px #fff3cd;
}
.search-ongoing .search-status-icon .dot {
    background: #ffc107;
    box-shadow: 0 0 0 3px #fff3cd;
}
.search-finished .search-status-icon .dot {
    background: #4caf50;
    box-shadow: 0 0 0 3px #e8f5e9;
}
.search-error .search-status-icon .dot {
    background: #e53935;
    box-shadow: 0 0 0 3px #ffebee;
}
.search-status-details {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}
.search-status-label {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1976d2;
    margin-bottom: 0.2rem;
    letter-spacing: 0.5px;
}
.search-status-info {
    display: flex;
    gap: 0.7rem;
    font-size: 1.05rem;
    color: #333;
    flex-wrap: wrap;
}
.search-type {
    background: #e3eefd;
    color: #1976d2;
    padding: 0.2em 0.75em;
    border-radius: 0.7em;
    font-weight: 500;
    font-size: 1rem;
}
.search-query {
    font-weight: 500;
    color: #444;
    background: #f7faff;
    padding: 0.2em 0.75em;
    border-radius: 0.7em;
    font-size: 1rem;
}
.search-status-state {
    margin-top: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #856404;
    letter-spacing: 0.5px;
}
.search-ongoing .search-status-state {
    color: #856404;
}
.search-finished .search-status-state {
    color: #155724;
}
.search-error .search-status-state {
    color: #e53935;
}

.source-info {
    display: block;
    font-size: 0.7em;
    color: #888;
    font-style: normal;
    margin-top: 2px;
    line-height: 1.3;
    font-weight: normal;
    white-space: normal;
    word-break: break-word;
}

/* Dashboard styles */
.dashboard-container {
    max-width: 480px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 1.2rem;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
}
.logout-btn {
    align-self: flex-end;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.6em 1.2em;
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 2rem;
    transition: background 0.2s;
}
.logout-btn:hover {
    background: #c0392b;
}
.search-status-btn {
    width: 100%;
    padding: 2rem 1rem;
    font-size: 1.5rem;
    border: none;
    border-radius: 1rem;
    background: #f0f6fa;
    color: #222;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-bottom: 1.5rem;
    transition: background 0.2s;
}
.search-status-btn.finished {
    background: #d4edda;
    color: #155724;
}
.search-status-btn.ongoing {
    background: #fff3cd;
    color: #856404;
}
.search-status-btn.error {
    background: #f8d7da;
    color: #721c24;
}
.status-label {
    font-size: 1.1rem;
    margin-top: 0.5rem;
    font-weight: 500;
}
/* Topbar styles for results.html */
.topbar {
    width: 100%;
    background: #f0f6fa;
    padding: 1rem 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}
.back-to-dashboard {
    color: #1976d2;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 0.4em 1em;
    border-radius: 0.5em;
    transition: background 0.15s;
}
.back-to-dashboard:hover {
    background: #e3eefd;
}

@media (min-width: 600px) {
    .search-form {
        flex-direction: row;
        align-items: center;
    }

    .search-form select {
        max-width: 200px;
    }

    .search-form button {
        width: auto;
    }
}

/* main content */
main {
    padding: 1.5rem;
    text-align: center;
}

.viewer {
    margin: 2rem auto 0 auto;
    max-width: 480px;
    text-align: left;
}
.results-heading {
    margin: 0 0 1.2rem 0;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--primary);
    padding-left: 0.2em;
}

.section {
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    background: #fff;
    overflow: hidden;
    transition: box-shadow 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.section-header {
    cursor: pointer;
    padding: 1rem 1.2rem;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    user-select: none;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    border: none;
    width: 100%;
    outline: none;
    gap: 0.7em;
}
.section-header .arrow {
    display: inline-block;
    transition: transform 0.25s cubic-bezier(.4,2,.6,1);
    font-size: 1.2em;
}

.section-header:hover, .section-header:focus-visible {
    background: var(--primary-light);
}
.section-content {
    padding: 1rem 1.2rem;
    background: #fafcff;
    transition: max-height 0.3s, padding 0.3s;
    border-top: 1px solid #e0e0e0;
    overflow-y: auto;
    overscroll-behavior: contain;

}

.section.collapsed .section-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    opacity: 0.5;
}
.section:not(.collapsed) .arrow {
    transform: rotate(90deg);
}

.section:not(.collapsed) .section-content {
    max-height: none;
    opacity: 1;
}
.section-content ul {
    margin: 0;
    padding-left: 1.1em;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.2em;
    font-size: 1rem;
}
table.info-table {
    width: 100% !important;
    table-layout: fixed !important;
    font-size: 0.97em !important;
}

.info-table th {
    padding: 0.7em 1em 0.7em 1em;
    font-weight: 600;
    color: #555;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: top;
    width: 40%;
    font-size: 0.97em !important;
    background: #f0f6fa;
}
.info-table td {
    padding: 0.7em 1em;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: middle;
    font-size: 0.97em !important;
    line-height: 1.3 !important;
    word-break: break-word;
    width: 60%;
    overflow-wrap: break-word;
    display: table-cell;
}

.locations-list {
    margin-top: 1.5em;
    padding: 0.6em 0.2em 0.2em 0.2em;
}

.locations-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.locations-list h3 {
    margin: 0 0 0.7em 0;
    font-size: 1.08em;
    color: var(--primary);
    font-weight: 600;
}
.locations-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.98em;
    background: #f8fbfd;
    margin-top: 0.5em;
    border-radius: 0.3em;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.locations-table th, .locations-table td {
    border: 1px solid #e0e0e0;
    padding: 0.55em 0.9em;
    text-align: left;
}
.locations-table th:first-child, .locations-table td:first-child {
    border-left: none;
}
.locations-table th:last-child, .locations-table td:last-child {
    border-right: none;
}
.locations-table th {
    background: #f0f6fa;
    font-weight: 600;
}
.locations-table a {
    color: var(--primary);
    text-decoration: underline;
    font-size: 0.97em;
}
@media (max-width: 600px) {
    .info-table, .locations-table {
        font-size: 0.9em;
    }
    .locations-table th, .locations-table td, .info-table th, .info-table td {
        padding: 0.3em 0.4em;
        font-size: 0.9em;
        vertical-align: middle;
    }
    .locations-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
