/* ── Trail Traveler GPX Editor ── */

#tte-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 900px;
    margin: 0 auto;
    color: #1a1a1a;
}

/* ── Header card ── */
#tte-form-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    margin-bottom: 20px;
}

#tte-header {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #1a3a2a 0%, #2d6a4f 100%);
    color: #fff;
    padding: 24px 28px;
}

#tte-header svg {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    color: #74c69d;
}

#tte-header h2 {
    margin: 0 0 4px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    border: none;
    padding: 0;
}

#tte-header p {
    margin: 0;
    font-size: .875rem;
    color: #b7e4c7;
}

/* ── Toolbar ── */
#tte-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
}

.tte-toolbar-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.tte-toolbar-divider {
    width: 1px;
    height: 32px;
    background: #e2e8f0;
    flex-shrink: 0;
    margin: 0 4px;
}

/* ── Buttons ── */
.tte-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 9px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all .15s;
    white-space: nowrap;
    font-family: inherit;
    line-height: 1;
}

.tte-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.tte-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* Primary — import */
.tte-btn--primary {
    background: linear-gradient(135deg, #2d6a4f, #1b4332);
    color: #fff;
    border-color: transparent;
}
.tte-btn--primary:hover:not(:disabled) {
    opacity: .88;
    transform: translateY(-1px);
}

/* Secondary — add track */
.tte-btn--secondary {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}
.tte-btn--secondary:hover:not(:disabled) {
    background: #bae6fd;
}

/* Ghost — center, undo */
.tte-btn--ghost {
    background: #f8fafc;
    color: #475569;
    border-color: #e2e8f0;
}
.tte-btn--ghost:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* Danger — clear all */
.tte-btn--danger {
    background: #fff0f0;
    color: #b91c1c;
    border-color: #fecaca;
}
.tte-btn--danger:hover:not(:disabled) {
    background: #fee2e2;
}

/* Tool buttons — trim, split, extend, delete */
.tte-btn--tool {
    background: #f8fafc;
    color: #374151;
    border-color: #e2e8f0;
}
.tte-btn--tool:hover:not(:disabled) {
    background: #f0faf4;
    border-color: #2d6a4f;
    color: #2d6a4f;
}
.tte-btn--tool.tte-active {
    background: #2d6a4f;
    color: #fff;
    border-color: #2d6a4f;
}

.tte-btn--tool-danger.tte-active {
    background: #dc2626;
    border-color: #dc2626;
}

/* Split active */
.tte-btn--tool[data-mode="split"].tte-active {
    background: #7c3aed;
    border-color: #7c3aed;
}

/* Extend finalize state */
.tte-btn--finalize {
    background: #0369a1 !important;
    color: #fff !important;
    border-color: #0369a1 !important;
}

/* Snap toggle */
.tte-btn--snap {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}
.tte-btn--snap:hover { background: #fde68a; }
.tte-btn--snap.snap-off {
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}

/* Export */
.tte-btn--export {
    background: linear-gradient(135deg, #2d6a4f, #1b4332);
    color: #fff;
    border-color: transparent;
    padding: 11px 22px;
    font-size: .9rem;
    border-radius: 10px;
    flex-shrink: 0;
}
.tte-btn--export:hover:not(:disabled) {
    opacity: .88;
    transform: translateY(-1px);
}

/* ── Map ── */
#tte-map-wrap {
    position: relative;
    margin-bottom: 16px;
}

#tte-map {
    height: 560px;
    width: 100%;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
    overflow: hidden;
}

/* ── Status + footer ── */
#tte-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

#tte-status {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #2d6a4f;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: .875rem;
    color: #374151;
    font-weight: 500;
    min-width: 200px;
}

#tte-status svg { color: #2d6a4f; }

#tte-status.tte-status--error {
    border-left-color: #dc2626;
    background: #fff0f0;
    color: #b91c1c;
}
#tte-status.tte-status--error svg { color: #dc2626; }

/* ── Segment list ── */
#tte-seg-list {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    margin-bottom: 24px;
}

#tte-seg-heading {
    margin: 0;
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 700;
    color: #1a3a2a;
    border-bottom: 1px solid #f1f5f9;
    border: none;
}

#tte-seg-items {
    padding: 8px 16px 16px;
}

.tte-seg-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-bottom: 1px solid #f1f5f9;
    font-size: .875rem;
}
.tte-seg-item:last-child { border-bottom: none; }

.tte-seg-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.tte-seg-name {
    flex: 1;
    font-weight: 600;
    color: #1a1a1a;
}

.tte-seg-pts {
    font-size: .78rem;
    color: #94a3b8;
}

/* Trim handle markers */
.tte-trim-handle {
    background: transparent;
    border: none;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    #tte-toolbar { padding: 12px 16px; gap: 6px; }
    .tte-toolbar-divider { display: none; }
    #tte-map { height: 380px; }
    .tte-btn { padding: 7px 10px; font-size: .8rem; }
    #tte-footer { flex-direction: column; align-items: stretch; }
    .tte-btn--export { text-align: center; justify-content: center; }
}

/* ── Print ── */
@media print {
    #tte-form-card,
    #tte-footer,
    #tte-seg-list { display: none !important; }
    #tte-map { height: 600px !important; border-radius: 0 !important; }
}
