/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2196F3;
    --success-color: #4CAF50;
    --warning-color: #FFC107;
    --danger-color: #F44336;
    --purple-color: #9C27B0;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --shadow-light: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-heavy: 0 8px 16px rgba(0,0,0,0.2);
    --border-radius: 12px;
    --header-height: 60px;
    --bottom-nav-height: 70px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Paper Texture Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(255,255,255,.15) 1px, transparent 0);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: -1;
}
.app-logo {
    height: 50px;   /* ajuste conforme o tamanho da sua logo */
    width: auto;
    margin-right: 10px;
}


/* Header */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--surface-color);
    box-shadow: var(--shadow-medium);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.app-header .header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0; /* Permite que o texto seja truncado se necessário */
}

.app-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Header Actions Organization */
.header-actions .route-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.header-actions .utility-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    border-left: 1px solid var(--border-color);
    padding-left: 8px;
    margin-left: 4px;
}

/* Header buttons styling */
.header-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
    white-space: nowrap;
}

.header-btn i {
    margin-right: 5px;
}

/* Language selector */
.language-selector {
    display: flex;
    align-items: center;
}

.language-select {
    padding: 6px 10px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.language-select:hover {
    border-color: var(--primary-color);
}

.language-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

/* Mobile Menu Toggle (for very small screens) */
.mobile-menu-toggle {
    display: none;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.mobile-menu-toggle:hover {
    background: var(--primary-hover);
}

.mobile-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    padding: 8px;
    min-width: 200px;
    z-index: 1001;
}

.mobile-menu.active {
    display: block;
}

.mobile-menu .mobile-menu-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-bottom: 2px;
}

.mobile-menu .mobile-menu-item:hover {
    background: var(--hover-color);
}

.mobile-menu .mobile-menu-item i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-light);
}

.btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* Main Content */
.app-main {
    margin-top: var(--header-height);
    margin-bottom: var(--bottom-nav-height);
    min-height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
}

.section {
    display: none;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

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

/* Map Container */
.map-container {
    position: relative;
    height: 50vh;
    min-height: 300px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    margin-bottom: 20px;
}

#map {
    width: 100%;
    height: 100%;
}

/* Map help text */
.map-help {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 1000;
    pointer-events: none;
}

.help-text {
    background: rgba(33, 150, 243, 0.9);
    color: white;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    box-shadow: var(--shadow-medium);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideInTop 0.5s ease;
}

.help-text i {
    font-size: 1.1rem;
    opacity: 0.9;
}

@keyframes slideInTop {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.map-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.route-info {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--surface-color);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    min-width: 200px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.info-item:last-child {
    margin-bottom: 0;
}

.label {
    font-weight: 600;
    color: var(--text-secondary);
}

.safety-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
}

.safety-indicator.safe {
    color: var(--success-color);
}

.safety-indicator.moderate {
    color: var(--warning-color);
}

.safety-indicator.unsafe {
    color: var(--danger-color);
}

/* Weather Widget */
.weather-widget {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-medium);
    margin-bottom: 20px;
}

.weather-content {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.weather-icon {
    font-size: 2rem;
    color: var(--warning-color);
}

.weather-details {
    flex: 1;
}

#weatherTemp {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

#weatherDesc {
    color: var(--text-secondary);
    text-transform: capitalize;
}

#weatherWind {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.weather-recommendation {
    padding: 10px;
    background: rgba(33, 150, 243, 0.1);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-success, .btn-danger {
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: var(--shadow-light);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-primary:hover, .btn-secondary:hover, .btn-success:hover, .btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-danger:active {
    transform: scale(0.98);
    background: #c62828;
}

/* Special styling for delete button in modal */
.modal .form-actions .btn-danger {
    margin-right: auto;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.view-toggle {
    display: flex;
    gap: 5px;
}

.btn-toggle {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border-color);
    background: var(--surface-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-toggle.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Routes Container */
.routes-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.routes-container.list-view {
    grid-template-columns: 1fr;
}

.route-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
    cursor: pointer;
}

.route-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.route-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.route-card h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.route-card-actions {
    display: flex;
    gap: 5px;
}

.route-card-actions button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.route-card-actions button:hover {
    background: var(--border-color);
}

.route-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.route-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.route-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag {
    background: rgba(33, 150, 243, 0.1);
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* Community Filters */
.community-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#communityFilter {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--surface-color);
    font-size: 0.9rem;
    min-width: 150px;
}

#communitySearch {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    min-width: 200px;
}

#communitySearch:focus, #communityFilter:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Community Routes */
.community-routes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.community-route-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
}

.community-route-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.community-route-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.route-author {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.author-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.route-rating {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 15px;
}

.stars {
    color: var(--warning-color);
}

/* Challenges */
.challenges-tabs {
    display: flex;
    margin-bottom: 20px;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 5px;
    box-shadow: var(--shadow-light);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.tab-content {
    display: none;
}

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

.challenge-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow-light);
    border-left: 4px solid var(--primary-color);
}

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.challenge-progress {
    margin: 15px 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success-color);
    transition: width 0.3s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

