/* --- GLOBAL STYLES & VARIABLES --- */
:root {
    --primary-color: #4A69E2;
    --primary-light: #F0F4FF;
    --secondary-color: #F9F9FB;
    --text-color-dark: #333;
    --text-color-light: #777;
    --border-color: #EAEAEA;
    --white-color: #FFFFFF;
    --green-color: #28a745;
    --red-color: #dc3545;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --border-radius: 12px;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--secondary-color);
    color: var(--text-color-dark);
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background-color: var(--white-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    display: flex;
    align-items: center;
    margin-bottom: 40px;
}

.logo-icon {
    font-size: 32px;
    color: var(--primary-color);
    margin-right: 12px;
}

.logo-text h2 {
    font-size: 20px;
    font-weight: 600;
}

.logo-text span {
    font-size: 12px;
    color: var(--text-color-light);
}

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

.sidebar-menu li {
    margin-bottom: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-color-light);
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link i {
    font-size: 18px;
    width: 20px;
    margin-right: 16px;
}

.nav-link:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: var(--white-color);
}

.sidebar-footer {
    background-color: var(--secondary-color);
    padding: 16px;
    border-radius: var(--border-radius);
    text-align: center;
}

.sidebar-footer p {
    font-weight: 600;
    font-size: 14px;
}

.sidebar-footer span {
    font-size: 12px;
    color: var(--text-color-light);
}

/* --- MAIN CONTENT --- */
.main-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
}

.page-header p {
    color: var(--text-color-light);
    font-size: 14px;
}

.page-header.with-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- SHARED COMPONENTS (Buttons, Cards, Search) --- */
.card {
    background-color: var(--white-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--box-shadow);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white-color);
}

.btn-primary:hover {
    background-color: #3a57c4; /* A slightly darker primary color */
}

.search-bar {
    position: relative;
    margin-bottom: 24px;
}

.search-bar i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color-light);
}

.search-bar input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
}

/* --- DASHBOARD --- */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.stat-card {
    background-color: var(--white-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--box-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-info h4 {
    font-weight: 500;
    color: var(--text-color-light);
    font-size: 14px;
}

.stat-info h2 {
    font-size: 32px;
    margin: 4px 0;
}

.stat-growth {
    font-size: 14px;
    font-weight: 500;
}

.stat-growth.green { color: var(--green-color); }
.stat-growth.red { color: var(--red-color); }

.stat-icon {
    font-size: 24px;
    padding: 16px;
    border-radius: 50%;
    color: var(--primary-color);
    background-color: var(--primary-light);
}

.stat-icon.red {
    color: var(--red-color);
    background-color: #fdeaea;
}

.recent-activity ul {
    list-style: none;
}

/* --- ISSUE & RETURN PAGE --- */
.form-container.card {
    padding: 0;
}
.form-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}
.tab-link {
    background: none;
    border: none;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-color-light);
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}
.tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}
.form-content {
    display: none;
    padding: 24px;
}
.form-content.active {
    display: block;
}
.form-content h3 {
    margin-bottom: 20px;
    font-weight: 600;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}
.form-group input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 14px;
}
.form-submit-btn {
    margin-top: 24px;
}
.fine-info {
    margin-top: 16px;
    padding: 12px;
    background-color: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
    border-radius: 8px;
    display: none; /* Hidden by default */
}

/* --- REPORTS PAGE --- */
.grid-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}
.report-card {
    text-align: center;
}
.report-icon {
    font-size: 40px;
    color: var(--primary-color);
    margin-bottom: 16px;
}
.report-card h3 {
    margin-bottom: 8px;
}
.report-card p {
    color: var(--text-color-light);
    font-size: 14px;
    margin-bottom: 12px;
}
.report-card span {
    display: block;
    font-weight: 600;
    margin-bottom: 20px;
}

/* --- MODAL --- */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--white-color);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 500px;
    animation: slide-down 0.3s ease-out;
}

@keyframes slide-down {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-color-light);
    cursor: pointer;
    line-height: 1;
}

#modal-form .form-group {
    margin-bottom: 16px;
}

/* --- Add these styles to your existing style.css file --- */

/* Action buttons for list items */
.item-actions {
    display: flex;
    gap: 10px;
    margin-left: 20px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-color-light);
    cursor: pointer;
    font-size: 16px;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

/* Make sure clicks on icons are registered by their parent button */
.btn-icon i {
    pointer-events: none;
}

/* Staff card actions */
.staff-actions {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    gap: 10px;
}


.stat-icon.red {
    color: var(--red-color);
    background-color: #fdeaea;
}

.recent-activity ul {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-text {
    font-size: 14px;
}

.activity-text strong {
    font-weight: 500;
    color: var(--primary-color);
}

.activity-text em {
    font-style: normal;
    color: var(--text-color-dark);
}

.activity-date {
    font-size: 13px;
    color: var(--text-color-light);
    white-space: nowrap;
    margin-left: 16px;
}

/* --- ISSUE & RETURN PAGE --- */
.form-container.card {
    padding: 0;
}

/* --- NEW STYLES for Book Status & Student History --- */

/* List item card layout */
.list-item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.item-details {
    flex-grow: 1;
}

/* Book Status Badge */
.item-status .status {
    font-size: 13px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 16px;
    white-space: nowrap;
}

.status.available {
    color: var(--green-color);
    background-color: #eaf6ec;
}

.status.unavailable {
    color: var(--red-color);
    background-color: #fdeaea;
}

/* Student History Modal Table */
.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.history-table th,
.history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.history-table th {
    font-weight: 600;
    font-size: 14px;
    background-color: var(--secondary-color);
}

.history-table td {
    font-size: 14px;
}

.status-badge {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.status-badge.issued {
    color: #b45309;
    background-color: #fffbeb;
}

.status-badge.returned {
    color: #166534;
    background-color: #f0fdf4;
}