/* ============================================
   Library Management System - Styles
   Colors: White, Red, Blue, Yellow
============================================ */

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

:root {
    --primary-blue: #2563eb;
    --primary-red: #dc2626;
    --primary-yellow: #f59e0b;
    --success-green: #16a34a;
    
    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --bg-gray: #f1f5f9;
    
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    
    --sidebar-width: 250px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

/* ============================================
   Login Page
============================================ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-red) 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    display: inline-block;
    width: 60px;
    height: 60px;
    background: var(--primary-blue);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
    color: var(--text-dark);
}

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

.login-form {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.error-message {
    background: #fee2e2;
    color: var(--primary-red);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
}

.success-message {
    background: #d1fae5;
    color: var(--success-green);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
}

.login-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-muted);
}

.login-footer code {
    background: var(--bg-gray);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--primary-blue);
}

/* ============================================
   Buttons
============================================ */

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

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

.btn-success:hover:not(:disabled) {
    background: #15803d;
}

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

.btn-yellow:hover:not(:disabled) {
    background: #d97706;
}

.btn-secondary {
    background: var(--bg-gray);
    color: var(--text-dark);
}

.btn-secondary:hover:not(:disabled) {
    background: #e2e8f0;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* ============================================
   Layout
============================================ */

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-small {
    width: 40px;
    height: 40px;
    background: var(--primary-blue);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header h2 {
    font-size: 18px;
    color: var(--text-dark);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item:hover {
    background: var(--bg-light);
    color: var(--primary-blue);
}

.nav-item.active {
    background: #eff6ff;
    color: var(--primary-blue);
    border-right: 3px solid var(--primary-blue);
}

.nav-item .icon {
    font-size: 20px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    max-width: calc(100vw - var(--sidebar-width));
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* ============================================
   Stats Cards
============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid;
}

.stat-blue {
    border-color: var(--primary-blue);
}

.stat-green {
    border-color: var(--success-green);
}

.stat-yellow {
    border-color: var(--primary-yellow);
}

.stat-red {
    border-color: var(--primary-red);
}

.stat-icon {
    font-size: 40px;
}

.stat-details h3 {
    font-size: 32px;
    margin-bottom: 5px;
}

.stat-details p {
    color: var(--text-muted);
    font-size: 14px;
}

/* ============================================
   Cards
============================================ */

.card {
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

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

.card-header h3 {
    font-size: 18px;
}

.card-body {
    padding: 24px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* ============================================
   Tables
============================================ */

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--bg-light);
}

table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
}

table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

table tbody tr:hover {
    background: var(--bg-light);
}

/* ============================================
   Badges
============================================ */

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.badge-blue {
    background: #dbeafe;
    color: var(--primary-blue);
}

.badge-green {
    background: #d1fae5;
    color: var(--success-green);
}

.badge-yellow {
    background: #fef3c7;
    color: #d97706;
}

.badge-red {
    background: #fee2e2;
    color: var(--primary-red);
}

/* ============================================
   Utilities
============================================ */

.text-muted {
    color: var(--text-muted);
}

.text-red {
    color: var(--primary-red);
}

.text-center {
    text-align: center;
}

.loader {
    border: 3px solid var(--bg-gray);
    border-top: 3px solid var(--primary-blue);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Charts */
.chart-container {
    min-height: 200px;
}

.category-bars {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.category-bar-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.progress-bar {
    height: 8px;
    background: var(--bg-gray);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-blue);
    transition: width 0.3s;
}

/* Recent List */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recent-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
}

.recent-info strong {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.recent-info p {
    font-size: 12px;
}

.recent-status {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
}

.recent-status small {
    font-size: 11px;
}

/* Financial Stats */
.financial-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.financial-item {
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.financial-item span {
    font-size: 14px;
    color: var(--text-muted);
}

.financial-item strong {
    font-size: 24px;
}

/* ============================================
   Search Bar
============================================ */

.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

/* ============================================
   Modals
============================================ */

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ============================================
   Mobile Hamburger Menu
============================================ */

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
    margin-right: 15px;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    border-radius: 3px;
    transition: all 0.3s;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   Responsive - Mobile
============================================ */

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
        padding: 15px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .page-header > div:first-child {
        width: 100%;
        display: flex;
        align-items: flex-start;
        gap: 0;
    }
    
    .page-header > div:first-child > div {
        flex: 1;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .card {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px auto;
    }
    
    .search-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-bar > * {
        width: 100%;
    }
    
    .financial-stats {
        grid-template-columns: 1fr;
    }
    
    .user-info {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .stat-card {
        padding: 16px;
    }
    
    .stat-icon {
        font-size: 30px;
    }
    
    .stat-details h3 {
        font-size: 24px;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .hamburger {
        margin-right: 10px;
    }
}

/* ============================================
   EASY FIX: Hamburger Icon Position Fix
============================================ */

/* Add a smooth transition for the movement */
.hamburger {
    transition: transform 0.3s ease;
}

/* When the hamburger is active (an 'X'), move it to the right */
.hamburger.active {
    transform: translateX(280px);
}