/* =============================================
   App Layout (Sidebar, Main Content, Bottom Nav)
   ============================================= */

.app-container {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    width: 100%;
}

/* === SIDEBAR === */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
    flex-shrink: 0;
}

.brand-icon { font-size: 20px; }

.sidebar-brand h1 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    margin: 0;
    line-height: 1;
}

.brand-sub {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
    line-height: 1;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-section-label {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 700;
    padding: 8px 14px 1px;
    white-space: nowrap;
    flex-shrink: 0;
}

.sidebar-nav {
    padding: 1px 8px;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.8rem;
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.3;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--green-light);
    color: var(--green-dark);
    font-weight: 600;
}

.nav-item.active .nav-icon { color: var(--green); }
.nav-icon { font-size: 0.9rem; width: 18px; text-align: center; }

.sidebar-footer {
    padding: 6px 14px;
    border-top: 1px solid var(--border-light);
    white-space: nowrap;
    margin-top: auto;
    flex-shrink: 0;
}

.sidebar-badge {
    font-size: 0.6rem;
    color: var(--text-muted);
    background: var(--bg-body);
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 500;
}

/* === MAIN CONTENT === */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: var(--space-md);
    min-width: 0;
    padding-bottom: calc(var(--space-xl) + var(--bottom-nav-height) + var(--safe-area-bottom));
    transition: margin-left 0.3s ease;
}

.page { display: none; }
.page.active { display: block; animation: pageIn 0.3s ease; }

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

.page-header {
    margin-bottom: var(--space-md);
}

/* === BOTTOM NAVIGATION (Mobile Only) === */
.bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: var(--text-secondary);
    text-decoration: none;
    gap: 4px;
    transition: var(--transition-fast);
    padding: 0 var(--space-xs);
    min-height: var(--touch-min);
}

.bottom-nav-icon {
    font-size: 20px;
    transition: var(--transition-fast);
}

.bottom-nav-label {
    font-size: 10px;
    font-weight: 500;
    display: none;
}

.bottom-nav-item.active {
    color: var(--green-dark);
}

.bottom-nav-item.active .bottom-nav-icon {
    font-size: 24px;
    transform: translateY(-2px);
}

.bottom-nav-item.active .bottom-nav-label {
    display: block;
    color: var(--green-dark);
}

/* === MORE SHEET === */
.more-sheet-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    z-index: 1050;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.more-sheet-backdrop.show {
    display: block;
    opacity: 1;
}

.more-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-white);
    border-radius: 20px 20px 0 0;
    z-index: 1060;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    padding-bottom: calc(var(--safe-area-bottom) + 16px);
}
.more-sheet.show {
    transform: translateY(0);
}
.more-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}
.more-sheet-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.more-sheet-close {
    background: #f1f5f9;
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.more-sheet-body {
    padding: 12px 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.more-sheet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    padding: 16px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    gap: 8px;
    transition: background 0.2s;
    min-height: 80px;
}
.more-sheet-item:hover, .more-sheet-item:active {
    background: var(--bg-hover);
}
.more-sheet-icon {
    font-size: 1.5rem;
}
.more-sheet-text {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

/* === RESPONSIVE UTILITIES === */

/* Mobile First / Default */
.sidebar {
    transform: translateX(-100%);
}

.bottom-nav {
    display: flex;
}

/* Tablet */
@media (min-width: 768px) {
    .sidebar {
        transform: translateX(0);
    }
    
    .sidebar-section-label,
    .brand-text,
    .nav-item span:not(.nav-icon),
    .sidebar-badge {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
        padding: 5px 0;
    }
    
    .sidebar-brand {
        justify-content: center;
        padding: 8px 0;
    }
    
    .bottom-nav {
        display: none;
    }
    
    .main-content {
        padding: var(--space-lg);
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .sidebar-section-label,
    .brand-text,
    .nav-item span:not(.nav-icon),
    .sidebar-badge {
        display: inline-block;
    }
    .brand-text { display: flex; }
    
    .nav-item {
        justify-content: flex-start;
        padding: 5px 10px;
    }
    
    .sidebar-brand {
        justify-content: flex-start;
        padding: 10px 14px 8px;
    }
    
    .main-content {
        padding: var(--space-lg) var(--space-xl);
    }
}
