/* Import fonts */
@import 'fonts.css';

/* Basic Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    line-height: 1.6;
    background-color: #f0f2f5; /* Light grey background for dashboard */
    color: #333;
    font-size: 0.9rem; /* Smaller global font size */
}

/* Dashboard Layout */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: 250px;
    background-color: #34495e; /* Dark blue-grey for sidebar */
    color: #ecf0f1;
    padding: 20px 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 0 15px;
    color: #fff;
}

.sidebar-logo {
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
    border-radius: 50%; /* Make logo round if it's an image */
    background-color: #fff; /* Placeholder background for logo */
}

.sidebar-header h3 {
    font-size: 1.4rem;
    margin-bottom: 5px;
    font-weight: 700;
}

.sidebar-header span {
    font-size: 0.8rem;
    color: #bdc3c7;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    flex-grow: 1;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.sidebar-menu li a i {
    margin-right: 10px;
    font-size: 1.1rem;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background-color: #2c3e50; /* Slightly darker hover/active */
    color: #ffffff;
    border-left: 5px solid #3498db; /* Blue accent on active/hover */
    padding-left: 15px; /* Adjust padding due to border */
}

.sidebar-footer {
    padding: 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer a {
    color: #ecf0f1;
    text-decoration: none;
    transition: color 0.3s ease;
}

.sidebar-footer a:hover {
    color: #e74c3c; /* Red for logout hover */
}

/* Main Content Wrapper */
.main-content-wrapper {
    flex-grow: 1;
    background-color: #f0f2f5; /* Light grey background */
}

/* Topbar Styles */
.topbar {
    background-color: #ffffff;
    padding: 15px 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.topbar-left i {
    font-size: 1.3rem;
    color: #555;
    cursor: pointer;
}

.topbar-right {
    display: flex;
    align-items: center;
}

.user-info {
    text-align: right;
    margin-right: 15px;
}

.user-info span {
    display: block;
    font-weight: 600;
    color: #333;
}

.user-info small {
    color: #777;
    font-size: 0.8rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #3498db;
    object-fit: cover;
}

/* Main Content Area */
main {
    padding: 25px;
}

/* General Container and Card Styles (adjusted for dashboard) */
.container {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 25px;
}

.card {
    border: none; /* Remove default card border */
    border-radius: 8px; /* Rounded corners */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Soft shadow */
    margin-bottom: 25px;
    background-color: #ffffff;
}

.card-header {
    background-color: #f8f9fa; /* Light grey header */
    border-bottom: 1px solid #e9ecef;
    color: #34495e; /* Darker text */
    font-weight: 700;
    font-size: 1rem;
    padding: 15px 20px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.card-body {
    padding: 20px;
}

/* Dashboard Stats Cards */
.card-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.card-stats {
    display: flex;
    align-items: center;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card-stats:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 2.5rem;
    margin-right: 20px;
    padding: 15px;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.members {
    background-color: #3498db; /* Blue */
}
.stat-icon.books {
    background-color: #2ecc71; /* Green */
}
.stat-icon.issues {
    background-color: #f1c40f; /* Yellow */
}
.stat-icon.overdue {
    background-color: #e74c3c; /* Red */
}

.stat-content {
    text-align: left;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #777;
    text-transform: uppercase;
}

.view-all-btn {
    display: inline-block;
    padding: 5px 12px;
    margin-top: 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    text-decoration: none;
    color: #fff;
    transition: background-color 0.2s ease-in-out;
}

.view-all-btn.members {
    background-color: #3498db;
}
.view-all-btn.members:hover {
    background-color: #217dbb;
}
.view-all-btn.books {
    background-color: #2ecc71;
}
.view-all-btn.books:hover {
    background-color: #27ad60;
}
.view-all-btn.issues {
    background-color: #f1c40f;
}
.view-all-btn.issues:hover {
    background-color: #d1a80e;
}
.view-all-btn.overdue {
    background-color: #e74c3c;
}
.view-all-btn.overdue:hover {
    background-color: #c0392b;
}

/* Table Styles (enhanced) */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table thead th {
    background-color: #f8f9fa; /* Light grey header */
    color: #555;
    padding: 12px 15px;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
    text-transform: uppercase;
}

.table tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    color: #444;
    font-size: 0.85rem;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background-color: #f5f5f5; /* Subtle hover effect */
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.returned {
    background-color: #d4edda; /* Light green */
    color: #155724; /* Dark green text */
}

.status-badge.issued {
    background-color: #f8d7da; /* Light red */
    color: #721c24; /* Dark red text */
}

.status-badge.available {
    background-color: #cfe2ff; /* Light blue */
    color: #084298; /* Dark blue text */
}

/* Form styles (adjusted for smaller fonts/dashboard context) */
.form-group {
    margin-bottom: 1rem;
}

.form-control {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    border-radius: 5px;
    border: 1px solid #ced4da;
}

.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

label {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    border-radius: 5px;
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
}
.btn-primary:hover {
    background-color: #0069d9;
    border-color: #0062cc;
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
}
.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

/* Filter Section Styles (adjusted for smaller fonts/dashboard context) */
.filter-section {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filter-section form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: flex-end;
}

.filter-section label {
    font-size: 0.85rem;
    color: #666;
}

/* Utility Classes (adjusted for smaller fonts) */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* Responsive Design */
@media (max-width: 992px) {
    .sidebar {
        width: 60px;
        overflow: hidden;
    }

    .sidebar:hover {
        width: 250px; /* Expand on hover */
    }

    .sidebar-header h3,
    .sidebar-header span,
    .sidebar-menu li a span,
    .sidebar-footer a span {
        display: none;
    }

    .sidebar-menu li a i {
        margin-right: 0;
    }

    .sidebar-menu li a {
        justify-content: center;
    }

    .sidebar-footer {
        border-top: none;
        padding: 10px 0;
    }

    .sidebar-footer a {
        font-size: 0;
    }

    .sidebar-footer a i {
        font-size: 1.3rem;
    }

    .topbar-left .toggle-sidebar {
        display: none; /* Hide toggle on smaller screens if sidebar is always minimized */
    }
}

@media (max-width: 768px) {
    .dashboard-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        padding: 10px 0;
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
    }

    .sidebar-header {
        margin-bottom: 0;
        flex-direction: row;
        display: flex;
        align-items: center;
    }
    
    .sidebar-logo {
        margin-right: 10px;
        margin-bottom: 0;
    }

    .sidebar-menu {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .sidebar-menu li {
        margin: 0 5px;
    }

    .sidebar-menu li a {
        padding: 8px 12px;
        border-left: none; /* Remove left border on mobile */
        border-radius: 5px;
    }

    .sidebar-menu li a:hover,
    .sidebar-menu li a.active {
        border-left: none;
    }

    .sidebar-footer {
        display: none; /* Hide footer on very small screens */
    }

    .main-content-wrapper {
        padding-top: 0; /* No top padding if sidebar is above */
    }

    .topbar {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    .topbar-left,
    .topbar-right {
        width: 100%;
        justify-content: center;
        margin-bottom: 10px;
    }

    .topbar-left {
        order: 2; /* Move toggle below user info */
    }

    .topbar-right {
        order: 1;
        margin-right: 0;
    }

    .user-info {
        margin-right: 10px;
        text-align: center;
    }

    .user-avatar {
        margin-left: 0;
    }

    .card-stats-row {
        grid-template-columns: 1fr;
    }
}
