/* Google Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600&display=swap');

* {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --body-color: #E4E9F7;
    --sidebar-color: #FFF;
    --primary-color: #695CFE;
    --primary-color-light: #F6F5FF;
    --toggle-color: #DDD;
    --text-color: #707070;

    --tran-02: all 0.2s ease;
    --tran-03: all 0.3s ease;
    --tran-04: all 0.4s ease;
    --tran-05: all 0.5s ease;
}

body {
    height: 100vh;
    background: var(--body-color);
    transition: var(--tran-05);
}

body.dark {
    --body-color: #18191A;
    --sidebar-color: #242526;
    --primary-color: #695CFE;
    --primary-color-light: #3A3B3C;
    --toggle-color: #FFF;
    --text-color: #CCC;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 250px;
    background-color: var(--sidebar-color);
    padding: 10px 14px;
    transition: var(--tran-05);
    z-index: 100;
}

.sidebar.close {
    width: 88px;
}

/* Reusable Elements */
.sidebar .text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
    transition: var(--tran-03);
    white-space: nowrap;
    opacity: 1;
}

.sidebar.close .text {
    opacity: 0;
    pointer-events: none;
}

.sidebar .image {
    min-width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar li {
    height: 50px;
    margin-top: 10px;
    list-style: none;
    display: flex;
    align-items: center;
}

.sidebar li .icon {
    display: flex;
    align-items: center;
    font-size: 20px;
    min-width: 60px;
    justify-content: center;
    color: var(--text-color);
    transition: var(--tran-02);
}

.sidebar .image-text img {
    width: 40px;
    border-radius: 6px;
}

/* Header */
.sidebar header {
    position: relative;
}

.sidebar header .image-text {
    display: flex;
    align-items: center;
}

.image-text .header-text {
    display: flex;
    flex-direction: column;
}

.header-text .name {
    font-weight: 600;
}

.header-text .profession {
    margin-top: -2px;
}

.sidebar header .toggle {
    position: absolute;
    top: 50%;
    right: -25px;
    transform: translateY(-50%) rotate(180deg);
    height: 25px;
    width: 25px;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--sidebar-color);
    font-size: 22px;
    transition: var(--tran-03);
}

.sidebar.close header .toggle {
    transform: translateY(-50%);
}

body.dark .sidebar header .toggle {
    color: var(--text-color);
}

/* Menu */
.sidebar .menu {
    margin-top: 35px;
}

.sidebar .search-box {
    background-color: var(--primary-color-light);
    border-radius: 6px;
    transition: var(--tran-05);
}

.search-box input {
    height: 100%;
    width: 100%;
    background-color: var(--primary-color-light);
    outline: none;
    border: none;
    font-size: 16px;
    font-weight: 550;
    border-radius: 6px;
    color: var(--text-color);
    transition: var(--tran-05);
}

/* Links */
.sidebar li a {
    text-decoration: none;
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: var(--tran-04);
}

.sidebar li a:hover {
    background: var(--primary-color);
}

.sidebar li a:hover .icon,
.sidebar li a:hover .text {
    color: var(--sidebar-color);
}

body.dark .sidebar li a:hover .icon,
body.dark .sidebar li a:hover .text {
    color: var(--text-color);
}

/* Menu Bar */
.sidebar .menu-bar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: calc(100% - 50px);
}

/* ======= Dark Mode Toggle ======= */
.menu-bar .mode {
    position: relative;
    border-radius: 6px;
    background: var(--primary-color-light);
    display: flex;
    align-items: center;
    height: 50px;
    padding: 0 10px;
    transition: var(--tran-05);
}

.menu-bar .mode .moon-sun {
    height: 50px;
    width: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.menu-bar .mode i {
    font-size: 20px;
    transition: var(--tran-03);
    position: absolute;
    opacity: 0;
}

/* Show moon in light mode, sun in dark mode */
.menu-bar .mode i.moon {
    opacity: 1;
}

body.dark .menu-bar .mode i.moon {
    opacity: 0;
}

body.dark .menu-bar .mode i.sun {
    opacity: 1;
}

/* Text & Switch */
.mode-text {
    margin-left: 10px;
    color: var(--text-color);
    transition: var(--tran-03);
}

.toggle-switch {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 60px;
    margin-left: auto;
    background: var(--primary-color-light);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--tran-05);
}

.toggle-switch .switch {
    height: 22px;
    width: 44px;
    background: var(--toggle-color);
    border-radius: 25px;
    position: relative;
}

.switch::before {
    content: '';
    position: absolute;
    height: 15px;
    width: 15px;
    top: 50%;
    left: 5px;
    transform: translateY(-50%);
    background: var(--sidebar-color);
    border-radius: 50%;
    transition: var(--tran-03);
}

body.dark .switch::before {
    left: 24px;
}

/* Collapsed Sidebar: Hide text & switch, keep icon */
.sidebar.close .mode-text,
.sidebar.close .toggle-switch {
    display: none;
}

.sidebar.close .mode {
    justify-content: center;
    padding: 0;
}

/* Home Section */
.home {
    position: relative;
    left: 250px;
    height: 100vh;
    width: calc(100% - 250px);
    transition: var(--tran-05);
    background: var(--body-color);
}

.sidebar.close ~ .home {
    left: 88px;
    width: calc(100% - 88px);
}

.home .text {
    font-size: 30px;
    font-weight: 500;
    color: var(--text-color);
    padding: 8px 40px;
}
/* Topbar Styling */
.topbar {
    padding: 20px 40px;
    background: var(--sidebar-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: var(--tran-05);
}

.topbar-content h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color);
}

/* Dark mode topbar */
body.dark .topbar {
    background: var(--primary-color-light);
    border-color: #444;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Dashboard Content Section */
.dashboard-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 30px 40px;
    background: var(--body-color);
    transition: var(--tran-05);
}

/* Content Card Styling */
.content-card {
    background: var(--sidebar-color);
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.content-card h2 {
    font-size: 22px;
    margin-bottom: 12px;
    color: var(--text-color);
}

.content-card p {
    margin: 8px 0;
    font-size: 15px;
    color: var(--text-color);
    line-height: 1.6;
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

/* Dark Mode Support */
body.dark .dashboard-content {
    background: var(--body-color);
}

body.dark .content-card {
    background: var(--primary-color-light);
    color: #ccc;
}


@media (max-width: 768px) {
    /* Sidebar collapses automatically */
    .sidebar {
        width: 88px;
    }

    .sidebar.close {
        width: 70px;
    }

    .sidebar .text {
        display: none;
    }

    .sidebar .toggle {
        right: -20px;
    }

    .sidebar .menu-links,
    .sidebar .menu-bar {
        align-items: center;
    }

    .home {
        left: 88px;
        width: calc(100% - 88px);
        padding: 20px;
    }

    .home .topbar {
        font-size: 20px;
        padding: 15px;
    }

    .home .dashboard-content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    /* Stack layout vertically on small screens */
    .home {
        left: 0;
        width: 100%;
    }

    .sidebar {
        position: absolute;
        z-index: 200;
        height: 100vh;
        width: 200px;
        left: -200px;
        transition: var(--tran-04);
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar.close {
        left: -200px;
    }

    .sidebar .toggle {
        display: none;
    }

    .home .topbar {
        font-size: 18px;
        padding: 10px;
    }

    .home .dashboard-content {
        font-size: 14px;
        padding: 15px;
    }
}
