/* Modal Styles */

/* Modal overlay */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal[style*="display: flex"] {
    display: flex !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal content */
.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    position: relative;
}

.modal-content.modal-large {
    max-width: 900px;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal header */
.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.modal-header .btn-icon-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.modal-header .btn-icon-small:hover {
    background: #e5e7eb;
    color: #374151;
    transform: rotate(90deg);
}

/* Modal body */
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Modal footer */
.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    flex-shrink: 0;
}

/* Import tabs */
.import-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.tab-btn:hover {
    color: #374151;
}

.tab-btn.active {
    background: white;
    color: #2d5016;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* GPX Upload Area */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    background: #f9fafb;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #9ca3af;
    background: #f3f4f6;
}

.upload-area.dragover {
    border-color: #2d5016;
    background: rgba(45, 80, 22, 0.05);
}

.upload-area i {
    font-size: 3rem;
    color: #2d5016;
    margin-bottom: 1rem;
    display: block;
}

.upload-area h3 {
    margin: 1rem 0;
    color: #1f2937;
    font-size: 1.25rem;
}

.upload-area p {
    color: #6b7280;
    margin: 0.5rem 0;
}

.upload-area label {
    display: inline-block;
    margin-top: 1rem;
}

/* GPX Preview */
#gpxPreview {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 12px;
}

#gpxPreview h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #1f2937;
}

.gpx-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-item {
    text-align: center;
}

.stat-item i {
    color: #2d5016;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: block;
}

.stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0.25rem 0;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: #6b7280;
}

/* OSM Search */
.osm-search-section {
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.osm-results {
    margin-top: 1.5rem;
}

.trails-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.trails-list::-webkit-scrollbar {
    width: 6px;
}

.trails-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.trails-list::-webkit-scrollbar-thumb {
    background: #9ca3af;
    border-radius: 3px;
}

.trails-list::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.trail-item {
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.trail-item:hover {
    border-color: #9ca3af;
    transform: translateX(4px);
}

.trail-item.selected {
    border-color: #2d5016;
    background: rgba(45, 80, 22, 0.05);
}

.trail-item h4 {
    margin: 0 0 0.5rem 0;
    color: #1f2937;
    font-size: 1.1rem;
}

.trail-info {
    display: flex;
    gap: 1rem;
    align-items: center;
    color: #6b7280;
    font-size: 0.9rem;
}

.trail-info .difficulty {
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
}

.trail-info .difficulty.easy {
    background: #10b981;
    color: white;
}

.trail-info .difficulty.moderate {
    background: #f59e0b;
    color: white;
}

.trail-info .difficulty.hard {
    background: #ef4444;
    color: white;
}

/* Trail Map */
.trail-map {
    border-radius: 12px;
    overflow: hidden;
    margin-top: 1.5rem;
    border: 2px solid #e5e7eb;
    background: white;
}

/* Form elements in modal */
.modal .form-group {
    margin-bottom: 1.25rem;
}

.modal .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.95rem;
}

.modal .form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
    background: white;
}

.modal .form-control:focus {
    outline: none;
    border-color: #2d5016;
    box-shadow: 0 0 0 3px rgba(45, 80, 22, 0.1);
}

.modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal .form-col {
    display: flex;
    flex-direction: column;
}

/* Buttons in modal */
.modal .btn-primary {
    background: #2d5016;
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.modal .btn-primary:hover:not(:disabled) {
    background: #1e3a11;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 80, 22, 0.3);
}

.modal .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal .btn-secondary {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.modal .btn-secondary:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* No results message */
.no-results {
    text-align: center;
    color: #6b7280;
    padding: 3rem 1rem;
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 1rem;
    }

    .modal-content.modal-large {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .gpx-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .modal .form-row {
        grid-template-columns: 1fr;
    }

    .import-tabs {
        flex-direction: column;
    }

    .modal-footer {
        flex-direction: column;
        gap: 0.75rem;
    }

    .modal-footer button {
        width: 100%;
    }
}