/* Dashboard layout; shared palette lives in theme.css. */
body {
    margin: 0;
    background-color: var(--bg-color) !important;
    color: var(--text-main) !important;
    font-family: var(--font-ui);
    height: 100vh;
    overflow: hidden;
    display: flex;
    transition: background 0.3s, color 0.3s;
}

::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--scroll-thumb);
    border-radius: 3px;
}

#sidebar {
    width: 80px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 30px;
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease, background 0.3s;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

#sidebar.active {
    transform: translateX(0);
}

.nav-item {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-sub);
    font-size: 1.2rem;
    transition: 0.2s;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.nav-item.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 15px var(--accent-shadow);
}

.home-btn {
    margin-top: auto;
    margin-bottom: 80px;
}

#workspace {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    overflow: hidden;
    width: 100%;
    transition: margin-left 0.3s;
}

#sidebar.active+#workspace {
    margin-left: 80px;
    width: calc(100% - 80px);
}

.app-view {
    display: none;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    flex-direction: column;
    background-color: var(--bg-color) !important;
    width: 100%;
}

.app-view.active {
    display: flex;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#launcher {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 1fr;
    gap: 30px;
    padding: 80px;
    box-sizing: border-box;
    background: var(--bg-color);
    z-index: 50;
    transition: 0.3s;
}

#launcher.hidden {
    transform: scale(1.1);
    opacity: 0;
    pointer-events: none;
}

.app-icon-card {
    background: var(--card-bg);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.app-icon-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    background: var(--input-bg);
}

.app-icon-card i {
    font-size: 3.5rem;
    margin-bottom: 20px;
    color: var(--accent) !important;
}

.app-icon-card span {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.app-title {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    margin: 0;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    padding: 6px 15px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.user-badge img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.btn-tool {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--input-bg);
    color: var(--text-sub);
    transition: 0.2s;
    font-size: 1.1rem;
}

.btn-tool:hover {
    background: var(--accent);
    color: white;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-box {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    width: 350px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.8);
    text-align: center;
    color: var(--text-main);
}

.btn-modal {
    padding: 8px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    margin: 0 5px;
}

.btn-confirm {
    background: var(--accent);
    color: white;
}

.btn-cancel {
    background: var(--input-bg);
    color: var(--text-main);
}

.custom-select {
    background-color: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 8px;
    outline: none;
}

@media (max-width: 768px) {
    #sidebar {
        width: 100%;
        height: 60px;
        top: auto;
        bottom: 0;
        left: 0;
        flex-direction: row;
        justify-content: space-around;
        padding: 0;
        border-right: none;
        border-top: 1px solid var(--border-color);
        transform: translateY(100%);
        transition: transform 0.3s ease;
        background: var(--card-bg);
    }

    #sidebar.active {
        transform: translateY(0);
    }

    .nav-item {
        margin: 0;
        height: 100%;
        width: 100%;
        border-radius: 0;
        font-size: 1.3rem;
    }

    .nav-item.active {
        box-shadow: inset 0 4px 0 var(--accent);
        background: transparent;
        color: var(--accent);
    }

    .home-btn {
        display: none;
    }

    #sidebar.active+#workspace {
        margin-left: 0;
        width: 100%;
        height: calc(100% - 60px);
    }

    #workspace {
        width: 100%;
        margin: 0;
    }

    .app-view {
        padding: 10px;
        overflow-y: auto;
        padding-bottom: 70px;
    }

    #launcher {
        grid-template-columns: repeat(2, 1fr);
        padding: 40px 20px;
        gap: 15px;
    }

    .app-icon-card {
        height: 110px;
    }

    .app-icon-card i {
        font-size: 2.2rem;
        margin-bottom: 10px;
    }

    .music-layout {
        flex-direction: column;
        overflow-y: auto;
        gap: 20px;
        height: auto;
    }

    .now-playing {
        max-width: 100%;
        border: none;
        background: transparent;
        padding: 0;
    }

    #player-art-container {
        max-height: 250px;
    }

    .playlist-side {
        flex: none;
        height: auto;
        border: none;
        background: transparent;
        padding: 0;
        min-height: 400px;
    }

    .drive-layout {
        flex-direction: column;
        height: auto;
    }

    .drive-sidebar {
        display: none;
    }

    .grid-files {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .drive-toolbar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px;
    }

    .search-wrapper {
        order: 3;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .calendar-layout {
        flex-direction: column;
        overflow-y: auto;
        height: auto;
    }

    .calendar-sidebar {
        min-width: 100%;
        border: none;
        background: transparent;
        padding: 0;
        margin-top: 20px;
        min-height: 300px;
    }

    .notes-grid {
        grid-template-columns: 1fr 1fr;
    }

    .kanban-board {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        height: auto;
    }

    .kanban-column {
        min-width: 100%;
        margin-bottom: 15px;
        height: auto;
        min-height: 200px;
    }

    .money-hero-section {
        flex-direction: column;
        gap: 10px;
    }

    .notion-table {
        overflow-x: auto;
    }

    .nt-cell:nth-child(4),
    .nt-cell:nth-child(5) {
        display: none;
    }

    .chat-container {
        border-radius: 12px;
    }

    .modal-box {
        width: 90%;
        max-width: 350px;
        padding: 20px;
    }

    .app-title {
        font-size: 1.4rem;
    }

    .user-badge span {
        display: none;
    }
}
