/* ============ Base layout ============ */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

#map {
    width: 100%;
    height: 100%;
    position: absolute;
    overflow: hidden;
}

/* ============ Navigation ============ */
#nav-bar {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 8px 14px;
    z-index: 1001;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 10px;
    font-family: Arial, sans-serif;
}

.nav-link {
    color: #444;
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.nav-link:hover {
    background-color: #eee;
}

.nav-link.active {
    background-color: #eef8f0;
    border: 1px solid #bde5c8;
    color: #2e7d32;
}

.nav-divider {
    width: 1px;
    height: 24px;
    background-color: #ccc;
    margin: 0 6px;
    align-self: center;
    opacity: 0.8;
}

/* ============ Labeling buttons ============ */

#buttons {
    position: fixed;
    bottom: calc(var(--table-height, 5%) + 30px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    gap: 15px;
}

.btn {
    font-size: 20px;
    padding: 15px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.btn-match {
    background: #4caf50;
    color: white;
}

.btn-no-match {
    background: #ff4d4d;
    color: white;
}

.btn-unsure {
    background: #f0ad4e;
    color: white;
}

.btn-submit {
    background: #4caf50;
    color: white;
}

.btn:hover {
    opacity: 0.8;
}

/* ============ Tutorial panel ============ */
#tutorial {
    position: absolute;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    z-index: 1000;
    width: 40%;
    font-size: 15px;
    font-family: Arial, sans-serif;
}

#tutorial p {
    margin-bottom: 15px;
}

/* ============ Form elements ============ */
.form-row {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.input-field,
.select-field {
    flex: 1 1 220px;
    min-width: 150px;
    max-width: 250px;
    padding: 14px 20px;
    font-size: 15px;
    border-radius: 10px;
    border: 1px solid #ccc;
}

.radio-group {
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
}

.radio-group label {
    margin-right: 20px;
}

.submit-button {
    margin-top: 15px;
    padding: 14px 20px;
    font-size: 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.submit-button:hover {
    background-color: #45a049;
}

/* ============ Legend ============ */
#legend {
    display: none;
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    font-size: 13px;
    font-family: Arial, sans-serif;
    width: max-content;
}

#legend.tutorial {
    display: block;
    bottom: 30px;
    right: 30px;
    top: auto;
    left: auto;
    transform: none;
}

#legend h4 {
    font-size: 14px;
    margin: 0 0 8px 0;
    text-align: center;
}

#legend ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#legend li {
    margin: 4px 0;
    display: flex;
    align-items: center;
}

#legend kbd {
    font-family: monospace;
    background: #eee;
    border: 1px solid #bbb;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    margin-right: 6px;
    min-width: 32px;
    text-align: center;
    color: #333;
}

.legend-divider {
    height: 1px;
    background-color: #ddd;
    margin: 10px 0;
}

#legend button {
    display: block;
    margin: 0 auto;
    padding: 6px 12px;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: #f5f5f5;
    cursor: pointer;
}

#legend button:hover {
    background-color: #eaeaea;
}

.legend-shortcut-hint {
    position: fixed;
    bottom: calc(var(--table-height, 0px));
    left: 0;
    background: rgba(255, 253, 253, 0.9);
    color: rgb(94, 94, 94);
    font-size: 9.5px;
    padding: 2px 2px;
    font-family: Arial, sans-serif;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    z-index: 1001;
    cursor: pointer;
}

.legend-shortcut-hint:hover {
    opacity: 1;
}

/* ============ Label feedback ============ */
#label-feedback {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 34px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#label-feedback.yes {
    color: #4CAF50;
}

#label-feedback.no {
    color: #ff4d4d;
}

#label-feedback.unsure {
    color: #f0ad4e;
}

#label-feedback.show {
    opacity: 1;
}

/* ============ Inline Feedback ============ */

.inline-feedback {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    font-size: 10px;
    color: #636f6b;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* ============ Scoreboard ============ */
#scoreboard {
    position: fixed;
    bottom: calc(var(--table-height, 0px) + 30px);
    overflow: visible;
    right: 30px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #ccc;
    padding: 10px 14px;
    width: 150px;
    max-height: 250px;
    font-family: Arial, sans-serif;
    font-size: 12px;
    z-index: 1001;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

#scoreboard-entries {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

#scoreboard-header {
    font-weight: bold;
    border-bottom: 1px solid #ccc;
    padding-bottom: 4px;
    margin-bottom: 6px;
}

.score-entry {
    display: flex;
    align-items: center;
}

.score-user {
    flex: 1.2;
    color: #333;
    font-size: 12px;
    text-align: left;
}

.score-count {
    flex: 0.6;
    font-size: 12px;
    text-align: right;
    padding-right: 9px;
    color: #333;
}

