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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 40% 20%, rgba(255, 119, 198, 0.2) 0%, transparent 50%);
    z-index: -1;
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-20px, -20px) rotate(120deg); }
    66% { transform: translate(20px, -10px) rotate(240deg); }
}

.container {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
}

/* Header */
.header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(236, 72, 153, 0.1) 100%);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.tagline {
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
}

/* API Status */
.api-status {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    z-index: 101;
    display: none;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-around;
    padding: 8px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 20px;
}

.nav-item {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 16px;
}

.nav-item.active {
    color: white;
    transform: scale(1.05);
}

.nav-item.active::before {
    opacity: 1;
}

.nav-icon {
    width: 24px;
    height: 24px;
    position: relative;
    z-index: 1;
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

/* Content */
.content {
    padding: 20px;
    padding-bottom: 100px;
}

.section {
    display: none;
    animation: fadeIn 0.5s ease;
}

.section.active {
    display: block;
}

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

/* Cards */
.card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--gradient);
    border-radius: 20px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    background: rgba(30, 41, 59, 0.8);
}

.card:hover::before {
    opacity: 0.5;
}

/* Map View */
.map-container {
    height: 350px; 
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

#leafletMap {
    width: 100% !important;
    height: 100% !important;
    border-radius: 20px;
}

.map-placeholder {
    text-align: center;
    color: var(--text-dim);
}

.location-name {
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
    margin-bottom: 8px;
}

.location-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.badge {
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-free {
    background: rgba(236, 72, 153, 0.2);
    color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.badge-available {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-borrowed {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-user {
    background: rgba(99, 102, 241, 0.3);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.badge-category {
    background: rgba(236, 72, 153, 0.2);
    color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.3);
}

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

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

.input {
    width: 100%;
    padding: 16px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text);
    font-size: 16px;
    transition: all 0.3s ease;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.8);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input::placeholder {
    color: var(--text-dim);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: var(--text);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-scan {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-scan:hover {
    box-shadow: 0 12px 24px rgba(16, 185, 129, 0.3);
}

.btn-return {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 8px 16px;
    font-size: 12px;
    width: auto;
    margin-left: 16px;
}

.btn-return:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Book Cards */
.book-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    display: flex;
    gap: 16px;
    align-items: center;
    position: relative;
}

.book-card.available {
    border-color: rgba(16, 185, 129, 0.3);
}

.book-card.borrowed {
    border-color: rgba(239, 68, 68, 0.3);
    opacity: 0.8;
}

.book-card.clickable {
    cursor: pointer;
}

.book-card.clickable:hover {
    transform: translateY(-2px);
    background: rgba(30, 41, 59, 0.8);
}

.book-cover {
    width: 60px;
    height: 80px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3) 0%, rgba(236, 72, 153, 0.3) 100%);
    border-radius: 8px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.book-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.book-status-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    z-index: 2;
}

.book-status-indicator.available {
    background: #10b981;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    animation: pulse-green 2s infinite;
}

.book-status-indicator.borrowed {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

@keyframes pulse-green {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.book-info {
    flex: 1;
}

.book-title {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 4px;
    line-height: 1.3;
}

.book-author {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 8px;
}

.book-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.borrowed-info {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
    font-style: italic;
}

/* Profile Styles */
.profile-header {
    text-align: center;
    margin-bottom: 24px;
}

.avatar {
    width: 80px;
    height: 80px;
    background: var(--gradient);
    border-radius: 50%;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-dim);
}

.borrowed-book-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.borrowed-book-card .book-info {
    flex: 1;
}

.borrowed-book-card .book-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.borrowed-book-card .book-author {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 4px;
}

.borrowed-book-card .book-location {
    color: var(--text-dim);
    font-size: 12px;
    margin-bottom: 4px;
}

.borrowed-book-card .book-category {
    color: var(--text-dim);
    font-size: 12px;
    margin-bottom: 4px;
}

.borrowed-book-card .borrow-date {
    color: var(--text-dim);
    font-size: 12px;
}

/* Share Section */
.share-info-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.share-guidelines {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    margin-top: 20px;
}

.share-guidelines ul {
    margin: 8px 0;
}

.share-guidelines li {
    margin: 4px 0;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
    font-weight: 600;
    z-index: 1000;
    transition: transform 0.3s ease;
    max-width: 90%;
    text-align: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* Search Bar */
.search-container {
    position: relative;
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    color: var(--text);
    font-size: 16px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
}

/* SVG Icons */
.icon-map, .icon-book, .icon-plus, .icon-user, .icon-camera {
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
}

.modal-content {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 32px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

/* Cover Upload Styles */
.cover-upload-container {
    position: relative;
}

.cover-preview {
    width: 120px;
    height: 160px;
    background: rgba(30, 41, 59, 0.6);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-dim);
}

.cover-preview:hover {
    border-color: var(--primary);
    background: rgba(30, 41, 59, 0.8);
    color: var(--text);
}

.cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.cover-preview.has-image {
    border-style: solid;
    padding: 0;
}

.cover-preview.has-image svg,
.cover-preview.has-image span {
    display: none;
}

.location-card {
    position: relative;
    padding-right: 40px;
}

.location-action-hint {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.location-card:hover .location-action-hint {
    opacity: 1;
    transform: translateY(-50%) translateX(2px);
}

.location-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.location-actions .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#locationBooksList {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 8px;
}

#locationBooksList::-webkit-scrollbar {
    width: 6px;
}

#locationBooksList::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

#locationBooksList::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

#locationBooksList::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
/* Category Filter Styles */
.category-filter {
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-filter::-webkit-scrollbar {
    display: none;
}

.category-scroll {
    display: flex;
    gap: 8px;
    padding: 4px 0;
    min-width: max-content;
}

.category-chip {
    padding: 8px 16px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.category-chip:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text);
    transform: translateY(-1px);
}

.category-chip.active {
    background: var(--gradient);
    border-color: transparent;
    color: white;
    transform: scale(1.05);
}

.category-icon {
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 375px) {
    .container {
        max-width: 100%;
    }
    
    .header {
        padding: 16px;
    }
    
    .content {
        padding: 16px;
        padding-bottom: 100px;
    }
    
    .logo {
        font-size: 28px;
    }
    
    .book-card {
        padding: 12px;
    }
    
    .book-cover {
        width: 50px;
        height: 70px;
    }
    
    .category-chip {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .category-icon {
        font-size: 14px;
    }
}

/* Additional Utility Classes */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 8px;
}

.mt-4 {
    margin-top: 16px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-4 {
    margin-bottom: 16px;
}

/* Barcode Scanner Styles */
#barcodeScannerModal .modal-content {
    background: var(--bg);
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.scanner-overlay::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #ff0000;
    transform: translateY(-50%);
    opacity: 0.5;
}

.scanner-line {
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #00ff00;
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { top: 0; }
    100% { top: 100%; }
}

.scanner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawingBuffer {
    position: absolute;
    top: 0;
    left: 0;
}

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

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}