/* ========================================
   Book Share Web - Modern CSS Styles
   ======================================== */

:root {
    /* Color Palette */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-gradient: linear-gradient(135deg, #0c0c0c 0%, #1a1a2e 100%);

    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-glass: rgba(255, 255, 255, 0.05);

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);

    --border-glass: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(102, 126, 234, 0.5);

    --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.2);

    --price-green: #00d68f;
    --price-gradient: linear-gradient(135deg, #00d68f 0%, #00b887 100%);

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated Background */
.bg-gradient {
    position: fixed;
    inset: 0;
    background: var(--dark-gradient);
    z-index: -2;
}

.bg-pattern {
    position: fixed;
    inset: 0;
    z-index: -1;
    opacity: 0.4;
    background-image:
        radial-gradient(ellipse 80% 50% at 20% -20%, rgba(102, 126, 234, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(118, 75, 162, 0.3) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-20px) scale(1.02);
    }
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* Glass Card Effect */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

/* ========================================
   Loading State
   ======================================== */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.loader {
    text-align: center;
}

.book-loader {
    width: 80px;
    height: 60px;
    margin: 0 auto 24px;
    position: relative;
    perspective: 300px;
}

.book-page {
    position: absolute;
    width: 40px;
    height: 60px;
    background: var(--primary-gradient);
    border-radius: 0 4px 4px 0;
    transform-origin: left center;
    animation: pageFlip 1.5s ease-in-out infinite;
}

.book-page:nth-child(1) {
    animation-delay: 0s;
}

.book-page:nth-child(2) {
    animation-delay: 0.3s;
}

.book-page:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes pageFlip {

    0%,
    100% {
        transform: rotateY(0deg);
        opacity: 1;
    }

    50% {
        transform: rotateY(-180deg);
        opacity: 0.5;
    }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
}

/* ========================================
   Error State
   ======================================== */
.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.error-card {
    text-align: center;
    padding: 48px 32px;
    max-width: 400px;
}

.error-icon {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.error-card h2 {
    font-size: 24px;
    margin-bottom: 12px;
}

.error-card p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* ========================================
   Header
   ======================================== */
.share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 16px 0;
}

.app-branding {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-branding span {
    font-weight: 600;
    font-size: 18px;
}

.download-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all var(--transition-medium);
}

.download-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-accent);
    transform: translateY(-2px);
}

/* ========================================
   Book Card
   ======================================== */
.book-card {
    padding: 32px;
    margin-bottom: 24px;
    animation: fadeSlideUp 0.6s ease-out;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.book-cover-section {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.book-cover-wrapper {
    position: relative;
    max-width: 280px;
}

.book-cover {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft), var(--shadow-glow);
    transition: transform var(--transition-medium);
}

.book-cover:hover {
    transform: scale(1.02) translateY(-5px);
}

.book-cover-shadow {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 85%;
    height: 20px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.4) 0%, transparent 70%);
    filter: blur(10px);
}

/* Book Info Section */
.book-info-section {
    text-align: center;
}

.book-badges {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.badge {
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-format {
    background: var(--accent-gradient);
    color: #0a0a0f;
}

.badge-condition {
    background: var(--price-gradient);
    color: #0a0a0f;
}

.book-title {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Meta Items */
.book-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.meta-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 15px;
}

.meta-item svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Price Section */
.price-section {
    background: linear-gradient(135deg, rgba(0, 214, 143, 0.1) 0%, rgba(0, 184, 135, 0.1) 100%);
    border: 1px solid rgba(0, 214, 143, 0.2);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 16px;
}

.price-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.price-range {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.price-low,
.price-high {
    font-size: 32px;
    font-weight: 700;
    color: var(--price-green);
}

.price-separator {
    font-size: 24px;
    color: var(--text-muted);
}

.price-average {
    font-size: 14px;
    color: var(--text-secondary);
}

.avg-value {
    font-weight: 600;
    color: var(--price-green);
    margin-left: 4px;
}

/* ISBN Section */
.isbn-section {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.isbn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.isbn-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.isbn-value {
    font-size: 14px;
    font-family: 'SF Mono', 'Monaco', monospace;
    color: var(--text-secondary);
}

/* Description Section */
.description-section {
    text-align: left;
    display: none;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    margin-bottom: 24px;
}

.description-section.has-content {
    display: block;
}

.description-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.description-section p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Extended Info Container (inside book card) */

.book-extended-info {
    grid-column: 1 / -1;
    width: 100%;
    padding-top: 0;
    margin-top: 0;
    border-top: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.book-extended-info .book-details-section {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 0;
}

.book-extended-info .description-section {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 0;
}

.book-extended-info .historical-value-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 0;
}

/* ========================================
   Share Actions
   ======================================== */
.share-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    animation: fadeSlideUp 0.6s ease-out 0.2s both;
}

.btn-share {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-medium);
}

.btn-share:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-share:active {
    transform: translateY(0);
}

/* Primary Button */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-medium);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

/* ========================================
   Owner Section
   ======================================== */
.owner-section {
    text-align: center;
    padding: 20px;
    margin-bottom: 32px;
    animation: fadeSlideUp 0.6s ease-out 0.3s both;
}

.owner-section p {
    font-size: 14px;
    color: var(--text-secondary);
}

.owner-section strong {
    color: var(--text-primary);
}

/* ========================================
   Footer
   ======================================== */
.share-footer {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-glass);
    animation: fadeSlideUp 0.6s ease-out 0.4s both;
}

