.sidebar {
    position: fixed;
    width: 300px;
    height: 100%;
    background: rgb(0, 166, 77);
    overflow: hidden;
    overflow-x: hidden;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.sidebar ul li {
    width: 100%;
    list-style: none;
}

.sidebar ul li:hover {
    background: #bbf570;
}

.sidebar ul li:first-child {
    line-height: 60px;
    margin-bottom: 10px;
    font-weight: 600;
    border-bottom: 1px solid #fff;
}

.sidebar ul li:first-child:hover {
    background: none;
}

.sidebar ul li a {
    width: 100%;
    text-decoration: none;
    color: #fff;
    height: 40px;
    display: flex;
    align-items: center;
}

.sidebar ul li a i {
    min-width: 60px;
    font-size: 25px;
    text-align: center;
}

.sidebar .title {
    padding: 0 6px;
    font-size: 20px;
}

/* Responsive Styles */
@media(max-width: 1200px){
    .cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media(max-width: 1090px){
    .sidebar {
        width: 70px;
        overflow: hidden;
    }
    .sidebar .title {
        opacity: 0;
        pointer-events: none;
    }
    .sidebar ul li a {
        justify-content: center;
    }
    .main {
        width: calc(100% - 70px);
        left: 70px;
    }
    .top-bar {
        width: calc(100% - 70px);
    }
    .menu-toggle {
        display: block;
    }
    .sidebar:hover {
        width: 300px;
    }
    .sidebar:hover .title {
        opacity: 1;
        pointer-events: auto;
    }
    .sidebar:hover ~ .main,
    .sidebar:hover ~ .top-bar {
        width: calc(100% - 300px);
        left: 300px;
    }
}

@media(max-width: 860px) {
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .tables {
        grid-template-columns: 1fr;
    }
    .search input {
        width: 150px;
    }
}

@media(max-width: 768px) {
    .sidebar {
        left: -100%;
    }
    .sidebar.active {
        left: 0;
        width: 300px;
    }
    .sidebar.active .title {
        opacity: 1;
        pointer-events: auto;
    }
    .main, .top-bar {
        width: 100%;
        left: 0;
    }
    .sidebar.active ~ .main,
    .sidebar.active ~ .top-bar {
        width: calc(100% - 300px);
        left: 300px;
    }
    .top-bar {
        grid-template-columns: 1fr 0.4fr 1fr;
    }
}

@media(max-width: 600px) {
    .cards {
        grid-template-columns: 1fr;
    }
    .last-appointments td:nth-child(3){
        display: none;
    }
    .top-bar {
        grid-template-columns: 1fr 0.3fr 0.5fr;
    }
    .search {
        max-width: 120px;
    }
    .search input {
        width: 100%;
        padding: 0 30px 0 10px;
    }
    .search i {
        right: 5px;
    }
}

@media(max-width: 480px) {
    .last-appointments, .doctor-available {
        font-size: 14px;
        padding: 10px;
        min-height: 200px;
    }
    .cards, 
    .tables {
        padding: 10px;
    }
    .user {
        width: 40px;
        height: 40px;
    }
    .profile-text {
        font-size: 16px;
    }
    .menu-toggle {
        font-size: 20px;
    }
}

@media(max-width: 400px) {
    .sidebar.active {
        width: 100%;
    }
    .sidebar.active ~ .main,
    .sidebar.active ~ .top-bar {
        width: 0;
        left: 100%;
    }
    .top-bar {
        padding: 0 10px;
    }
}

/* Dark Mode Styles */
body.dark-mode .sidebar {
    background: #003d7a;
    box-shadow: 0 4px 8px rgba(255, 255, 255, 0.1);
}

body.dark-mode .sidebar ul li:hover {
    background: #005bb5;
}

body.dark-mode .sidebar ul li:first-child {
    border-bottom: 1px solid #aaa;
}

body.dark-mode .sidebar ul li a {
    color: #e0e0e0;
}

body.dark-mode .sidebar ul li a i {
    color: #e0e0e0;
}