/**
 * Navigation Modal CSS - Community Platform
 * Teal/cyan branding with modern card-based navigation
 */

/* Modal overlay and backdrop */
.navigation-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Modal container */
.navigation-modal {
    background: var(--bg-card, #ffffff);
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    animation: modalSlideUp 0.3s ease-out;
}

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

/* Modal header */
.navigation-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-subtle, #f0f0f0);
    background: linear-gradient(135deg, #14b8a6 0%, #0891b2 100%);
}

.navigation-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navigation-modal-logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
}

.navigation-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: background 0.2s;
}

.navigation-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal body */
.navigation-modal-body {
    overflow-y: auto;
    max-height: calc(90vh - 120px);
    padding: 0;
}

.nav-modal-container {
    padding: 1.5rem;
}

/* Category sections */
.nav-category-section {
    margin-bottom: 2rem;
}

.nav-category-section:last-child {
    margin-bottom: 0;
}

.nav-category-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary, #64748b);
    margin-bottom: 0.75rem;
    padding-left: 0.25rem;
    letter-spacing: 0.05em;
}

/* Grid layout */
.nav-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* Navigation tiles */
.nav-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    background: var(--bg-card, #ffffff);
    border: 2px solid var(--border-subtle, #f0f0f0);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.nav-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #14b8a6, #06b6d4);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(20, 184, 166, 0.15);
    border-color: var(--primary, #14b8a6);
}

.nav-tile:hover::before {
    transform: scaleX(1);
}

.nav-tile:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.1);
}

/* Icon */
.nav-tile-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.2s ease;
}

.nav-tile:hover .nav-tile-icon {
    transform: scale(1.1);
}

/* Text */
.nav-tile-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin-bottom: 0.25rem;
    text-align: center;
}

.nav-tile-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    text-align: center;
    line-height: 1.3;
}

/* Badge */
.nav-tile-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: linear-gradient(135deg, #14b8a6, #0891b2);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(20, 184, 166, 0.3);
}

/* Admin tiles */
.nav-tile.admin {
    background: linear-gradient(135deg, #424242 0%, #212121 100%);
    border: none;
    color: white;
}

.nav-tile.admin::before {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.nav-tile.admin .nav-tile-title {
    color: white;
}

.nav-tile.admin .nav-tile-subtitle {
    color: rgba(255, 255, 255, 0.8);
}

.nav-tile.admin:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Footer */
.nav-modal-footer {
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-subtle, #f0f0f0);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.nav-modal-recent {
    font-size: 0.85rem;
    color: var(--text-secondary, #64748b);
}

.nav-modal-recent a {
    color: var(--primary, #14b8a6);
    text-decoration: none;
    margin-left: 0.5rem;
    transition: color 0.2s;
}

.nav-modal-recent a:hover {
    text-decoration: underline;
    color: var(--primary-dark, #0891b2);
}

/* Keyboard focus indicators */
.nav-tile:focus {
    outline: 3px solid var(--primary, #14b8a6);
    outline-offset: 2px;
}

.nav-tile:focus:not(:focus-visible) {
    outline: none;
}

.nav-tile:focus-visible {
    outline: 3px solid var(--primary, #14b8a6);
    outline-offset: 2px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .navigation-modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .nav-modal-container {
        padding: 1rem;
    }

    .nav-modal-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .nav-tile {
        padding: 1rem 0.75rem;
    }

    .nav-tile-icon {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .nav-tile-title {
        font-size: 0.9rem;
    }

    .nav-tile-subtitle {
        font-size: 0.7rem;
    }

    .nav-modal-footer {
        justify-content: center;
        text-align: center;
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .nav-modal-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .nav-tile {
        padding: 1rem;
    }

    .navigation-modal-header {
        padding: 1rem;
    }
}

/* Dark theme support */
[data-theme="dark"] .navigation-modal,
.theme-dark .navigation-modal {
    background: var(--bg-card, #1e293b);
}

[data-theme="dark"] .navigation-modal-header,
.theme-dark .navigation-modal-header {
    border-bottom-color: var(--border-subtle, #334155);
}

[data-theme="dark"] .nav-tile,
.theme-dark .nav-tile {
    background: var(--bg-card, #1e293b);
    border-color: var(--border-subtle, #334155);
}

[data-theme="dark"] .nav-tile:hover,
.theme-dark .nav-tile:hover {
    border-color: var(--primary, #14b8a6);
    background: var(--bg-hover, #334155);
}

[data-theme="dark"] .nav-tile-title,
.theme-dark .nav-tile-title {
    color: var(--text-primary, #f1f5f9);
}

[data-theme="dark"] .nav-tile-subtitle,
.theme-dark .nav-tile-subtitle {
    color: var(--text-secondary, #94a3b8);
}

[data-theme="dark"] .nav-category-title,
.theme-dark .nav-category-title {
    color: var(--text-secondary, #94a3b8);
}

[data-theme="dark"] .nav-modal-footer,
.theme-dark .nav-modal-footer {
    border-top-color: var(--border-subtle, #334155);
}

[data-theme="dark"] .nav-modal-recent,
.theme-dark .nav-modal-recent {
    color: var(--text-secondary, #94a3b8);
}

/* Smooth scrolling */
.navigation-modal-body {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
.navigation-modal-body::-webkit-scrollbar {
    width: 8px;
}

.navigation-modal-body::-webkit-scrollbar-track {
    background: var(--bg-secondary, #f8fafc);
    border-radius: 4px;
}

.navigation-modal-body::-webkit-scrollbar-thumb {
    background: var(--primary, #14b8a6);
    border-radius: 4px;
}

.navigation-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark, #0891b2);
}

[data-theme="dark"] .navigation-modal-body::-webkit-scrollbar-track,
.theme-dark .navigation-modal-body::-webkit-scrollbar-track {
    background: var(--bg-secondary, #0f172a);
}

/* Animation states */
.navigation-modal.closing {
    animation: modalSlideDown 0.3s ease-out forwards;
}

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

/* Active page indicator */
.nav-tile[style*="border-color: var(--primary)"] {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
}

[data-theme="dark"] .nav-tile[style*="border-color: var(--primary)"],
.theme-dark .nav-tile[style*="border-color: var(--primary)"] {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
}

/* Touch-friendly sizing */
@media (hover: none) and (pointer: coarse) {
    .nav-tile {
        min-height: 120px;
    }

    .navigation-modal-close {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .navigation-modal {
        max-height: 100vh;
    }

    .navigation-modal-body {
        max-height: calc(100vh - 80px);
    }

    .nav-modal-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .nav-tile {
        border-width: 3px;
    }

    .nav-tile:hover {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .navigation-modal,
    .nav-tile,
    .nav-tile-icon,
    .navigation-modal-close {
        animation: none !important;
        transition: none !important;
    }
}
