/* Utility & Component Styles */
.lucide {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    vertical-align: middle;
}

.lucide-spin {
    animation: spin 2s linear infinite;
}

.btn .lucide {
    width: 22px;
    height: 22px;
}

.nav-icon .lucide {
    width: 24px;
    height: 24px;
}


/* Forms and Inputs */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 16px 18px;
    font-size: 16px;
    font-family: inherit;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--surface-color);
    transition: all 0.3s ease;
    color: var(--text-primary);
    height: 56px;
    min-height: 56px;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
}

.input-group input[type="date"] {
    display: block;
    line-height: normal;
}

.input-group select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 48px;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(14, 116, 144, 0.1);
}

.search-container {
    background: var(--surface-color);
    padding: 8px 18px;
    border-radius: 30px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    transition: box-shadow 0.3s ease;
}

.search-container:focus-within {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.search-input {
    width: 100%;
    border: none;
    padding: 12px 0;
    font-size: 16px;
    font-family: inherit;
    background: transparent;
    color: var(--text-primary);
    -webkit-appearance: none;
    appearance: none;
}

.search-input:focus {
    outline: none;
}

/* Custom Dropdown */
.custom-dropdown {
    position: relative;
    user-select: none;
    flex-shrink: 0;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary-color);
    background: transparent;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s ease;
}

.dropdown-trigger:hover {
    background: rgba(8, 51, 68, 0.05);
}

.dropdown-trigger svg, 
.dropdown-trigger i {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
    stroke-width: 3;
}

.custom-dropdown.active .dropdown-trigger svg {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: -10px;
    width: 180px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(8, 51, 68, 0.15);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-dropdown.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.dropdown-option {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-option:hover {
    background: rgba(8, 51, 68, 0.06);
    color: var(--primary-color);
    transform: translateX(4px);
}

.dropdown-option.selected {
    background: var(--primary-color);
    color: white;
}

.dropdown-option i, 
.dropdown-option svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

.search-divider {
    width: 1.5px;
    height: 24px;
    background: var(--border-color);
    margin: 0 12px;
    flex-shrink: 0;
}

/* Buttons */
.btn {
    padding: 14px 24px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    /* iOS friendly button behavior */
    -webkit-appearance: none;
    appearance: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: 0 4px 12px rgba(8, 51, 68, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(8, 51, 68, 0.3);
}

.btn-primary:active {
    transform: translateY(1px) scale(0.98);
}

.btn-danger {
    background-color: #fff1f2;
    color: var(--danger-color);
    border: 1px solid #fecdd3;
}

.btn-back {
    background: var(--surface-color);
    color: var(--text-primary);
    padding: 8px 16px;
    font-size: 14px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.w-100 {
    width: 100%;
}

.btn-google {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(8, 51, 68, 0.2);
    padding: 14px 24px;
    font-size: 15px;
    letter-spacing: 0.25px;
}

.btn-google:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(8, 51, 68, 0.3);
}

.btn-google:active {
    transform: translateY(1px) scale(0.98);
}

.btn-google img {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px;
    min-height: 24px;
    flex-shrink: 0;
    margin-right: 8px;
    object-fit: contain;
    background: white;
    padding: 4px;
    border-radius: 50%;
}

.btn-google span {
    font-weight: 700;
}

@media (max-width: 480px) {
    .btn-google {
        padding: 14px 12px;
        font-size: 13px;
    }

    .login-box {
        padding: 32px 20px !important;
    }
}

/* Book Lists & Cards */
.book-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.book-card {
    background-color: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    min-width: 0;
    /* iOS friendly behavior */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.book-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    pointer-events: none;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(8, 51, 68, 0.08);
    border-color: var(--primary-light);
}

.book-card:active {
    transform: scale(0.96);
    background-color: #f8fafc;
    border-color: var(--primary-color);
}

/* Request Cards (Admin Dashboard) */
.req-card {
    flex-direction: column;
    gap: 12px;
    height: 100%;
}

.req-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 12px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.book-img-placeholder {
    width: 85px;
    height: 120px;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.book-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.book-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 4px;
    color: var(--text-primary);
    line-height: 1.2;
    height: 2.4em;
    /* Exactly 2 lines */
    letter-spacing: -0.3px;
    /* Truncate long titles */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-author {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
}

.status-badge {
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-available {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #dcfce7;
}

.status-available::before {
    background-color: #22c55e;
}

.status-borrowed {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fee2e2;
}

.status-borrowed::before {
    background-color: #ef4444;
}

.status-pending {
    background-color: #fffbeb;
    color: #92400e;
    border: 1px solid #fef3c7;
}

.status-pending::before {
    background-color: #f59e0b;
}

.status-returned {
    background-color: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.status-returned::before {
    background-color: #94a3b8;
}

.card-action-hint {
    font-size: 11px;
    font-weight: 800;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.book-card:hover .card-action-hint {
    opacity: 1;
    transform: translateX(0);
}

@media (max-width: 960px) {
    .card-action-hint {
        display: none;
    }
}


/* Book Detail View elements */
.detail-img-container {
    width: 100%;
    height: 320px;
    background: linear-gradient(135deg, #fff, #f1f5f9);
    border-radius: var(--radius-lg);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 100px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.detail-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -1px;
}

.detail-author {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-author::before {
    content: "By";
    font-weight: 400;
    font-size: 14px;
    color: var(--text-muted);
}

.detail-desc {
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 36px;
    color: var(--text-secondary);
}

/* Modals Refined */
.modal-overlay {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(8, 51, 68, 0.4);
}

.modal-content {
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
}

/* Genre Selection Grid */
.genre-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 40px;
    padding: 4px;
    width: 100%;
    box-sizing: border-box;
}

.genre-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    min-width: 0;
    overflow: hidden;
    /* iOS friendly behavior */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.genre-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.genre-card:active {
    transform: scale(0.95);
}

.genre-icon {
    width: 48px;
    height: 48px;
    background: rgba(14, 116, 144, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.genre-icon .lucide {
    width: 24px;
    height: 24px;
}

.genre-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    line-height: 1.3;
}

/* Pagination & Load More */
.btn-load-more {
    background: white;
    color: var(--primary-color);
    border: 1.5px solid var(--primary-light);
    box-shadow: var(--shadow-sm);
    padding: 16px;
}

.btn-load-more:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(14, 116, 144, 0.2);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Filter Chips */
.filter-chip {
    padding: 8px 20px;
    background: white;
    border: 1.5px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.filter-chip:hover {
    background: #f8fafc;
    border-color: var(--primary-light);
    color: var(--primary-color);
}

.filter-chip.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(8, 51, 68, 0.2);
}

/* PWA Installation Modal Specifics */
#pwa-install-modal .modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    padding: 40px 24px 32px 24px;
}

.ios-install-guide {
    margin: 20px 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ios-install-guide ol li {
    line-height: 1.4;
}

#pwa-install-btn {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

#pwa-install-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 20px rgba(8, 51, 68, 0.2);
}

@keyframes pulse-icon {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

#pwa-install-modal img {
    animation: pulse-icon 3s ease-in-out infinite;
}

/* Badge Styles */
.nav-badge {
    position: absolute;
    top: -4px;
    right: 12px;
    background: #e11d48; /* Red-600 */
    color: white;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
    pointer-events: none;
}

.chip-badge {
    background: rgba(255, 255, 255, 0.2);
    color: currentColor;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sub-nav-chip.active .chip-badge {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}