

:root {
    --primary-purple: #9B6FDB;
    --dark-purple: #7C3AED;
    --light-purple: #C4B5FD;
    --primary-gold: #F59E0B;
    --dark-gold: #D97706;
    --gradient-bg: linear-gradient(180deg, #FCD34D 0%, #9B6FDB 50%, #EC4899 100%);
    --text-dark: #1F2937;
    --text-light: #FFFFFF;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: Arial, sans-serif;
    background: var(--gradient-bg);
    min-height: 100vh;
    color: var(--text-dark);
}

/* Landing Page */
.landing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 20px;
}

.logo {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.logo svg {
    width: 50px;
    height: 50px;
    fill: var(--primary-purple);
}

.welcome-title {
    font-size: 2rem;
    color: var(--text-light);
    margin-bottom: 10px;
    font-weight: normal;
}

.welcome-subtitle {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 30px;
}

.btn-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 10px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover {
    background: var(--dark-gold);
    transform: scale(1.05);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-purple);
}

.btn-secondary:hover {
    background: white;
    transform: scale(1.05);
}

/* Auth Pages (Login & Sign Up) */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-box {
    background: rgba(155, 111, 219, 0.9);
    padding: 30px 40px;
    border-radius: 15px;
    width: 100%;
    max-width: 350px;
}

.auth-box h2 {
    color: white;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: normal;
    display: flex;
    justify-content: center;
    align-content: center;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: white;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.95);
    color: #1F2937;
}

.form-control::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.form-control:focus {
    outline: 2px solid var(--primary-gold);
    color: #1F2937;
}

