/* ======================================
   OSM Route Downloader — styles
   ====================================== */

.ws-osm-downloader {
    max-width: 800px;
    margin: 0 auto 2em;
    font-family: 'Roboto', Arial, sans-serif;
}

/* ---- Search form ---- */

.ws-osm-search {
    margin-bottom: 1.5em;
}

.ws-osm-search label {
    display: block;
    font-weight: 600;
    margin-bottom: .4em;
    font-size: 1.05em;
}

.ws-osm-search-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#ws-osm-id-input {
    flex: 1 1 200px;
    min-width: 180px;
    padding: 10px 14px;
    font-size: 1em;
    border: 2px solid #ccc;
    border-radius: 6px;
    transition: border-color .2s;
}

#ws-osm-id-input:focus {
    border-color: #2ea043;
    outline: none;
}

#ws-osm-fetch-btn {
    padding: 10px 24px;
    font-size: 1em;
    font-weight: 600;
    color: #fff;
    background: #2ea043;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background .2s, transform .1s;
    white-space: nowrap;
}

#ws-osm-fetch-btn:hover {
    background: #268c38;
}

#ws-osm-fetch-btn:active {
    transform: scale(.97);
}

#ws-osm-fetch-btn:disabled {
    background: #94d3a2;
    cursor: wait;
}

.ws-osm-hint {
    margin: .5em 0 0;
    font-size: .65em;
    color: #666;
}

.ws-osm-hint a {
    color: #2ea043;
}

/* ---- Progress bar ---- */

.ws-osm-progress {
    margin-bottom: 1.2em;
}

.ws-osm-progress-track {
    width: 100%;
    height: 8px;
    background: #e1e4e8;
    border-radius: 4px;
    overflow: hidden;
}

.ws-osm-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    background: linear-gradient(90deg, #2ea043, #3fb950);
    transition: width .4s ease;
}

.ws-osm-progress-fill.ws-progress-error {
    background: linear-gradient(90deg, #cf222e, #f85149);
}

.ws-osm-progress-fill.ws-progress-ok {
    background: linear-gradient(90deg, #2ea043, #3fb950);
}

.ws-osm-progress-msg {
    margin-top: 6px;
    font-size: .85em;
    color: #555;
    min-height: 1.3em;
}

/* ---- Result card ---- */

.ws-osm-route-card {
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 1.5em;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.ws-osm-route-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ws-osm-color-swatch {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    border: 2px solid rgba(0,0,0,.1);
    flex-shrink: 0;
}

.ws-osm-route-name {
    margin: 0;
    font-size: 1.5em;
    line-height: 1.2;
    color: #1f2328;
}

.ws-osm-route-ref {
    margin: .2em 0 0;
    font-size: .95em;
    color: #666;
}

/* ---- Tags table ---- */

.ws-osm-tags-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .92em;
}

.ws-osm-tags-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #eaecef;
    vertical-align: top;
}

.ws-tag-label {
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    width: 180px;
}

.ws-tag-value {
    color: #1f2328;
    word-break: break-word;
}

.ws-tag-value a {
    color: #2ea043;
    text-decoration: none;
}

.ws-tag-value a:hover {
    text-decoration: underline;
}

.ws-osm-inline-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 4px;
    border: 1px solid rgba(0,0,0,.15);
}

.ws-osm-members-info {
    margin-top: 12px;
    font-size: .9em;
}

.ws-osm-members-info a {
    color: #2ea043;
    text-decoration: none;
    font-weight: 500;
}

.ws-osm-members-info a:hover {
    text-decoration: underline;
}

/* ---- Route map ---- */

.ws-osm-map {
    height: 380px;
    margin-top: 16px;
    border-radius: 8px;
    border: 1px solid #d0d7de;
    overflow: hidden;
}

/* ---- Download buttons (inside card, above table) ---- */

.ws-osm-download-buttons {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 1em;
    padding-bottom: 1em;
    border-bottom: 1px solid #eaecef;
}

.ws-osm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    font-size: .95em;
    font-weight: 600;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none !important;
    transition: background-color .2s, transform .1s, box-shadow .2s;
    border: none;
    color: #fff !important;
}

