/* ================================
   Library Management System Styles
   Modern & Responsive Design
   ================================ */

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4F46E5;
    --secondary-color: #6B7280;
    --success-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --info-color: #3B82F6;
    --dark-color: #1F2937;
    --light-color: #F3F4F6;
    --white: #FFFFFF;
    --sidebar-width: 260px;
    --topbar-height: 70px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #F9FAFB;
    color: #111827;
    line-height: 1.6;
}

/* ================================
   Sidebar
   ================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #4F46E5 0%, #6366F1 100%);
    color: var(--white);
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

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

.sidebar-header i {
    font-size: 48px;
    margin-bottom: 10px;
    display: block;
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.sidebar-nav {
    padding: 1px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 8px 25px;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    border-left-color: var(--white);
    padding-left: 30px;
}

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

/* ================================
   Main Content
   ================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    background: var(--white);
    height: var(--topbar-height);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--dark-color);
    cursor: pointer;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--dark-color);
}

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

.user-info i {
    font-size: 20px;
    color: var(--primary-color);
}

.user-info span {
    font-weight: 500;
    color: var(--dark-color);
}

.content-wrapper {
    padding: 30px;
}

/* ================================
   Cards
   ================================ */
.card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 25px;
    overflow: hidden;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #F9FAFB;
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 25px;
}

/* ================================
   Statistics Cards
   ================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--white);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card-blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-card-green { background: linear-gradient(135deg, #10B981 0%, #059669 100%); }
.stat-card-purple { background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%); }
.stat-card-orange { background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%); }
.stat-card-red { background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%); }
.stat-card-yellow { background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%); }

.stat-icon {
    font-size: 48px;
    opacity: 0.9;
}

.stat-details h3 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-details p {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ================================
   Tables
   ================================ */
.table-responsive {
    overflow-x: auto;
}

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

.table thead {
    background: #F9FAFB;
}

.table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid #E5E7EB;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 15px;
    border-bottom: 1px solid #E5E7EB;
    font-size: 14px;
}

.table tbody tr:hover {
    background-color: #F9FAFB;
}

.overdue-row {
    background-color: #FEF2F2 !important;
}

/* ================================
   Buttons
   ================================ */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    text-align: center;
}

.btn i {
    margin-right: 5px;
}

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

.btn-primary:hover {
    background-color: #4338CA;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}

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

.btn-success:hover {
    background-color: #059669;
}

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

.btn-danger:hover {
    background-color: #DC2626;
}

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

.btn-warning:hover {
    background-color: #D97706;
}

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

.btn-info:hover {
    background-color: #2563EB;
}

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

.btn-secondary:hover {
    background-color: #4B5563;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 5px;
}

/* ================================
   Forms
   ================================ */
.form-group {
    margin-bottom:0px;
}

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

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

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

.filter-form .form-row {
    align-items: end;padding: 10px;
}

.form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--secondary-color);
}

textarea.form-control {
    resize: vertical;
}

select.form-control {
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 12px;
    padding-right: 40px;
}

/* ================================
   Badges
   ================================ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: #D1FAE5;
    color: #065F46;
}

.badge-danger {
    background-color: #FEE2E2;
    color: #991B1B;
}

.badge-warning {
    background-color: #FEF3C7;
    color: #92400E;
}

.badge-info {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.badge-secondary {
    background-color: #E5E7EB;
    color: #374151;
}

.badge-lg {
    padding: 6px 14px;
    font-size: 13px;
}

/* ================================
   Alerts
   ================================ */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.alert i {
    margin-right: 10px;
}

.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: #FEE2E2;
    color: #991B1B;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background-color: #FEF3C7;
    color: #92400E;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background-color: #DBEAFE;
    color: #1E40AF;
    border-left: 4px solid var(--info-color);
}

.alert-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

/* ================================
   Modal
   ================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--white);
    margin: 50px auto;
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 25px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark-color);
}

.modal form {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #F9FAFB;
}

.close {
    font-size: 32px;
    font-weight: bold;
    color: var(--secondary-color);
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--danger-color);
}

/* ================================
   Pagination
   ================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 20px;
}

.pagination a {
    padding: 8px 14px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    color: var(--dark-color);
    text-decoration: none;
    transition: all 0.3s;
}

.pagination a:hover {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

.pagination a.active {
    background-color: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* ================================
   Page Header
   ================================ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ================================
   Info Boxes
   ================================ */
.info-box {
    background: #F0F9FF;
    border: 1px solid #BAE6FD;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.info-box h4 {
    color: var(--info-color);
    margin-bottom: 10px;
    font-size: 16px;
}

.info-box p {
    margin-bottom: 5px;
    font-size: 14px;
}

.guidelines-list {
    list-style: none;
}

.guidelines-list li {
    padding: 10px 0;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    gap: 10px;
}

.guidelines-list li:last-child {
    border-bottom: none;
}

.guidelines-list i {
    color: var(--primary-color);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #E5E7EB;
}

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

.stat-label {
    font-weight: 500;
    color: var(--dark-color);
}

.stat-value {
    font-weight: 600;
    color: var(--primary-color);
}

/* ================================
   Quick Actions
   ================================ */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.quick-action-btn {
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    color: var(--white);
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.quick-action-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.quick-action-btn i {
    font-size: 48px;
}

.quick-action-btn span {
    font-size: 16px;
    font-weight: 600;
}

.quick-action-blue { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.quick-action-green { background: linear-gradient(135deg, #10B981 0%, #059669 100%); }
.quick-action-purple { background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%); }
.quick-action-orange { background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%); }

/* ================================
   Grid System
   ================================ */
.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.col-md-4 { grid-column: span 1; }
.col-md-6 { grid-column: span 1; }
.col-md-8 { grid-column: span 2; }

/* ================================
   Utility Classes
   ================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-info { color: var(--info-color); }
.text-muted { color: var(--secondary-color); }

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.return-details h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-size: 16px;
}

.return-details p {
    margin-bottom: 8px;
    font-size: 14px;
}

/* ================================
   Login Page
   ================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

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

.login-box {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    padding: 40px 30px;
    text-align: center;
}

.login-header i {
    font-size: 64px;
    margin-bottom: 15px;
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.login-header p {
    opacity: 0.9;
    font-size: 14px;
}

.login-form {
    padding: 40px 30px;
}

.login-footer {
    background: #F9FAFB;
    padding: 20px 30px;
    text-align: center;
    border-top: 1px solid #E5E7EB;
    font-size: 13px;
}

.login-footer code {
    background: #E5E7EB;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
}

/* ================================
   Responsive Design
   ================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .user-info span {
        display: none;
    }
    
    .content-wrapper {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 13px;
    }
    
    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .row {
        grid-template-columns: 1fr;
    }
    
    .col-md-4,
    .col-md-6,
    .col-md-8 {
        grid-column: span 1;
    }
}

/* ================================
   Print Styles
   ================================ */
@media print {
    .sidebar,
    .topbar,
    .page-header .btn,
    .btn-group,
    .pagination,
    .quick-actions,
    .form-actions {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
