/**
 * Mobile More Menu Modal Styles
 * Bottom sheet modal for overflow navigation
 * Theme-compatible with dark/light mode support
 * Includes safe area insets for notched devices
 */

/* =============================================
   MODAL CONTAINER
   ============================================= */

.mobile-more-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-more-modal.active {
    display: block;
    opacity: 1;
}

/* Backdrop */
.mobile-more-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
}

/* =============================================
   MODAL CONTENT
   ============================================= */

.mobile-more-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 85vh;
    background: var(--card-bg);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;

    /* Safe area insets for notched devices */
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-more-modal.active .mobile-more-content {
    transform: translateY(0);
}

/* =============================================
   HEADER
   ============================================= */

.mobile-more-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    position: relative;
}

.mobile-more-header::before {
    content: '';
    position: absolute;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--text-color);
    opacity: 0.3;
    border-radius: 2px;
}

.mobile-more-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
}

.mobile-more-close {
    background: var(--input-bg);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    font-size: 1.125rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-more-close:hover,
.mobile-more-close:active {
    background: var(--border-color);
    transform: scale(0.95);
}

/* =============================================
   BODY
   ============================================= */

.mobile-more-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 0;
}

/* Remove scrollbar for cleaner look */
.mobile-more-body::-webkit-scrollbar {
    width: 4px;
}

.mobile-more-body::-webkit-scrollbar-track {
    background: transparent;
}

.mobile-more-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* =============================================
   SECTIONS
   ============================================= */

.mobile-more-section {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.mobile-more-section:last-child {
    border-bottom: none;
}

.mobile-more-section-title {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-color);
    opacity: 0.7;
    padding: 1rem 1.5rem 0.5rem;
    margin: 0;
}

.mobile-more-section-title i {
    margin-right: 0.5rem;
}

/* =============================================
   MENU ITEMS
   ============================================= */

.mobile-more-list {
    padding: 0;
    margin: 0;
}

.mobile-more-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: var(--text-color);
    background: transparent;
    transition: background 0.2s ease;
    position: relative;
    min-height: 72px;
}

.mobile-more-item:active {
    background: var(--input-bg);
}

/* Item Icon */
.mobile-more-item-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    color: white;
    margin-right: 1rem;
}

/* Icon Colors (reuse from mega menu) */
.planning-icon { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.results-icon { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.sip-icon { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.expense-icon { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.tax-icon { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.backtest-icon { background: linear-gradient(135deg, #30cfd0 0%, #330867 100%); }
.picks-icon { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }
.insights-icon { background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%); }
.library-icon { background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%); }
.strategy-icon { background: linear-gradient(135deg, #fddb92 0%, #d1fdff 100%); }
.billing-icon { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.pricing-icon { background: linear-gradient(135deg, #f6d365 0%, #fda085 100%); }
.logout-icon { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.legal-icon { background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%); }

/* Item Content */
.mobile-more-item-content {
    flex: 1;
    min-width: 0;
}

.mobile-more-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 0.25rem 0;
    line-height: 1.3;
}

.mobile-more-item-desc {
    font-size: 0.875rem;
    color: var(--text-color);
    opacity: 0.7;
    margin: 0;
    line-height: 1.3;
}

/* Item Arrow */
.mobile-more-item-arrow {
    flex-shrink: 0;
    color: var(--text-color);
    opacity: 0.4;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

/* Badge */
.mobile-more-badge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

/* =============================================
   FOOTER
   ============================================= */

.mobile-more-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--card-bg);
}

.mobile-more-footer .btn {
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    border-radius: 12px;
}

/* =============================================
   ANIMATIONS
   ============================================= */

/* Stagger animation for menu items */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-more-modal.active .mobile-more-item {
    animation: slideInUp 0.3s ease forwards;
}

.mobile-more-modal.active .mobile-more-item:nth-child(1) { animation-delay: 0.05s; }
.mobile-more-modal.active .mobile-more-item:nth-child(2) { animation-delay: 0.1s; }
.mobile-more-modal.active .mobile-more-item:nth-child(3) { animation-delay: 0.15s; }
.mobile-more-modal.active .mobile-more-item:nth-child(4) { animation-delay: 0.2s; }
.mobile-more-modal.active .mobile-more-item:nth-child(5) { animation-delay: 0.25s; }

/* =============================================
   DESKTOP HIDE
   ============================================= */

@media (min-width: 768px) {
    .mobile-more-modal {
        display: none !important;
    }
}

/* =============================================
   LANDSCAPE MODE
   ============================================= */

@media (max-width: 767px) and (orientation: landscape) {
    .mobile-more-content {
        max-height: 95vh;
    }

    .mobile-more-item {
        min-height: 60px;
        padding: 0.75rem 1.5rem;
    }

    .mobile-more-item-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* =============================================
   ACCESSIBILITY
   ============================================= */

/* Focus styles */
.mobile-more-item:focus-visible {
    outline: 2px solid var(--primary-color, #007bff);
    outline-offset: -2px;
}

.mobile-more-close:focus-visible {
    outline: 2px solid var(--primary-color, #007bff);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .mobile-more-content,
    .mobile-more-modal,
    .mobile-more-item,
    .mobile-more-close {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .mobile-more-item {
        border-bottom: 1px solid var(--border-color);
    }

    .mobile-more-close {
        border: 2px solid var(--text-color);
    }
}

/* =============================================
   TOUCH IMPROVEMENTS
   ============================================= */

/* Larger touch targets */
.mobile-more-item,
.mobile-more-close {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Prevent text selection on tap */
.mobile-more-item,
.mobile-more-close {
    -webkit-user-select: none;
    user-select: none;
}

/* Enable text selection for content */
.mobile-more-item-title,
.mobile-more-item-desc {
    -webkit-user-select: text;
    user-select: text;
}
