:root {
    --primary-color: #fc7f10e2;
    --primary-dark: #fc7f10;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --light-bg: #f8fafc;
    --dark-bg: #1e293b;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --sidebar-width: 260px;
    --navbar-height: 70px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--light-bg);
    padding-left: var(--sidebar-width);
    padding-top: var(--navbar-height);
}

/* Sidebar Navigation */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-color), var(--primary-dark));
    padding: 1.5rem 0;
    z-index: 1001;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-brand {
    padding: 0 1.5rem;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.sidebar-brand-icon {
    font-size: 2rem;
}

.sidebar-brand-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin-bottom: 0.25rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

.sidebar-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: white;
}

.sidebar-menu a.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: white;
}

.sidebar-menu i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.2);
    margin: 1rem 0;
}

/* Top Navigation Bar */
.navbar {
    background: white;
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 1000;
    height: var(--navbar-height);
}

.navbar-container {
    height: 100%;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 1rem;
    align-items: center;
    margin: 0;
}

.navbar-menu li {
    display: flex;
    align-items: center;
}

.navbar-menu a {
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.navbar-menu a:hover {
    color: var(--primary-color);
    background-color: var(--light-bg);
}

.navbar-menu a.logout-link {
    color: var(--danger-color);
}

.navbar-menu a.logout-link:hover {
    background-color: #fee2e2;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    background-color: var(--light-bg);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.user-initial {
    background: var(--primary-color);
    color: white;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

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

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
}

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

/* Password Toggle */
.password-wrapper {
    position: relative;
    display: block;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.1rem;
    padding: 5px;
    user-select: none;
    z-index: 10;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--primary-color);
}

.password-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

.form-control.with-toggle {
    padding-right: 45px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    text-align: center;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

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

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

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

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

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

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

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

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

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

th {
    background-color: var(--light-bg);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

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

/* Book Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.book-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.book-cover {
    width: 100%;
    height: 300px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.book-info {
    padding: 1rem;
}

.book-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.book-author {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.book-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.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: #f1f5f9;
    color: #475569;
}

/* 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);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.close-modal {
    float: right;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-modal:hover {
    color: var(--text-primary);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

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

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Search Box */
.search-box {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-box input {
    flex: 1;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-primary);
}

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

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

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fc7f1024, #fc7f1024);
    padding: 2rem 1rem;
}

/* Remove body padding for auth pages */
body:has(.auth-container) {
    padding-left: 0;
    padding-top: 0;
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 600px;
    animation: fadeInUp 0.5s ease-out;
}

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

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.auth-footer p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Reader Styles */
.reader-container {
    max-width: 900px;
    margin: 2rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.reader-header {
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 2rem;
}

.reader-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.reader-content {
    min-height: 500px;
    line-height: 1.8;
    font-size: 1.1rem;
    padding: 2rem;
    background: #fefefe;
    border-radius: 4px;
}

.page-indicator {
    color: var(--text-secondary);
}

.icon-large {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Form Row for Two Columns */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 70px;
    }
    
    body {
        padding-left: var(--sidebar-width);
    }
    
    .sidebar {
        width: var(--sidebar-width);
    }
    
    .sidebar-brand-text {
        display: none;
    }
    
    .sidebar-menu a {
        padding: 0.875rem 1rem;
        justify-content: center;
    }
    
    .sidebar-menu a span {
        display: none;
    }
    
    .navbar {
        left: var(--sidebar-width);
    }
    
    .navbar-container {
        padding: 0 1rem;
    }
    
    .user-info span {
        display: none;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .book-cover {
        height: 200px;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .auth-card {
        padding: 1.5rem;
        max-width: 100%;
    }
    
    .auth-header h1 {
        font-size: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Hide icons on mobile devices EXCEPT password toggle */
    .form-label i,
    .btn i,
    .auth-footer i,
    .alert i,
    small i {
        display: none;
    }
    
    /* Keep password toggle icon visible */
    .password-toggle i {
        display: inline-block !important;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.25rem;
    }
    
    .form-control {
        padding: 0.625rem;
        font-size: 0.95rem;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.95rem;
    }
}

/* Loading Spinner */
.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

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

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
/* Full width button spacing */
.auth-btn {
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    font-weight: 600;
    border-radius: 6px;
    text-align: center;
}

/* OR Divider */
.auth-divider {
    text-align: center;
    margin: 18px 0;
    position: relative;
}

.auth-divider span {
    background: #fff;
    padding: 0 12px;
    color: #777;
    font-size: 14px;
}

.auth-divider:before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
    z-index: -1;
}

/* Google Button Professional */
.btn-google {
    background: #ffffff;
    color: #444;
    border: 1px solid #ddd;
    transition: 0.3s ease;
}

.btn-google:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.btn-google i {
    color: #db4437;
    margin-right: 8px;
}
/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: 0.3s ease;
}

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

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.bg-primary { background: #4f46e5; }
.bg-success { background: #16a34a; }
.bg-warning { background: #f59e0b; }

.stat-number {
    font-size: 1.8rem;
    font-weight: bold;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

/* Smaller book cards */
.book-card.small {
    padding: 1rem;
}