.score-kappa {
    flex: 0.6;
    font-size: 12px;
    text-align: right;
    color: #333;
}

.scoreboard-footer {
    text-align: center;
    color: #aaa;
    font-size: 0.9em;
    margin-top: 0.5em;
}

.kappa-value {
    font-weight: bold;
}

.kappa-excellent {
    color: #4caf50;
}

.kappa-high {
    color: #8bc34a;
}

.kappa-medium {
    color: #ff9800;
}

.kappa-low {
    color: #f44336;
}

/* ============ Tooltips ============ */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    height: auto;
    gap: 6px;
}

.custom-tooltip {
    visibility: hidden;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 3px 8px;
    position: absolute;
    z-index: 2002;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    font-size: 11px;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.tooltip-container:hover .custom-tooltip {
    visibility: visible;
    opacity: 1;
}

.notes-tooltip {
    font-size: 14px;
}

/* ============ Attributes table ============ */
.attr-table-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    min-height: 15%;
    max-height: 40%;
    overflow: visible;
    background: #f8f8f8;
    border-top: 1px solid #ddd;
    padding: 20px;
    z-index: 1000;
    font-family: Arial, sans-serif;
}

/* Table wrapper for horizontal scrolling */
.attr-table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
}

/* Adjust map height only when attributes table is present */
body:has(.attr-table-container) #map {
    height: calc(100% - var(--table-height, 200px)) !important;
}

.attr-table {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
    margin: 0 auto;
    font-family: 'Helvetica', sans-serif;
}

.attr-table th,
.attr-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.attr-table th {
    background-color: #ffffff;
    color: #0a0a0a;
    position: sticky;
    top: 0;
    z-index: 3;
}

.attr-table code {
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: 12px;
}

.attr-table-row-a {
    border-left: 6px solid #539edfff;
    background: rgba(42, 129, 203, 0.06);
}

.attr-table-row-b {
    border-left: 6px solid rgb(191, 51, 201);
    background: rgba(126, 87, 194, 0.06);
}

.map-link {
    text-decoration: none;
    font-size: 22px;
    line-height: 1;
}

/* ============ Info page ============ */
.page-centered {
    background: #f5f9f7;
    font-family: Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.info-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px 50px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    text-align: center;
    max-width: 520px;
}

.info-box p {
    font-size: 16px;
    color: #444;
    margin-bottom: 28px;
}

.info-box h1 {
    color: #54a7d3;
    font-size: 28px;
}

.info-box h2 {
    color: #54a7d3;
}

.info-box.success h1 {
    color: #4CAF50;
}

.info-box.error h1 {
    color: #e74747;
}

.info-button-group {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
}

.info-button {
    display: inline-block;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: background-color 0.2s ease;
    background-color: #eee;
    color: #333;
    border: 1px solid #bbb;
}

.info-button:hover {
    background-color: #ddd;
}

.info-button.success {
    background-color: #4CAF50;
    color: #fff;
}

.info-button.success:hover {
    background-color: #43a047;
}

/* ============ Split chooser ============ */
body.page-split {
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.split-chooser {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.split-chooser .pane {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
    transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
    outline: none;
}

.split-chooser .pane span {
    font-family: Arial, sans-serif;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: clamp(24px, 6.5vw, 80px);
    color: #1f2937;
    user-select: none;
}

.split-chooser .pane-left {
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}

.split-chooser .pane-right {
    border-left: 1px solid rgba(0, 0, 0, 0.06);
}

.split-chooser .pane-left {
    background: #f0f4e8;
}

.split-chooser .pane-right {
    background: #f5e7df;
}

.split-chooser .pane-left:hover,
.split-chooser .pane-left:focus-visible {
    background: #e4ecd8;
    transform: scale(1.01);
    box-shadow: inset 0 0 0 9999px rgba(76, 175, 80, 0.04);
}

.split-chooser .pane-right:hover,
.split-chooser .pane-right:focus-visible {
    background: #eed7cb;
    transform: scale(1.01);
    box-shadow: inset 0 0 0 9999px rgba(59, 130, 246, 0.04);
}

/* Mobile: stack vertically for narrow screens */
@media (max-width: 800px) {
    .split-chooser {
        flex-direction: column;
    }

    .split-chooser .pane-left,
    .split-chooser .pane-right {
        border: 0;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }
}

/* ============ Notes box ============ */
.notes-box-container {
    max-width: 700px;
    display: flex;
    flex-direction: column;
    margin: auto;
    margin-top: 15px;
    gap: 6px;
}

.notes-box {
    width: 100%;
    min-height: 48px;
    max-height: 96px;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    resize: vertical;
    overflow: hidden;
    box-sizing: border-box;
}