.challenge-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.challenge-actions button {
    font-size: 0.8rem;
    padding: 8px 16px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.challenge-actions .participants {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Empty States */
.empty-state, .loading-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i, .loading-state i {
    font-size: 3rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.loading-state i.fa-spin {
    color: var(--primary-color);
    opacity: 1;
}

/* FAQ Section */
.faq-section {
    background: var(--surface-color);
    margin: 20px;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-primary);
    font-size: 1.8rem;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.faq-question {
    width: 100%;
    padding: 20px 0;
    border: none;
    background: none;
    text-align: left;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.3s ease;
}

.faq-question:hover {
    color: var(--primary-color);
}

.faq-icon {
    font-size: 1.2rem;
    font-weight: 300;
    transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 0 20px 0;
    color: var(--text-secondary);
    line-height: 1.6;
    animation: slideDown 0.3s ease;
}

.faq-answer[hidden] {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 5px;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    padding: 0 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 15px;
    padding: 20px;
    justify-content: flex-end;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--surface-color);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    display: flex;
    z-index: 1000;
    margin-bottom: 59px;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    padding: 8px;
}

.nav-item.active {
    color: var(--primary-color);
    background: rgba(33, 150, 243, 0.1);
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 600;
}

/* Footer */
footer {
    background: var(--text-primary);
    color: white;
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
    margin-top: 40px;
    margin-bottom: 120px;
}
footer a {
    color: white;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline; /* só aparece sublinhado no hover */
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE OPTIMIZATION 
   ======================================== */

/* Tablet & Small Desktop (769px - 1024px) */
@media (max-width: 1024px) {
    .app-header {
        padding: 0 16px;
    }
    
    .header-btn {
        padding: 7px 14px;
        font-size: 0.82rem;
    }
    
    .language-select {
        font-size: 0.8rem;
        padding: 5px 8px;
    }
}

/* Mobile Large (481px - 768px) */
@media (max-width: 768px) {
    .app-header {
        padding: 0 12px;
        height: 60px;
    }
    
    .app-logo {
        height: 40px;
        margin-right: 8px;
    }
    
    .app-header h1 {
        font-size: 1.1rem;
    }
    
    .header-actions {
        gap: 6px;
    }
    
    .header-actions .route-controls {
        gap: 4px;
    }
    
    .header-actions .utility-controls {
        gap: 4px;
        padding-left: 6px;
        margin-left: 3px;
    }
    
    .header-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    .header-btn .button-text {
        display: none;
    }
    
    .language-select {
        font-size: 0.75rem;
        padding: 4px 6px;
        min-width: 60px;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
}

/* Mobile Medium (361px - 480px) */
@media (max-width: 480px) {
    .app-header {
        padding: 0 10px;
        height: 56px;
    }
    
    .app-logo {
        height: 36px;
        margin-right: 6px;
    }
    
    .app-header h1 {
        font-size: 1rem;
    }
    
    .header-actions {
        gap: 4px;
    }
    
    .header-actions .route-controls {
        gap: 3px;
    }
    
    .header-actions .utility-controls {
        gap: 3px;
        padding-left: 4px;
        margin-left: 2px;
        border-left: none; /* Remove border on very small screens */
    }
    
    .header-btn {
        padding: 5px 8px;
        font-size: 0.7rem;
        border-radius: 6px;
    }
    
    .language-select {
        font-size: 0.7rem;
        padding: 3px 5px;
        min-width: 50px;
    }
    
    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    
    /* Hide some buttons on very small screens when needed */
    .route-controls .header-btn:not(#startRouteBtn) {
        min-width: 32px;
        padding: 5px;
    }
}

/* Mobile Small (up to 360px) */
@media (max-width: 360px) {
    .app-header {
        padding: 0 8px;
        height: 52px;
        position: relative;
    }
    
    .app-logo {
        height: 32px;
        margin-right: 4px;
    }
    
    .app-header h1 {
        font-size: 0.9rem;
    }
    
    /* Show mobile menu toggle and hide some controls */
    .mobile-menu-toggle {
        display: flex;
    }
    
    .header-actions .utility-controls {
        display: none;
    }
    
    .header-actions .route-controls {
        gap: 2px;
    }
    
    .header-actions {
        gap: 6px;
        position: relative;
    }
    
    .header-btn {
        padding: 4px 6px;
        font-size: 0.65rem;
        border-radius: 4px;
        min-width: 28px;
    }
    
    /* Ultra compact mode for route buttons */
    .route-controls .header-btn {
        min-width: 28px;
        padding: 4px;
    }
    
    .route-controls .header-btn i {
        margin-right: 0;
    }
}

/* Alternative layout for screens between 320px-360px */
@media (max-width: 320px) {
    .app-header {
        padding: 0 6px;
        height: 50px;
    }
    
    .app-logo {
        height: 30px;
        margin-right: 3px;
    }
    
    .app-header h1 {
        font-size: 0.8rem;
    }
    
    .header-btn {
        padding: 3px 4px;
        font-size: 0.6rem;
        min-width: 26px;
    }
    
    .mobile-menu-toggle {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .route-controls .header-btn {
        min-width: 26px;
        padding: 3px;
    }
}

/* Landscape mode adjustments for small devices */
@media (max-height: 500px) and (orientation: landscape) {
    .app-header {
        height: 48px;
    }
    
    .app-logo {
        height: 28px;
    }
    
    .app-header h1 {
        font-size: 0.85rem;
    }
    
    .header-btn {
        padding: 3px 6px;
        font-size: 0.65rem;
    }
    
    .btn-icon {
        width: 28px;
        height: 28px;
    }
}

/* Bottom Navigation Responsive */
@media (max-width: 768px) {
    .bottom-nav {
        padding: 8px 0;
    }
    
    .nav-item {
        font-size: 0.75rem;
        padding: 8px 4px;
        min-width: 60px;
    }
    
    .nav-item i {
        font-size: 1.1rem;
        margin-bottom: 2px;
    }
    
    .nav-item span {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .bottom-nav {
        padding: 6px 0;
    }
    
    .nav-item {
        font-size: 0.7rem;
        padding: 6px 2px;
        min-width: 50px;
    }
    
    .nav-item i {
        font-size: 1rem;
        margin-bottom: 1px;
    }
    
    .nav-item span {
        font-size: 0.65rem;
    }
}

@media (max-width: 360px) {
    .nav-item {
        padding: 6px 1px;
        min-width: 45px;
    }
    
    .nav-item i {
        font-size: 0.9rem;
    }
    
    .nav-item span {
        font-size: 0.6rem;
    }
}

/* General Mobile Optimizations */
@media (max-width: 768px) {
    .section {
        padding: 15px;
    }
    
    .app-main {
        padding-top: 60px;
        padding-bottom: 70px;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 12px;
    }
    
    .app-main {
        padding-top: 56px;
        padding-bottom: 65px;
    }
}

@media (max-width: 360px) {
    .section {
        padding: 10px;
    }
    
    .app-main {
        padding-top: 52px;
        padding-bottom: 60px;
    }
}
    
    .map-container {
        height: 40vh;
        min-height: 250px;
    }
    
    .route-info {
        position: static;
        margin-top: 15px;
        margin-bottom: 15px;
    }
    
    .community-filters {
        flex-direction: column;
        gap: 10px;
    }
    
    #communitySearch {
        min-width: unset;
    }
    
    .routes-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .community-routes {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .challenge-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .challenge-actions .participants {
        margin-left: 0;
        justify-content: center;
        margin-top: 10px;
    }
    
    .faq-section {
        margin: 15px;
        padding: 20px;
    }
    
    .map-controls {
        left: 15px;
        right: 15px;
        bottom: 15px;
    }
    
    .btn-primary, .btn-secondary, .btn-success, .btn-danger {
        font-size: 0.8rem;
        padding: 10px 15px;
    }
}

@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .weather-content {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .route-stats {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus,
input:focus,
select:focus,
textarea:focus,
.nav-item:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Custom markers and route elements */
.route-marker {
    z-index: 1000;
}

.user-location-marker {
    z-index: 1001;
}

/* Map cursors */
.map-container.creating-route {
    cursor: crosshair !important;
}

.map-container.creating-route #map {
    cursor: crosshair !important;
}

/* Notification system */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--surface-color);
    color: var(--text-primary);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 3000;
    max-width: 350px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid var(--primary-color);
}

.notification-success {
    border-left-color: var(--success-color);
}

.notification-error {
    border-left-color: var(--danger-color);
}

.notification-warning {
    border-left-color: var(--warning-color);
}

.notification-info {
    border-left-color: var(--primary-color);
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-secondary);
    margin-left: auto;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: var(--text-primary);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Button disabled state */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

button:disabled:hover {
    transform: none;
    box-shadow: var(--shadow-light);
}

/* Route creation feedback */
.map-controls .btn-primary.creating {
    background: var(--warning-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 193, 7, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 193, 7, 0);
    }
}

/* Improved form validation */
.form-group input:invalid,
.form-group select:invalid,
.form-group textarea:invalid {
    border-color: var(--danger-color);
}

.form-group input:valid,
.form-group select:valid,
.form-group textarea:valid {
    border-color: var(--success-color);
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --shadow-light: 0 2px 4px rgba(0,0,0,0.3);
        --shadow-medium: 0 4px 8px rgba(0,0,0,0.4);
        --shadow-heavy: 0 8px 16px rgba(0,0,0,0.5);
        --border-color: #333333;
    }
}
