/* =======================================================
    PAWPALS: FINAL & CLEANED DASHBOARD STYLES
   ======================================================= */

.dashboard-layout {
    display: flex;
    min-height: 100vh;
    background-color: #f4f7f6;
}

/* --- Sidebar Styles (For Desktop View) --- */
.sidebar {
    width: 260px;
    background: var(--primary-dark);
    color: var(--background-white);
    position: fixed;
    height: 100%;
    left: 0;
    top: 0;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease-in-out, transform 0.3s ease-in-out;
}
.sidebar-header { padding: 1.5rem; text-align: center; }
.sidebar .logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--background-white);
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}
.sidebar-nav { list-style: none; flex-grow: 1; padding: 0;}
.sidebar-footer { list-style: none; border-top: 1px solid rgba(255, 255, 255, 0.1); padding: 0; }

.sidebar-nav-item a {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
}
.sidebar-nav-item a .icon {
    margin-right: 15px;
    font-size: 1.2rem;
    width: 25px;
    text-align: center;
    transition: margin 0.3s ease-in-out;
}
.sidebar-nav-item a span {
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}
.sidebar-nav-item a:hover { background: rgba(255, 255, 255, 0.1); color: white; }
.sidebar-nav-item.active a {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

/* --- Main Content Wrapper & Top Navbar --- */
.main-content-wrapper {
    flex-grow: 1;
    margin-left: 260px;
    transition: margin-left 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    width: calc(100% - 260px);
}
.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--background-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.sidebar-toggle-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-dark);
    cursor: pointer;
}
.profile-dropdown { position: relative; }
.profile-btn {
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    cursor: pointer;
    gap: 10px;
}
.profile-btn img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.profile-btn span { font-weight: 600; color: var(--text-dark); }
.profile-btn .fa-chevron-down { color: var(--text-medium); transition: transform 0.3s; }
.profile-dropdown.open .fa-chevron-down { transform: rotate(180deg); }

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 120%;
    background: var(--background-white);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-radius: 8px;
    min-width: 200px;
    z-index: 1;
    overflow: hidden;
}
.dropdown-content.show { display: block; }
.dropdown-content a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-dark);
    font-size: 0.9rem;
    transition: background-color 0.2s;
    text-decoration: none;
}
.dropdown-content a:hover { background-color: #f1f1f1; }
.dropdown-divider { height: 1px; background-color: var(--border-color); margin: 5px 0; }

/* --- Main Content Area --- */
.main-content { padding: 2rem; }
.dashboard-header { margin-bottom: 2rem; }
.dashboard-header h1 { font-size: 2.2rem; margin-bottom: 0.5rem; }
.dashboard-header p { color: var(--text-medium); }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}
.dashboard-grid .card { padding: 1.5rem; display: flex; flex-direction: column; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}
.card-header h3 { margin: 0; font-size: 1.1rem; }
.card-header .fas { color: var(--primary-color); }
.card-content {
    min-width: 0;
    flex-grow: 1;
}
.card-footer { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-color); font-size: 0.9rem; color: var(--text-medium); }
.wide-card { grid-column: span 2; }

/* --- Reusable Table Styles --- */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}
.data-table thead th {
    background-color: #f8f9fa;
    color: var(--text-dark);
    font-weight: 600;
}
.data-table tbody tr:nth-child(even) { background-color: #fdfdfd; }
.data-table tbody tr:hover { background-color: #f1f7f6; }
.data-table .actions a {
    margin: 0 8px;
    color: var(--text-medium);
    transition: color 0.2s;
}
.data-table .actions a:hover { color: var(--primary-color); }

/* --- Reusable Form Styles --- */
.dashboard-form .form-group { margin-bottom: 1.5rem; }
.dashboard-form label { display: block; font-weight: 600; margin-bottom: 0.5rem; color: var(--text-dark); }
.dashboard-form input[type="text"],
.dashboard-form input[type="email"],
.dashboard-form input[type="password"],
.dashboard-form select {
    width: 100%;
    max-width: 500px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.dashboard-form .checkbox-group { display: flex; align-items: center; }
.dashboard-form .checkbox-group input { width: auto; margin-right: 10px; }

/* --- Sidebar Collapsed State --- */
.sidebar-collapsed .sidebar { width: 90px; }
.sidebar-collapsed .sidebar .logo,
.sidebar-collapsed .sidebar-nav-item span {
    opacity: 0;
    width: 0;
    pointer-events: none;
}
.sidebar-collapsed .sidebar-nav-item a .icon { margin-right: 0; }
.sidebar-collapsed .main-content-wrapper { margin-left: 90px; }

/* --- Mobile Bottom Nav (Initially hidden on desktop) --- */
.mobile-bottom-nav { display: none; }

/* =======================================================
    TABLET & MOBILE RESPONSIVE (< 992px)
   ======================================================= */
@media (max-width: 992px) {
    .sidebar {
        display: flex;
        transform: translateX(-100%);
        width: 260px;
        transition: transform 0.3s ease-in-out;
    }
    
    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar.mobile-open::before {
        content: '';
        position: fixed;
        top: 0; left: 260px;
        width: 100vw; height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
    }
    
    .main-content-wrapper,
    .sidebar-collapsed .main-content-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .sidebar-toggle-btn { display: block; }
    .top-navbar::before {
        content: "PawPals";
        font-weight: 700;
        font-size: 1.5rem;
        color: var(--primary-dark);
        display: none;
    }
    
    .main-content {
        padding-bottom: 80px;
    }
    .wide-card { grid-column: span 1; }

    .mobile-bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: stretch;
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 65px;
        background: var(--background-white);
        box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
        z-index: 1000;
    }
    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-medium);
        padding: 5px;
        flex-grow: 1;
        transition: color 0.3s;
    }
    .bottom-nav-item .icon { font-size: 1.5rem; margin-bottom: 4px; }
    .bottom-nav-item .label { font-size: 0.7rem; }
    .bottom-nav-item.active, .bottom-nav-item:hover { color: var(--primary-color); }
}

/* =======================================================
    SMALLER MOBILE (< 768px)
   ======================================================= */
@media (max-width: 768px) {
    .top-navbar { padding: 0.8rem 1rem; }
    .profile-btn span { display: none; }
    .main-content { padding: 1.5rem 1rem 80px 1rem; }
    .dashboard-header h1 { font-size: 1.8rem; }
}