/* ==========================================================================
   TikNovel Theme - App Shell Layout (Desktop Sidebar & Mobile Bottom Nav)
   Inspired by FeelAI Novelist & TikTok Dark AMOLED Web App
   ========================================================================== */

:root {
    --app-sidebar-width: 250px;
    --app-bottom-nav-height: 64px;
    --app-bg-dark: #000000;
    --app-surface: #0a0a0c;
    --app-surface-2: #14161d;
    --app-surface-hover: #1e2029;
    --app-border: rgba(255, 255, 255, 0.08);
    --app-red: #fe2c55;
    --app-red-hover: #e02447;
    --app-gold: #fbbf24;
    --app-gold-glow: 0 0 12px rgba(251, 191, 36, 0.35);
    --app-red-glow: 0 0 14px rgba(254, 44, 85, 0.4);
}

/* App Wrapper Layout */
body {
    background-color: var(--app-bg-dark);
    color: #f1f5f9;
    min-height: 100vh;
    overflow-x: hidden;
}

.app-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--app-bg-dark);
    position: relative;
}

/* ==========================================================================
   1. DESKTOP LEFT SIDEBAR
   ========================================================================== */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--app-sidebar-width);
    background-color: #000000;
    border-right: 1px solid var(--app-border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
}
.app-sidebar::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* User Card in Sidebar */
.app-user-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 4px 6px 16px 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-decoration: none;
    transition: opacity 0.2s;
}
.app-user-box:hover {
    opacity: 0.9;
}

.app-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #27272a, #18181b);
    border: 2px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 17px;
    flex-shrink: 0;
    overflow: hidden;
}
.app-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.app-user-name {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}
.app-user-sub {
    font-size: 11px;
    color: #71717a;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-user-coin-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 9px;
    border-radius: 9999px;
    background: #18181b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--app-gold);
    font-size: 11px;
    font-weight: 700;
    margin-top: 6px;
    width: fit-content;
    text-decoration: none;
    transition: all 0.2s;
}
.app-user-coin-pill:hover {
    background: #27272a;
    border-color: rgba(251, 191, 36, 0.4);
    color: var(--app-gold);
    box-shadow: var(--app-gold-glow);
}

/* + Tạo (Create) Button */
.app-create-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 9999px;
    background: transparent;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    margin: 18px 0 16px 0;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
.app-create-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}
.app-create-btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--app-red);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 13px;
    box-shadow: var(--app-red-glow);
    flex-shrink: 0;
}

/* Nav Menu Items */
.app-nav-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    color: #a1a1aa;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.18s ease;
    position: relative;
}
.app-nav-link:hover {
    background: #18181b;
    color: #ffffff;
}
.app-nav-link.active {
    background: #262626;
    color: #ffffff;
    font-weight: 700;
}
.app-nav-link .nav-icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
}

.app-nav-badge {
    background: var(--app-red);
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 9999px;
    padding: 2px 7px;
    margin-left: auto;
    box-shadow: 0 0 8px rgba(254, 44, 85, 0.6);
}

/* ==========================================================================
   2. MAIN APP CONTENT AREA
   ========================================================================== */
.app-main {
    margin-left: var(--app-sidebar-width);
    min-height: 100vh;
    background-color: var(--app-bg-dark);
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--app-sidebar-width));
    position: relative;
}

/* ==========================================================================
   3. MOBILE BOTTOM NAVIGATION (< 1024px)
   ========================================================================== */
.app-bottom-nav {
    display: none;
}

@media (max-width: 1023.98px) {
    .app-sidebar {
        display: none !important;
    }
    .app-main {
        margin-left: 0 !important;
        width: 100% !important;
        padding-bottom: var(--app-bottom-nav-height);
    }
    .app-bottom-nav {
        display: flex;
        align-items: center;
        justify-content: space-around;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--app-bottom-nav-height);
        background: rgba(5, 7, 13, 0.94);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--app-border);
        z-index: 1050;
        padding: 0 4px;
    }
    .app-bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        color: #71717a;
        text-decoration: none;
        font-size: 10px;
        font-weight: 600;
        flex: 1;
        height: 100%;
        transition: color 0.18s;
        position: relative;
    }
    .app-bottom-nav-item:hover {
        color: #ffffff;
    }
    .app-bottom-nav-item.active {
        color: #ffffff;
        font-weight: 700;
    }
    .app-bottom-nav-item .nav-icon {
        font-size: 18px;
    }
    .app-bottom-nav-item.center-create .create-icon-btn {
        width: 38px;
        height: 30px;
        border-radius: 8px;
        background: var(--app-red);
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        box-shadow: 0 0 12px rgba(254, 44, 85, 0.6);
    }
    .app-bottom-nav-item .nav-badge-dot {
        position: absolute;
        top: 8px;
        right: calc(50% - 14px);
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--app-red);
        box-shadow: 0 0 6px var(--app-red);
    }
}