.ws-osm-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,.15);
}

.ws-osm-btn:active {
    transform: translateY(0);
}

.ws-osm-btn-gpx {
    background-color: #0073aa;
}

.ws-osm-btn-gpx:hover {
    background-color: #005a87;
}

.ws-osm-btn-kml {
    background-color: #0073aa;
}

.ws-osm-btn-kml:hover {
    background-color: #005a87;
}

.ws-osm-btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ---- Success message ---- */

@keyframes wsFadeSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ws-osm-success {
    margin: .8em 0 0;
    padding: 10px 14px;
    font-size: .92em;
    color: #1a7f37;
    font-weight: 500;
    background: #dafbe1;
    border: 1px solid #a7d8b0;
    border-left: 3px solid #2ea043;
    border-radius: 4px;
    animation: wsFadeSlideIn .4s ease-out;
}

.ws-osm-success a {
    color: #1a7f37;
    text-decoration: underline;
    font-weight: 600;
}

.ws-osm-success a:hover {
    color: #116329;
}

.ws-osm-inline-error {
    margin: .8em 0 0;
    padding: 10px 14px;
    font-size: .92em;
    color: #82071e;
    font-weight: 500;
    background: #ffebe9;
    border: 1px solid #f0b8b8;
    border-left: 3px solid #cf222e;
    border-radius: 4px;
    animation: wsFadeSlideIn .4s ease-out;
}

/* ---- Info tooltip ---- */

.ws-osm-info-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin-left: 4px;
    color: #8b949e;
    transition: color .2s;
}

.ws-osm-info-trigger:hover,
.ws-osm-info-trigger:focus {
    color: #555;
    outline: none;
}

.ws-osm-info-icon {
    width: 20px;
    height: 20px;
}

.ws-osm-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    padding: 12px 14px;
    background: #24292f;
    color: #e6edf3;
    font-size: .82em;
    font-weight: 400;
    line-height: 1.45;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    z-index: 100;
    pointer-events: auto;
}

.ws-osm-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #24292f;
}

.ws-osm-tooltip a {
    color: #58a6ff;
    text-decoration: underline;
}

.ws-osm-tooltip a:hover {
    color: #79c0ff;
}

.ws-osm-tooltip strong {
    color: #fff;
}

.ws-osm-info-trigger:hover .ws-osm-tooltip,
.ws-osm-info-trigger:focus .ws-osm-tooltip,
.ws-osm-info-trigger:focus-within .ws-osm-tooltip {
    display: block;
}

.ws-osm-tooltip.ws-tooltip-open {
    display: block;
}

/* Close button — hidden on desktop, visible on mobile */
.ws-osm-tooltip-close {
    display: none;
}

/* ---- Error ---- */

.ws-osm-error {
    background: #ffebe9;
    border: 1px solid #cf222e;
    color: #82071e;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 1.5em;
    font-weight: 500;
}

/* ---- Responsive ---- */

@media (max-width: 600px) {
    .ws-osm-route-card {
        padding: 14px 16px;
    }

    .ws-tag-label {
        width: auto;
        display: block;
    }

    .ws-osm-tags-table td {
        display: block;
        padding: 3px 6px;
    }

    .ws-osm-tags-table tr {
        display: block;
        border-bottom: 1px solid #eaecef;
        padding: 4px 0;
    }

    .ws-osm-tags-table td {
        border-bottom: none;
    }

    .ws-osm-download-buttons {
        flex-direction: column;
    }

    .ws-osm-btn {
        justify-content: center;
    }

    .ws-osm-tooltip {
        left: auto;
        right: -10px;
        transform: none;
        width: 260px;
        padding: 12px 14px 12px 14px;
    }

    .ws-osm-tooltip::after {
        left: auto;
        right: 14px;
        transform: none;
    }

    .ws-osm-tooltip-close {
        display: block;
        position: absolute;
        top: 4px;
        right: 6px;
        background: none;
        border: none;
        color: #8b949e;
        font-size: 1.3em;
        line-height: 1;
        cursor: pointer;
        padding: 2px 6px;
    }

    .ws-osm-tooltip-close:hover {
        color: #fff;
    }
}
