/**
 * MywayD - Professional Menu Styles
 * Version: 2.0 - Redesigned sidebar menu
 */

/* ============================================
   PROFESSIONAL SIDEBAR MENU
   ============================================ */

/* Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Sidebar Container */
.sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 320px;
    max-width: 88vw;
    height: 100%;
    height: 100dvh;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    z-index: 999;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    visibility: hidden;
    overflow: hidden;
}

.sidebar.open {
    right: 0;
    visibility: visible;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    background: linear-gradient(135deg, #0d9488 0%, #059669 50%, #047857 100%);
    color: white;
    position: relative;
    flex-shrink: 0;
}

/* Safe area for iOS notch */
@supports (padding-top: env(safe-area-inset-top)) {
    .sidebar-header {
        padding-top: calc(20px + env(safe-area-inset-top));
    }
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.sidebar-close:active {
    transform: scale(0.95);
}

/* Sidebar Body */
.sidebar-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

/* Section Title */
.sidebar-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 8px 12px;
    margin-top: 8px;
}

.sidebar-section-title:first-child {
    margin-top: 0;
}

/* Menu Grid - 3 columns */
.sidebar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* Menu Item */
.sidebar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 8px;
    border-radius: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
    background: transparent;
    border: 1px solid transparent;
    min-height: 85px;
}

.sidebar-item:hover {
    background: rgba(13, 148, 136, 0.08);
    border-color: rgba(13, 148, 136, 0.15);
    transform: translateY(-2px);
}

.sidebar-item:active {
    transform: scale(0.96);
}

/* Menu Item Icon Container */
.sidebar-item .icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 6px;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.sidebar-item:hover .icon {
    transform: scale(1.08);
}

/* Menu Item Label */
.sidebar-item .label {
    font-size: 0.72rem;
    font-weight: 500;
    color: #374151;
    text-align: center;
    line-height: 1.25;
    max-width: 100%;
    word-break: keep-all;
}

/* Icon Colors */
.sidebar-item[href*="work"] .icon { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); }
.sidebar-item[href*="trip"] .icon { background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%); }
.sidebar-item[href*="health"] .icon { background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%); }
.sidebar-item[href*="learning"] .icon { background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%); }
.sidebar-item[href*="goal"] .icon { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); }
.sidebar-item[href*="habit"] .icon { background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%); }
.sidebar-item[href*="chat"] .icon { background: linear-gradient(135deg, #cffafe 0%, #a5f3fc 100%); }
.sidebar-item[href*="note"] .icon { background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%); }
.sidebar-item[href*="calendar"] .icon { background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%); }
.sidebar-item[href*="shopping"] .icon { background: linear-gradient(135deg, #ccfbf1 0%, #99f6e4 100%); }
.sidebar-item[href*="bill"] .icon { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%); }
.sidebar-item[href*="asset"] .icon { background: linear-gradient(135deg, #e7e5e4 0%, #d6d3d1 100%); }

/* Divider */
.sidebar-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #e5e7eb 50%, transparent 100%);
    margin: 16px 8px;
}

/* Link Items (Settings, etc.) */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.sidebar-link:hover {
    background: rgba(13, 148, 136, 0.08);
    color: #0d9488;
}

.sidebar-link:active {
    transform: scale(0.98);
}

.sidebar-link span:first-child {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
}

/* Footer Links */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}

.sidebar-footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.sidebar-footer-link {
    font-size: 0.7rem;
    color: #9ca3af;
    text-decoration: none;
    padding: 4px 8px;
}

.sidebar-footer-link:hover {
    color: #0d9488;
}

/* ============================================
   MOBILE SPECIFIC STYLES
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        max-width: 320px;
    }
    
    .sidebar-grid {
        gap: 6px;
    }
    
    .sidebar-item {
        padding: 12px 6px;
        min-height: 80px;
        border-radius: 12px;
    }
    
    .sidebar-item .icon {
        width: 44px;
        height: 44px;
        font-size: 1.35rem;
        border-radius: 12px;
        margin-bottom: 5px;
    }
    
    .sidebar-item .label {
        font-size: 0.68rem;
    }
    
    .sidebar-link {
        padding: 11px 12px;
    }
}

/* ============================================
   TABLET & DESKTOP STYLES
   ============================================ */
@media (min-width: 769px) {
    .sidebar {
        width: 360px;
        border-radius: 20px 0 0 20px;
    }
    
    .sidebar-grid {
        gap: 10px;
    }
    
    .sidebar-item {
        padding: 16px 10px;
        min-height: 90px;
    }
    
    .sidebar-item .icon {
        width: 52px;
        height: 52px;
        font-size: 1.6rem;
    }
    
    .sidebar-item .label {
        font-size: 0.78rem;
    }
}

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

.sidebar.open .sidebar-item {
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
}

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

.sidebar.open .sidebar-item:nth-child(1) { animation-delay: 0.05s; }
.sidebar.open .sidebar-item:nth-child(2) { animation-delay: 0.07s; }
.sidebar.open .sidebar-item:nth-child(3) { animation-delay: 0.09s; }
.sidebar.open .sidebar-item:nth-child(4) { animation-delay: 0.11s; }
.sidebar.open .sidebar-item:nth-child(5) { animation-delay: 0.13s; }
.sidebar.open .sidebar-item:nth-child(6) { animation-delay: 0.15s; }
.sidebar.open .sidebar-item:nth-child(7) { animation-delay: 0.17s; }
.sidebar.open .sidebar-item:nth-child(8) { animation-delay: 0.19s; }
.sidebar.open .sidebar-item:nth-child(9) { animation-delay: 0.21s; }
.sidebar.open .sidebar-item:nth-child(10) { animation-delay: 0.23s; }
.sidebar.open .sidebar-item:nth-child(11) { animation-delay: 0.25s; }
.sidebar.open .sidebar-item:nth-child(12) { animation-delay: 0.27s; }

/* ============================================
   DARK MODE SUPPORT
   ============================================ */
@media (prefers-color-scheme: dark) {
    .sidebar {
        background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    }
    
    .sidebar-item .label {
        color: #e5e7eb;
    }
    
    .sidebar-link {
        color: #e5e7eb;
    }
    
    .sidebar-section-title {
        color: #9ca3af;
    }
    
    .sidebar-divider {
        background: linear-gradient(90deg, transparent 0%, #374151 50%, transparent 100%);
    }
    
    .sidebar-footer {
        background: #111827;
        border-top-color: #374151;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .sidebar-item,
    .sidebar-link,
    .sidebar-close {
        transition: none;
        animation: none;
    }
    
    .sidebar.open .sidebar-item {
        animation: none;
        opacity: 1;
    }
}

/* Focus styles for keyboard navigation */
.sidebar-item:focus,
.sidebar-link:focus,
.sidebar-close:focus {
    outline: 2px solid #0d9488;
    outline-offset: 2px;
}

/* Hide old modal menu */
#moreModal {
    display: none !important;
}
