/*
 * Book Lending Manager - Stylesheet
 * Pure CSS3 - no external frameworks
 */

/* CSS Variables */
:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.main {
    padding: 40px 0;
    min-height: calc(100vh - 60px - 60px);
}

/* Navbar */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    box-shadow: var(--shadow);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    text-decoration: none;
    color: var(--primary-color);
}

.navbar-nav {
    display: flex;
    list-style: none;
    gap: 25px;
    align-items: center;
}

.navbar-nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.2s;
}

.navbar-nav a:hover {
    color: var(--primary-color);
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    list-style: none;
    padding: 8px 0;
    min-width: 150px;
    display: none;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

/* Footer */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
    text-align: center;
    color: var(--text-muted);
}

/* Typography */
h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
}

h3 {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

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

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

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

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat-warning .stat-value {
    color: var(--danger-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

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

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

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

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

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

.btn-danger:hover {
    background: #dc2626;
}

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

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

.btn-link {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: inherit;
}

.btn-google {
    background: white;
    color: #757575;
    border: 1px solid #dadce0;
    padding: 12px 24px;
    font-size: 1rem;
    justify-content: center;
}

.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.google-icon {
    width: 18px;
    height: 18px;
}

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

/* Forms */
.form {
    max-width: 600px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

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

.form-group small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.input-with-action {
    display: flex;
    gap: 10px;
}

.input-with-action select {
    flex: 1;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.book-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.book-cover {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: var(--bg-color);
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-muted);
}

.book-cover-placeholder small {
    font-size: 0.9rem;
    padding: 10px;
    text-align: center;
}

.book-status {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

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

.book-details {
    padding: 15px;
}

.book-details h3 {
    font-size: 1rem;
    margin: 0 0 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.book-publisher {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.book-actions {
    padding: 0 15px 15px;
    display: flex;
    gap: 8px;
}

/* Loans */
.loans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.loan-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.loan-overdue {
    border-left: 4px solid var(--danger-color);
}

.loan-book {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.book-cover-small {
    width: 60px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
}

.book-cover-placeholder {
    width: 60px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: 4px;
    font-size: 1.5rem;
}

.book-info h3 {
    font-size: 1rem;
    margin: 0 0 5px;
}

.book-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.loan-details p {
    font-size: 0.9rem;
    margin: 5px 0;
}

.loan-actions {
    margin-top: 15px;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

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

.table th {
    background: var(--bg-color);
    font-weight: 600;
}

.table tr:hover {
    background: var(--bg-color);
}

.book-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.book-thumb {
    width: 40px;
    height: 60px;
    object-fit: cover;
    border-radius: 3px;
}

.book-thumb-placeholder {
    width: 40px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: 3px;
}

/* Borrowers */
.borrowers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.borrower-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
}

.borrower-avatar {
    font-size: 2.5rem;
}

.borrower-info {
    flex: 1;
}

.borrower-info h3 {
    font-size: 1.1rem;
    margin: 0 0 5px;
}

.borrower-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 3px 0;
}

.borrower-actions {
    display: flex;
    gap: 5px;
}

/* Login Page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 40px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.login-card h1 {
    margin-bottom: 10px;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.login-description {
    text-align: left;
    background: var(--bg-color);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 25px;
}

.login-description p {
    margin-bottom: 15px;
}

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

.feature-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.login-note {
    margin-top: 20px;
    color: var(--text-muted);
}

/* Modal */
.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(--card-bg);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    margin: 0;
}

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

.modal form {
    padding: 20px;
}

/* Search */
.search-section {
    margin-bottom: 30px;
}

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

.search-form input {
    flex: 1;
}

.search-results {
    margin-top: 15px;
}

.search-result-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--bg-color);
}

.search-result-cover {
    width: 50px;
    height: 75px;
    object-fit: cover;
    border-radius: 4px;
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-item {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.history-icon {
    font-size: 1.5rem;
}

.history-content {
    flex: 1;
}

.history-content p {
    margin: 5px 0;
}

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

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Actions Bar */
.actions-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

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

.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Utilities */
.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 25px 0;
}

.book-cover-preview {
    max-width: 150px;
    border-radius: var(--radius);
}

.book-cover-medium {
    width: 100px;
    height: 150px;
    object-fit: cover;
    border-radius: var(--radius);
}

.book-cover-medium-placeholder {
    width: 100px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: var(--radius);
    font-size: 2rem;
}

.book-header {
    display: flex;
    gap: 20px;
    align-items: center;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-nav {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .books-grid,
    .loans-grid,
    .borrowers-grid {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 10px;
    }
    
    .book-thumb,
    .book-thumb-placeholder {
        width: 30px;
        height: 45px;
    }
    
    .form-actions {
        flex-direction: column;
    }
}