.share-footer p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.footer-links a {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--text-primary);
}

/* ========================================
   Toast Notification
   ======================================== */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: var(--price-green);
    color: #0a0a0f;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 214, 143, 0.3);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ========================================
   Utility Classes
   ======================================== */
.hidden {
    display: none !important;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 600px) {
    .container {
        padding: 16px;
    }

    .book-card {
        padding: 24px 20px;
    }

    .book-title {
        font-size: 22px;
    }

    .price-low,
    .price-high {
        font-size: 26px;
    }

    .share-actions {
        flex-direction: column;
    }

    .btn-share {
        width: 100%;
        justify-content: center;
    }

    .isbn-section {
        flex-direction: column;
        gap: 16px;
    }

    .share-header {
        flex-direction: column;
        gap: 16px;
    }
}

@media (min-width: 768px) {
    .book-card {
        display: grid;
        grid-template-columns: 280px 1fr;
        gap: 40px;
        text-align: left;
    }

    .book-cover-section {
        margin-bottom: 0;
    }

    .book-info-section {
        text-align: left;
    }

    .book-badges {
        justify-content: flex-start;
    }

    .book-meta {
        align-items: flex-start;
    }

    .meta-item {
        justify-content: flex-start;
    }

    .price-section {
        text-align: left;
    }

    .price-range {
        justify-content: flex-start;
    }

    .isbn-section {
        justify-content: flex-start;
    }
}

/* ========================================
   Collection Page Styles
   ======================================== */
.collection-header {
    margin-bottom: 32px;
}

.collection-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.collection-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 150px;
}

.filter-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: border-color var(--transition-fast);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0a0a0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.filter-select option {
    background: #1a1a2e;
    color: #ffffff;
    padding: 10px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--border-accent);
}

.search-input {
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    flex: 2;
    min-width: 200px;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--border-accent);
}

/* Books Grid - Horizontal List Layout */
.books-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.book-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-medium);
    text-decoration: none;
    color: inherit;
}

.book-item:hover {
    transform: translateX(5px);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
}

.book-item-cover {
    width: 120px;
    height: 180px;
    min-width: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.book-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.book-item-title {
    font-size: 20px;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-item-author {
    font-size: 16px;
    color: var(--text-secondary);
}

.book-item-price {
    font-size: 22px;
    font-weight: 700;
    color: var(--price-green);
    margin-top: 4px;
}

/* Stats Section */
.collection-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    flex: 1;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.page-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.page-btn:hover {
    border-color: var(--border-accent);
}

.page-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
}

@media (max-width: 600px) {
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .collection-stats {
        flex-direction: column;
    }

    .filter-bar {
        flex-direction: column;
    }
}

/* ========================================
   Book Details Section (New)
   ======================================== */
.book-details-section {
    text-align: left;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
}

.book-details-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 14px;
    color: var(--text-secondary);
}

@media (max-width: 600px) {
    .details-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Historical Value Section (New)
   ======================================== */
.historical-value-section {
    text-align: left;
    display: none;
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--radius-md);
}

.historical-value-section.has-content {
    display: block;
}

.historical-value-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--text-primary);
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.historical-value-section p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}