.btn-full {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-link {
    text-align: center;
    margin-top: 15px;
    color: white;
    font-size: 0.9rem;
}

.auth-link a {
    color: var(--primary-gold);
    text-decoration: none;
    font-weight: bold;
}

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

.error-message {
    background: #FEE2E2;
    color: #DC2626;
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 12px;
    text-align: center;
    font-size: 0.9rem;
}

.success-message {
    background: #D1FAE5;
    color: #059669;
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 12px;
    text-align: center;
    font-size: 0.9rem;
}

/* Navigation Bar */
.navbar {
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 50%, #5B21B6 100%);
    padding: 12px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.navbar-brand {
    color: var(--text-light);
    font-size: 1.3rem;
    font-weight: bold;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-brand svg {
    width: 24px;
    height: 24px;
    fill: var(--primary-gold);
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
    flex: 0 0 auto;
}

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

.navbar-menu a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
}

.navbar-menu a:hover {
    color: var(--primary-gold);
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.navbar-menu svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: inherit;
    font: inherit;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    min-width: 220px;
    z-index: 10001;
    overflow: visible;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown.active .dropdown-menu {
    max-height: 600px;
    opacity: 1;
    visibility: visible;
}

/* Profile Dropdown - Left Aligned */
.profile-dropdown .dropdown-menu,
.profile-left .dropdown-menu {
    left: 0;
    right: auto;
}

/* Profile Dropdown - Right Aligned */
.profile-right .dropdown-menu {
    left: auto;
    right: 0;
}

.profile-dropdown-menu {
    min-width: 280px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    white-space: nowrap;
    font-weight: 500;
    background: transparent;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(3px);
}

/* Active/Current Page Highlighting */
.dropdown-item.active,
.navbar-menu a.active {
    background: rgba(245, 158, 11, 0.2);
    color: var(--primary-gold);
    font-weight: 600;
}

.dropdown-item.active svg,
.navbar-menu a.active svg {
    fill: var(--primary-gold);
}

.dropdown-item svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex-shrink: 0;
}

.dropdown-toggle svg:last-child {
    transition: transform 0.3s ease;
}

.dropdown.active .dropdown-toggle svg:last-child {
    transform: rotate(180deg);
}

.search-bar {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 6px 12px;
    flex: 1 1 320px;
    min-width: min(100%, 280px);
    max-width: 520px;
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-dark);
    width: 100%;
    padding: 3px;
    font-size: 0.9rem;
}

.search-bar input::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

.search-bar svg {
    width: 18px;
    height: 18px;
    fill: var(--primary-purple);
}

.user-profile {
    width: 35px;
    height: 35px;
    background: rgba(245, 158, 11, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 35px;
    transition: all 0.3s ease;
    text-decoration: none;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-profile:hover {
    transform: scale(1.1);
    background: var(--dark-gold);
    border-color: rgba(255, 255, 255, 0.4);
}

.user-profile svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Main Content */
.main-content {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.section {
    margin-bottom: 30px;
}

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

.section-title {
    color: var(--text-light);
    font-size: 1.3rem;
    font-weight: normal;
}

.view-all {
    color: var(--primary-gold);
    text-decoration: none;
    font-size: 0.9rem;
}

.view-all:hover {
    text-decoration: underline;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.book-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

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

.book-cover {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: var(--light-purple);
}

.book-info {
    padding: 10px;
}

.book-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dark-purple);
    margin-bottom: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-author {
    color: #6B7280;
    font-size: 0.85rem;
}

.favorite-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.favorite-btn:hover {
    transform: scale(1.1);
}

.favorite-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--primary-gold);
}

/* Book Details Page */
.book-details {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    max-width: 1000px;
    margin: 30px auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.book-details-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
}

.book-cover-large {
    width: 100%;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.book-meta h1 {
    color: var(--dark-purple);
    margin-bottom: 10px;
}

.book-meta .author {
    color: var(--primary-gold);
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.book-meta .description {
    color: var(--text-dark);
    line-height: 1.6;
    margin-bottom: 30px;
}

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Reading Page */
.reading-container {
    background: rgba(255, 255, 255, 0.98);
    min-height: 100vh;
    padding: clamp(10px, 2vw, 20px);
}

.reading-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: clamp(10px, 2vw, 20px);
    padding: clamp(10px, 2vw, 15px);
    background: var(--light-purple);
    border-radius: 10px;
}

.reading-header h2 {
    overflow-wrap: anywhere;
}

.reading-area {
    width: min(100%, 900px);
    margin: 0 auto;
    background: white;
    padding: clamp(14px, 4vw, 40px);
    border-radius: 15px;
    box-shadow: var(--shadow);
    min-height: clamp(360px, 68vh, 760px);
    line-height: 1.8;
    font-size: 1.1rem;
}

.file-reader {
    width: min(100%, 1100px);
    padding: clamp(8px, 2vw, 20px);
}

.pdf-viewer {
    width: 100%;
    height: clamp(420px, calc(100vh - 190px), 900px);
    min-height: 0;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    display: block;
    background: #F8FAFC;
}

.text-reader {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: Arial, sans-serif;
    line-height: 1.8;
}

.reader-fallback {
    min-height: clamp(280px, 55vh, 450px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    text-align: center;
    color: var(--text-dark);
}

.reader-fallback h3 {
    color: var(--dark-purple);
}

.reading-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: min(100%, 1100px);
    margin: clamp(10px, 2vw, 20px) auto;
    gap: 15px;
    flex-wrap: wrap;
}

.page-info {
    min-width: 0;
    overflow-wrap: anywhere;
}

.btn-nav {
    background: var(--primary-purple);
    color: var(--text-light);
    padding: 10px 25px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-nav:hover {
    background: var(--dark-purple);
}

.btn-nav:disabled {
    background: #D1D5DB;
    cursor: not-allowed;
}

.page-info {
    color: var(--text-dark);
    font-weight: 500;
}

/* Admin Panel */
.admin-container {
    min-height: 100vh;
    padding: 30px;
}

.admin-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.admin-header h1 {
    color: var(--dark-purple);
    margin-bottom: 10px;
}

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

.admin-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

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

.admin-card svg {
    width: 50px;
    height: 50px;
    margin-bottom: 15px;
    fill: var(--primary-purple);
}

.admin-card h3 {
    color: var(--dark-purple);
    margin-bottom: 10px;
}

.admin-card p {
    color: #6B7280;
}

/* Form Styles */
.form-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    max-width: 800px;
    margin: 30px auto;
    box-shadow: var(--shadow);
}

.form-container h2 {
    color: var(--dark-purple);
    margin-bottom: 30px;
}

.file-upload {
    border: 2px dashed var(--light-purple);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload:hover {
    border-color: var(--primary-purple);
    background: rgba(139, 92, 246, 0.05);
}

.file-upload svg {
    width: 50px;
    height: 50px;
    fill: var(--primary-purple);
    margin-bottom: 10px;
}

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

/* Table Styles */
.table-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

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

th {
    background: var(--primary-purple);
    color: var(--text-light);
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 15px;
    border-bottom: 1px solid #E5E7EB;
}

tr:hover {
    background: rgba(139, 92, 246, 0.05);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 8px;
}

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

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

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

.btn-info:hover {
    background: var(--dark-purple);
}

/* Tablet Styles */
@media (max-width: 1024px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .book-cover {
        height: 190px;
    }
    
    .main-content {
        padding: 18px;
    }
    
    .book-details {
        padding: 30px;
    }
    
    .book-details-content {
        grid-template-columns: 250px 1fr;
        gap: 30px;
    }
    
    .admin-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 20px;
    }
    
    .form-container {
        padding: 35px;
    }
    
    .navbar {
        padding: 12px 20px;
    }
    
    .search-bar {
        flex: 1 1 280px;
        max-width: 450px;
    }
}

/* Responsive Design - Mobile */
@media (max-width: 768px) {
    body {
        font-size: 14px;
        overflow-x: hidden;
    }
    
    .welcome-title {
        font-size: 1.5rem;
    }
    
    .welcome-subtitle {
        font-size: 0.9rem;
    }
    
    /* Fix profile dropdown positioning on mobile */
    .profile-dropdown,
    .profile-right,
    .profile-left {
        position: static;
    }
    
    .profile-dropdown .dropdown-menu,
    .profile-right .dropdown-menu,
    .profile-left .dropdown-menu {
        position: fixed;
        top: auto;
        right: 10px;
        left: auto;
        transform: none;
        z-index: 99999;
        min-width: min(280px, calc(100vw - 20px));
        max-width: 320px;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
        margin-top: 0;
    }
    
    /* Calculate position dynamically */
    .navbar-menu .profile-dropdown.active .dropdown-menu,
    .navbar-menu .profile-right.active .dropdown-menu,
    .navbar-menu .profile-left.active .dropdown-menu {
        top: 70px;
    }
    
    /* Ensure dropdown doesn't interfere with content */
    .main-content {
        position: relative;
        z-index: 1;
        padding-top: 20px;
    }

    /* Admin Dashboard Mobile Fixes */
    .admin-wrapper {
        padding: 8px !important;
    }

    .top-bar {
        padding: 10px 12px !important;
        gap: 10px !important;
        flex-direction: column !important;
    }

    .admin-info {
        flex-direction: column !important;
        gap: 10px !important;
        width: 100%;
    }

    .admin-circle {
        width: 45px !important;
        height: 45px !important;
    }

    .admin-circle svg {
        width: 26px !important;
        height: 26px !important;
    }

    .admin-title h1 {
        font-size: 1rem !important;
    }

    .admin-title p {
        font-size: 0.8rem !important;
    }

    .top-buttons {
        width: 100%;
        flex-direction: column !important;
        gap: 6px !important;
    }

    .top-buttons .btn {
        width: 100% !important;
        padding: 8px 16px !important;
        font-size: 0.8rem !important;
        border-radius: 8px !important;
    }

    .welcome-box {
        padding: 14px !important;
        flex-direction: column !important;
        gap: 10px !important;
    }

    .welcome-box svg {
        width: 35px !important;
        height: 35px !important;
    }

    .welcome-box h2 {
        font-size: 1.1rem !important;
        margin-bottom: 4px !important;
    }

    .welcome-box p {
        font-size: 0.85rem !important;
    }

    .cards-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .card-item {
        padding: 16px 10px !important;
        border-radius: 12px !important;
    }

    .card-item svg {
        width: 32px !important;
        height: 32px !important;
        margin-bottom: 8px !important;
    }

    .card-item .big-number {
        font-size: 1.8rem !important;
    }

    .card-item .label-text {
        font-size: 0.85rem !important;
        margin-top: 4px !important;
    }

    .admin-users-panel {
        padding: 12px !important;
    }

    .admin-users-title {
        font-size: 1rem !important;
        margin-bottom: 12px !important;
        justify-content: center !important;
    }

    .admin-users-title svg {
        width: 20px !important;
        height: 20px !important;
    }

    .admin-user-search {
        flex-direction: column !important;
        gap: 6px !important;
        margin-bottom: 14px !important;
    }

    .admin-user-search-input {
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
        border-radius: 8px !important;
    }

    .admin-user-search-button {
        padding: 8px 16px !important;
        font-size: 0.8rem !important;
        border-radius: 8px !important;
        min-width: auto !important;
    }

    .admin-user-search-button svg {
        width: 14px !important;
        height: 14px !important;
    }

    .admin-users-panel table {
        font-size: 0.75rem !important;
    }

    .admin-users-panel th,
    .admin-users-panel td {
        padding: 8px 6px !important;
        font-size: 0.75rem !important;
    }

    .admin-users-panel td > div {
        gap: 6px !important;
    }

    .admin-users-panel td > div > div:first-child {
        width: 28px !important;
        height: 28px !important;
    }

    .admin-users-panel td > div > div svg {
        width: 16px !important;
        height: 16px !important;
    }

    .admin-users-panel span {
        padding: 4px 8px !important;
        font-size: 0.7rem !important;
    }

    .admin-users-panel button {
        padding: 5px 10px !important;
        font-size: 0.7rem !important;
        border-radius: 6px !important;
    }

    .admin-users-panel .btn-primary {
        padding: 8px 14px !important;
        font-size: 0.8rem !important;
    }
    
    /* Navbar Mobile */
    .navbar {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
        position: sticky;
        top: 0;
        z-index: 1000;
        overflow: visible;
    }
    
    .site-title {
        order: 1;
        width: 100%;
        text-align: center;
    }
    
    .site-title h1 {
        font-size: 1.3rem;
        margin: 0;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
        justify-content: center;
        width: 100%;
        order: 1;
    }
    
    .navbar-menu {
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 8px 12px;
        width: 100%;
        font-size: 0.85rem;
        order: 3;
        position: static;
        overflow: visible;
    }
    
    .navbar-menu li {
        position: static;
    }
    
    .navbar-menu li a {
        padding: 8px 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .user-profile {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }
    
    .search-bar {
        min-width: 100%;
        max-width: 100%;
        order: 2;
        flex: 1 1 auto;
    }
    
    /* Center regular dropdowns on mobile */
    .dropdown:not(.profile-dropdown):not(.profile-right):not(.profile-left) .dropdown-menu {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        min-width: min(280px, 90vw);
        max-width: 300px;
        margin-top: 5px;
    }
    
    .dropdown:not(.profile-dropdown):not(.profile-right):not(.profile-left).active .dropdown-menu {
        transform: translateX(-50%);
    }
    
    /* Ensure dropdown items don't overflow */
    .dropdown-item {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Adjust position if dropdown would go off screen */
    @media (max-width: 360px) {
        .profile-dropdown .dropdown-menu,
        .profile-right .dropdown-menu {
            right: 5px;
            max-width: calc(100vw - 20px);
            min-width: 260px;
        }
    }
    
    /* Prevent navbar overflow issues */
    .navbar-menu .dropdown {
        overflow: visible;
    }
    
    /* Book Details Mobile */
    .book-details {
        padding: 20px;
    }
    
    .book-details-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .book-cover-large {
        max-width: 250px;
        margin: 0 auto;
        display: block;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .book-cover {
        height: 160px;
    }
    
    .book-title {
        font-size: 0.85rem;
    }
    
    .book-author {
        font-size: 0.75rem;
    }
    
    /* Admin Dashboard Mobile */
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .dashboard-title {
        flex-direction: column;
        align-items: center;
    }
    
    .dashboard-title h1 {
        font-size: 1.3rem;
    }
    
    .header-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .welcome-banner {
        padding: 25px;
        flex-direction: column;
        text-align: center;
    }
    
    .welcome-text h2 {
        font-size: 1.5rem;
    }
    
    .welcome-text p {
        font-size: 1rem;
    }
    
    .books-section {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-card h3 {
        font-size: 1.1rem;
    }
    
    .stat-number {
        font-size: 2rem !important;
    }
    
    /* Users Section Mobile */
    .users-section {
        padding: 20px;
        overflow-x: auto;
    }
    
    .search-container {
        flex-direction: column;
    }
    
    .search-input {
        width: 100%;
    }
    
    .search-btn {
        width: 100%;
        justify-content: center;
    }
    
    .users-table {
        font-size: 0.85rem;
    }
    
    .users-table th,
    .users-table td {
        padding: 10px 8px;
        white-space: nowrap;
    }
    
    .user-avatar {
        width: 35px;
        height: 35px;
    }
    
    /* Books History Mobile */
    .books-history-container {
        padding: 15px;
    }
    
    .history-header {
        padding: 20px;
    }
    
    .history-header h1 {
        font-size: 1.3rem;
        flex-direction: column;
        gap: 10px;
    }
    
    .stats-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .stat-item {
        width: 100%;
        text-align: center;
    }
    
    .filters-section {
        padding: 15px;
    }
    
    .filter-controls {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .books-table-container {
        padding: 15px;
        overflow-x: auto;
    }
    
    .books-history-table {
        font-size: 0.8rem;
        min-width: 800px;
    }
    
    .books-history-table th,
    .books-history-table td {
        padding: 10px 8px;
    }
    
    .book-thumb {
        width: 40px;
        height: 55px;
    }
    
    .book-title-cell {
        max-width: 200px;
    }
    
    /* Table Generic Mobile */
    .table-container {
        padding: 20px 15px;
        overflow-x: auto;
    }
    
    .table-container h2 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    /* Search Form Mobile */
    .table-container form input[type="text"].form-control {
        font-size: 0.85rem;
        padding: 8px;
    }
    
    .table-container form button {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .table-container form > div {
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    table {
        font-size: 0.85rem;
        min-width: 600px;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    .btn-small {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    /* Forms Mobile */
    .form-container {
        padding: 20px;
    }
    
    .form-container h2 {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .auth-box {
        padding: 25px 20px;
    }
    
    /* Activity 5 Mobile */
    .activity-container {
        padding: 15px;
    }
    
    .activity-header {
        padding: 20px;
    }
    
    .activity-header h1 {
        font-size: 1.3rem;
    }
    
    .student-app {
        padding: 20px;
    }
    
    .form-section {
        padding: 20px;
    }
    
    .student-table {
        font-size: 0.8rem;
        min-width: 700px;
    }
    
    .student-table th,
    .student-table td {
        padding: 10px 8px;
    }
    
    .action-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        margin-bottom: 5px;
        display: block;
        width: 100%;
    }
    
    /* Admin Grid Mobile */
    .admin-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .admin-card {
        padding: 20px;
    }
    
    /* Documentation Cards Mobile */
    .documentation-container {
        grid-template-columns: 1fr;
    }
    
    .doc-card {
        padding: 20px;
    }
    
    /* Buttons Mobile */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    /* Reading Page Mobile */
    .reading-container {
        padding: 10px;
    }
    
    .reading-header {
        padding: 12px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .reading-header h2 {
        font-size: 1.1rem;
    }
    
    .reading-area {
        padding: 12px;
        min-height: clamp(320px, 62vh, 560px);
    }
    
    .file-reader {
        padding: 8px;
    }
    
    .pdf-viewer {
        height: clamp(320px, calc(100vh - 230px), 680px);
    }
    
    .reading-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-nav {
        width: 100%;
        justify-content: center;
    }
    
    /* Section Headers Mobile */
    .section-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .section-title {
        font-size: 1.2rem;
    }
    
    /* Main Content Mobile */
    .main-content {
        padding: 15px;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    /* Admin Dashboard Extra Small Mobile */
    .admin-wrapper {
        padding: 6px !important;
    }

    .top-bar {
        padding: 8px 10px !important;
    }

    .admin-circle {
        width: 40px !important;
        height: 40px !important;
    }

    .admin-circle svg {
        width: 22px !important;
        height: 22px !important;
    }

    .admin-title h1 {
        font-size: 0.9rem !important;
    }

    .admin-title p {
        font-size: 0.75rem !important;
    }

    .top-buttons .btn {
        padding: 7px 14px !important;
        font-size: 0.75rem !important;
    }

    .welcome-box {
        padding: 12px !important;
    }

    .welcome-box svg {
        width: 30px !important;
        height: 30px !important;
    }

    .welcome-box h2 {
        font-size: 1rem !important;
    }

    .welcome-box p {
        font-size: 0.8rem !important;
    }

    .cards-row {
        grid-template-columns: 1fr !important;
        gap: 6px !important;
    }

    .card-item {
        padding: 18px 12px !important;
    }

    .card-item svg {
        width: 28px !important;
        height: 28px !important;
    }

    .card-item .big-number {
        font-size: 1.6rem !important;
    }

    .card-item .label-text {
        font-size: 0.8rem !important;
    }

    .admin-users-panel {
        padding: 10px !important;
    }

    .admin-users-title {
        font-size: 0.9rem !important;
    }

    .admin-user-search-input {
        padding: 7px 10px !important;
        font-size: 0.75rem !important;
    }

    .admin-user-search-button {
        padding: 7px 14px !important;
        font-size: 0.75rem !important;
    }

    .admin-users-panel table {
        font-size: 0.7rem !important;
    }

    .admin-users-panel th,
    .admin-users-panel td {
        padding: 6px 4px !important;
        font-size: 0.7rem !important;
    }

    .admin-users-panel .btn-primary {
        padding: 7px 12px !important;
        font-size: 0.75rem !important;
    }

    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .book-cover {
        height: 140px;
    }
    
    .book-info {
        padding: 8px;
    }
    
    .book-title {
        font-size: 0.8rem;
    }
    
    .book-author {
        font-size: 0.7rem;
    }
    
    .books-section {
        grid-template-columns: 1fr;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-brand svg {
        width: 20px;
        height: 20px;
    }
    
    .navbar-menu {
        font-size: 0.8rem;
        gap: 6px 10px;
    }
    
    .welcome-title {
        font-size: 1.3rem;
    }
    
    .welcome-subtitle {
        font-size: 0.85rem;
    }
    
    .btn {
        padding: 10px 25px;
        font-size: 0.9rem;
    }
    
    .welcome-text h2 {
        font-size: 1.2rem;
    }
    
    .stat-number {
        font-size: 1.5rem !important;
    }
    
    .admin-card svg {
        width: 40px;
        height: 40px;
    }
    
    .admin-card h3 {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 1.1rem;
    }
    
    .book-details {
        padding: 15px;
        margin: 15px auto;
    }
    
    .book-meta h1 {
        font-size: 1.3rem;
    }
    
    .book-meta .author {
        font-size: 1rem;
    }
    
    .auth-box {
        padding: 20px 15px;
    }
    
    .auth-box h2 {
        font-size: 1.2rem;
    }
    
    .form-control {
        font-size: 0.9rem;
        padding: 9px;
    }
    
    .btn-full {
        font-size: 0.9rem;
        padding: 9px;
    }
    
    .main-content {
        padding: 12px;
    }
    
    .logo {
        width: 70px;
        height: 70px;
    }
    
    .logo svg {
        width: 45px;
        height: 45px;
    }
    
    .dropdown-item {
        font-size: 1rem;
        padding: 12px 18px;
    }
    
    .table-container {
        padding: 15px 10px;
    }
    
    .table-container h2 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    /* Search Form Small Mobile */
    .table-container form input[type="text"].form-control {
        font-size: 0.8rem;
        padding: 7px;
    }
    
    .table-container form button {
        padding: 7px 10px;
        font-size: 0.8rem;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 8px 6px;
    }
    
    .btn-small {
        padding: 5px 10px;
        font-size: 0.75rem;
    }
    
    .form-container {
        padding: 15px;
    }
    
    .form-container h2 {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }
    
    .form-container h3 {
        font-size: 0.9rem;
    }
}

/* Loading Spinner */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid var(--primary-gold);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    fill: rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.empty-state p {
    color: rgba(255, 255, 255, 0.8);
}

/* Documentation Section Styles */
.documentation-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.doc-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

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

.doc-card.full-width {
    grid-column: 1 / -1;
}

.doc-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.doc-header h3 {
    color: var(--dark-purple);
    font-size: 1.2rem;
    margin: 0;
}

.doc-card p {
    color: #6B7280;
    line-height: 1.6;
    margin-bottom: 15px;
}

.doc-image-container {
    margin-top: 20px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.doc-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.doc-image:hover {
    transform: scale(1.02);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Large Screens */
@media (min-width: 1400px) {
    .main-content {
        max-width: 1400px;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 18px;
    }
    
    .book-cover {
        height: 240px;
    }
    
    .book-details {
        max-width: 1200px;
    }
    
    .book-details-content {
        grid-template-columns: 350px 1fr;
        gap: 50px;
    }
}

/* Documentation Responsive */
@media (max-width: 768px) {
    .documentation-container {
        grid-template-columns: 1fr;
    }
    
    .doc-card.full-width {
        grid-column: 1;
    }
    
    .doc-card {
        padding: 20px;
    }
    
    .doc-header h3 {
        font-size: 1.1rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .action-buttons,
    .btn,
    .search-bar {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .book-details,
    .reading-area {
        box-shadow: none;
        padding: 0;
    }
}
