/* ========================================================
   ShelfScanner DESIGN SYSTEM & MAIN STYLESHEET
   ======================================================== */

/* Variables & Color Palette - Default: Dark Theme */
:root {
    --bg-color: #0b0c10;
    --card-bg: rgba(26, 28, 36, 0.75);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(125, 95, 255, 0.4);
    
    /* Neon accents */
    --accent-primary: #7d5fff;    /* Electric purple */
    --accent-secondary: #ff7675;  /* Warm Coral */
    --accent-glow: rgba(125, 95, 255, 0.25);
    
    /* Text colors */
    --text-primary: #f5f6fa;
    --text-secondary: #a0a5b5;
    --text-muted: #6b6f7d;
    
    /* Portal specific layouts */
    --sidebar-bg: rgba(18, 19, 26, 0.85);
    --header-bg: rgba(11, 12, 16, 0.7);

    /* Utilities */
    --transition-speed: 0.3s;
    --radius-lg: 16px;
    --radius-md: 10px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* Color Palette - Light Theme */
body.light-theme {
    --bg-color: #f5f6fa;
    --card-bg: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(108, 92, 231, 0.5);
    
    /* Warm/Soft light accents */
    --accent-primary: #6c5ce7;
    --accent-secondary: #ff7675;
    --accent-glow: rgba(108, 92, 231, 0.2);
    
    /* Text colors */
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-muted: #b2bec3;
    
    /* Portal specific layouts */
    --sidebar-bg: rgba(255, 255, 255, 0.9);
    --header-bg: rgba(255, 255, 255, 0.85);
}

/* Base resets & layouts */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Background details */
.glass-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    background: radial-gradient(circle at 10% 20%, rgba(125, 95, 255, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(255, 118, 117, 0.08) 0%, transparent 45%);
}

body.light-theme .glass-bg {
    background: radial-gradient(circle at 10% 20%, rgba(108, 92, 231, 0.04) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(255, 118, 117, 0.04) 0%, transparent 45%);
}

/* Typography */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Top Navigation Header */
header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    height: 70px;
    display: flex;
    align-items: center;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.header-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-hamburger {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: background var(--transition-speed);
}

.btn-hamburger:hover {
    background: rgba(125, 95, 255, 0.08);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 800;
    font-family: var(--font-heading);
    letter-spacing: 0.03em;
}

.logo-icon {
    color: var(--accent-primary);
    filter: drop-shadow(0 0 8px var(--accent-primary));
    font-size: 1.75rem;
}

.highlight {
    color: var(--accent-secondary);
}

/* Buttons */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-muted);
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    background: #6a4fe6;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(125, 95, 255, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

body.light-theme .btn-secondary {
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

body.light-theme .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-primary), #8c7ae6);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(125, 95, 255, 0.5);
}

.btn-capture {
    background: var(--accent-secondary);
    color: white;
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(255, 118, 117, 0.3);
}

.btn-capture:hover {
    background: #e15f5f;
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 118, 117, 0.45);
}

.btn-donate {
    background: rgba(255, 118, 117, 0.08);
    border: 1px solid rgba(255, 118, 117, 0.2);
    color: var(--accent-secondary);
}

.btn-donate:hover {
    background: var(--accent-secondary);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 118, 117, 0.25);
}

.btn-theme {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.65rem 0.85rem;
}

.btn-theme:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-contact {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-contact:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-full-width {
    width: 100%;
    justify-content: center;
}

.btn-lg {
    padding: 0.88rem 2.25rem;
    font-size: 1.05rem;
    border-radius: var(--radius-md);
}

/* Card System */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed), background var(--transition-speed);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

body.light-theme .card:hover {
    border-color: rgba(0, 0, 0, 0.12);
}

/* Sidebar Dashboard Layout */
.portal-container {
    display: flex;
    flex: 1;
    position: relative;
    height: calc(100vh - 70px);
}

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform var(--transition-speed), background var(--transition-speed), border-color var(--transition-speed);
    z-index: 90;
    flex-shrink: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1.15rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all var(--transition-speed);
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

body.light-theme .nav-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

.nav-item.active {
    color: var(--accent-primary);
    background: rgba(125, 95, 255, 0.08);
}

body.light-theme .nav-item.active {
    background: rgba(108, 92, 231, 0.08);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
}

.main-content {
    flex: 1;
    padding: 2.5rem 2rem;
    overflow-y: auto;
    background: transparent;
}

/* Mobile Sidebar Drawer Toggles */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 70px;
        left: 0;
        height: calc(100vh - 70px);
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .btn-hamburger {
        display: flex;
    }
    
    .main-content {
        padding: 1.5rem 1rem;
    }
}

/* Page Views system */
.page-view {
    display: none;
    animation: fadeIn 0.4s ease;
}

.page-view.active {
    display: block;
}

/* ========================================================
   PAGE 1: Home Landing Page Styles
   ======================================================== */

.hero-section {
    text-align: center;
    padding: 4.5rem 1rem 3.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-theme .hero-title {
    background: linear-gradient(135deg, #1e272e 40%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.35rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 500;
}

/* Promo Card CTA container */
.promo-card {
    max-width: 800px;
    margin: 0 auto 4rem;
    padding: 1.75rem 2rem;
    display: flex;
    align-items: center;
    gap: 1.75rem;
    cursor: pointer;
    transition: transform var(--transition-speed), border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.promo-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-hover);
    box-shadow: 0 10px 30px rgba(125, 95, 255, 0.12);
}

.promo-icon-wrapper {
    width: 60px;
    height: 60px;
    background: rgba(125, 95, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.promo-icon {
    font-size: 1.75rem;
    color: var(--accent-primary);
}

.promo-content h3 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.promo-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.promo-link {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent-primary);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* How It Works Steps section */
.how-it-works-section {
    max-width: 1000px;
    margin: 0 auto 5rem;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2.5rem;
    font-weight: 700;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .steps-grid {
        grid-template-columns: 1fr;
    }
}

.step-card {
    padding: 2.25rem 1.75rem;
    text-align: center;
    position: relative;
    border-color: var(--border-color);
}

.step-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

body.light-theme .step-card:hover {
    border-color: rgba(0, 0, 0, 0.12);
}

.step-num {
    width: 38px;
    height: 38px;
    background: rgba(125, 95, 255, 0.1);
    border: 1px solid rgba(125, 95, 255, 0.2);
    color: var(--accent-primary);
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    font-size: 1.05rem;
}

.step-card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.6rem;
    font-weight: 700;
}

.step-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Call to Action Bottom Box */
.cta-bottom {
    text-align: center;
    padding: 3.5rem 2rem;
    max-width: 800px;
    margin: 0 auto 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.cta-bottom-icon {
    width: 55px;
    height: 55px;
    background: rgba(255, 118, 117, 0.1);
    color: var(--accent-secondary);
    font-size: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.cta-bottom h2 {
    font-size: 1.75rem;
    font-weight: 700;
}

.cta-bottom p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 520px;
    line-height: 1.55;
    margin-bottom: 0.75rem;
}

/* ========================================================
   PAGE 2: Book Scanner Workspace Layout
   ======================================================== */

.workspace-grid {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }
}

.scanner-section {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: fit-content;
}

.card-header h2 {
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Tab Navigation */
.tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 0.25rem;
}

body.light-theme .tabs {
    background: rgba(0, 0, 0, 0.04);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.6rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: calc(var(--radius-md) - 2px);
    transition: all var(--transition-speed) ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--card-bg);
    color: var(--accent-primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* Tab Contents */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn var(--transition-speed) ease;
}

/* Drag & Drop Zone */
.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    padding: 3rem 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: border-color var(--transition-speed), background var(--transition-speed);
    background: rgba(0, 0, 0, 0.1);
}

body.light-theme .drop-zone {
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.01);
}

.drop-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(125, 95, 255, 0.05);
}

.drop-icon {
    font-size: 3rem;
    color: var(--accent-primary);
    margin-bottom: 1rem;
    opacity: 0.8;
}

.drop-text {
    font-weight: 500;
    font-size: 1.05rem;
}

.or-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0.75rem 0;
}

.file-limits {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 1rem;
}

/* Preferences Input Box */
.preferences-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.preferences-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.preferences-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-speed);
}

body.light-theme .preferences-group input {
    background: rgba(0, 0, 0, 0.02);
}

.preferences-group input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(125, 95, 255, 0.15);
}

/* Camera Layout */
.camera-container {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: black;
    border: 1px solid var(--border-color);
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.5);
}

.scan-frame {
    width: 70%;
    height: 80%;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-md);
    position: relative;
}

.scan-frame::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, transparent, var(--accent-secondary), transparent);
    box-shadow: 0 0 10px var(--accent-secondary);
    animation: scannerLine 3s infinite ease-in-out;
}

.camera-controls {
    position: absolute;
    bottom: 1.25rem;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
}

/* Preview Zone */
.preview-zone {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn var(--transition-speed) ease;
}

.preview-zone img {
    width: 100%;
    max-height: 350px;
    object-fit: contain;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.preview-actions {
    display: flex;
    gap: 1rem;
}

.preview-actions button {
    flex: 1;
    justify-content: center;
}

/* Results Display Panels */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 500px;
}

.placeholder-view, .loading-view {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 3rem 2rem;
}

.placeholder-content {
    max-width: 400px;
}

.placeholder-content h3 {
    margin-top: 1.5rem;
    font-size: 1.25rem;
}

.placeholder-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    line-height: 1.5;
}

.scanner-animation {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto;
    border: 2px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
}

body.light-theme .scanner-animation {
    border-color: rgba(0, 0, 0, 0.05);
}

.placeholder-book {
    font-size: 2.5rem;
    color: var(--text-muted);
}

.scanner-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
    top: 50%;
    animation: verticalScan 2s infinite ease-in-out;
}

.loading-view {
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(125, 95, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    animation: spin 1s infinite linear;
    margin: 0 auto 1.5rem;
    box-shadow: 0 0 15px rgba(125, 95, 255, 0.2);
}

.pulse-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--accent-primary);
    animation: pulse 1.5s infinite ease-in-out;
}

.results-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: slideUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.scanned-book-card {
    padding: 2.25rem;
}

.book-card-layout {
    display: flex;
    gap: 2.5rem;
    align-items: center;
}

@media (max-width: 600px) {
    .book-card-layout {
        flex-direction: column;
        text-align: center;
    }
}

.dynamic-cover-wrapper {
    perspective: 1000px;
    padding: 10px;
    flex-shrink: 0;
}

/* 3D Visual Book Pile */
.shelf-books-pile {
    width: 150px;
    height: 180px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateY(-12deg) rotateX(12deg);
    transition: transform var(--transition-speed);
}

.shelf-books-pile:hover {
    transform: rotateY(0deg) rotateX(0deg) scale(1.03);
}

.css-book-pile-item {
    position: absolute;
    width: 140px;
    height: 32px;
    border-radius: 4px;
    border-left: 12px solid;
    box-shadow: 5px 8px 15px rgba(0, 0, 0, 0.45);
    transform-origin: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.css-book-pile-item::after {
    content: '';
    position: absolute;
    right: 5px;
    top: 5px;
    width: 20px;
    height: calc(100% - 10px);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}

.book-1 {
    background: linear-gradient(90deg, #4b2cb3 0%, #351c8c 100%);
    border-left-color: var(--accent-secondary);
    bottom: 0;
    left: 0;
    transform: rotateZ(-3deg);
}

.book-2 {
    background: linear-gradient(90deg, #ff7675 0%, #e15f5f 100%);
    border-left-color: #f1c40f;
    bottom: 22px;
    left: 8px;
    transform: rotateZ(2deg);
}

.book-3 {
    background: linear-gradient(90deg, #2ecc71 0%, #27ae60 100%);
    border-left-color: #3498db;
    bottom: 44px;
    left: 4px;
    transform: rotateZ(-1deg);
}

/* Results text details */
.book-info-wrapper {
    flex: 1;
}

.badge {
    background: rgba(125, 95, 255, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(125, 95, 255, 0.25);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 0.75rem;
}

.book-title {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.book-summary {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Detected Shelf Books */
.detected-books-section {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.detected-books-section h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detected-books-section h3 i {
    color: var(--accent-primary);
}

.detected-books-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem 1.5rem;
    padding-left: 0;
}

@media (max-width: 600px) {
    .detected-books-list {
        grid-template-columns: 1fr;
    }
}

.detected-books-list li {
    font-size: 0.9rem;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.4rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detected-books-list li::before {
    content: "\f02d";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 0;
    top: 2px;
    color: var(--accent-primary);
    font-size: 0.8rem;
}

/* 3D CSS Book Object Design */
.css-book {
    width: 120px;
    height: 170px;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateY(-15deg) rotateX(5deg);
    transition: transform 0.5s ease;
    box-shadow: 8px 8px 20px rgba(0, 0, 0, 0.45);
}

.css-book:hover {
    transform: rotateY(0deg) rotateX(0deg) scale(1.05);
    box-shadow: 0 10px 25px rgba(125, 95, 255, 0.2);
}

.book-spine {
    position: absolute;
    width: 16px;
    height: 100%;
    background: #5d46cc;
    left: 0;
    transform: rotateY(-90deg);
    transform-origin: left center;
    border-radius: 2px 0 0 2px;
}

.book-cover {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--accent-primary) 0%, #4a2cb3 100%);
    border-radius: 0 4px 4px 0;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    border-left: 2px solid rgba(0, 0, 0, 0.2);
}

.cover-design {
    border: 1px solid rgba(255, 255, 255, 0.15);
    height: 100%;
    width: 100%;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.cover-accent-line {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    height: 1.5px;
    background: var(--accent-secondary);
}

.cover-design h4 {
    font-size: 0.75rem;
    color: white;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cover-design p {
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 0.4rem;
    text-transform: capitalize;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-page {
    position: absolute;
    width: 116px;
    height: 166px;
    background: #e4e4e4;
    top: 2px;
    left: 4px;
    transform: translateZ(-5px);
    border-radius: 0 4px 4px 0;
    z-index: -1;
}

/* Recommendations Layout */
.recommendations-heading {
    font-size: 1.25rem;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recommendations-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.rec-card {
    padding: 1.5rem;
    width: 100%;
    transition: transform var(--transition-speed), border-color var(--transition-speed);
}

.rec-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-hover);
    box-shadow: 0 8px 25px rgba(125, 95, 255, 0.1);
}

.rec-card-inner {
    display: flex;
    gap: 2rem;
    align-items: center;
}

@media (max-width: 650px) {
    .rec-card-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

.mini-cover {
    flex-shrink: 0;
}

.mini-cover .css-book {
    width: 95px;
    height: 135px;
    box-shadow: 4px 4px 15px rgba(0, 0, 0, 0.4);
}

.mini-cover .book-spine {
    width: 12px;
}

.mini-cover .book-page {
    width: 91px;
    height: 131px;
}

.mini-cover .cover-design {
    padding: 0.4rem;
}

.mini-cover .cover-accent-line {
    top: 4px;
    left: 4px;
    right: 4px;
    height: 1px;
}

.mini-cover .cover-design h4 {
    font-size: 0.65rem;
}

.mini-cover .cover-design p {
    font-size: 0.48rem;
    margin-top: 0.2rem;
}

.rec-info {
    flex: 1;
}

.rec-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}

.rec-author {
    color: var(--accent-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.15rem;
    margin-bottom: 0.5rem;
}

.rec-reason {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    position: relative;
    padding-left: 1.25rem;
}

@media (max-width: 650px) {
    .rec-reason {
        padding-left: 0;
        display: inline-block;
    }
    .rec-reason .quote-icon {
        display: none;
    }
}

.quote-icon {
    position: absolute;
    left: 0;
    top: 3px;
    font-size: 0.75rem;
    color: var(--accent-primary);
    opacity: 0.5;
}

/* ========================================================
   PAGE 3: Reading List & Persistent Bookshelf Library
   ======================================================== */

.library-section {
    padding: 2.25rem;
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.library-title-group h2 {
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.library-title-group h2 i {
    color: var(--accent-primary);
}

.library-title-group p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.library-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-box input {
    padding: 0.6rem 1rem 0.6rem 2.25rem;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    outline: none;
    font-size: 0.85rem;
    width: 240px;
    transition: border-color var(--transition-speed);
}

body.light-theme .search-box input {
    background: rgba(0, 0, 0, 0.02);
}

.search-box input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(125, 95, 255, 0.15);
}

.genre-filter {
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition-speed);
}

body.light-theme .genre-filter {
    background: rgba(0, 0, 0, 0.02);
}

.genre-filter:focus {
    border-color: var(--accent-primary);
}

.bookshelf-container {
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    overflow: hidden;
}

body.light-theme .bookshelf-container {
    background: rgba(0, 0, 0, 0.01);
}

.virtual-shelf {
    display: flex;
    flex-direction: column;
    gap: 4.5rem;
    padding-bottom: 2rem;
}

.shelf-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    padding-bottom: 0.5rem;
    border-bottom: 14px solid #5a3c20; /* Wood plank styling */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4), inset 0 -2px 5px rgba(0, 0, 0, 0.5);
    position: relative;
    min-height: 150px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding-left: 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.shelf-row::-webkit-scrollbar {
    height: 4px;
}

.shelf-row::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.shelf-book-item {
    display: inline-block;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), z-index var(--transition-speed);
    flex-shrink: 0;
    transform-origin: bottom center;
}

.shelf-book-item .css-book {
    width: 80px;
    height: 115px;
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.5);
    transform: rotateY(-18deg) rotateX(4deg);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.shelf-book-item .book-spine {
    width: 12px;
}

.shelf-book-item .book-page {
    width: 76px;
    height: 111px;
}

.shelf-book-item .cover-design {
    padding: 0.35rem;
    border-color: rgba(255, 255, 255, 0.08);
}

.shelf-book-item .cover-accent-line {
    top: 3px;
    left: 3px;
    right: 3px;
    height: 1px;
}

.shelf-book-item .cover-design h4 {
    font-size: 0.52rem;
    font-weight: 700;
}

.shelf-book-item .cover-design p {
    font-size: 0.38rem;
    margin-top: 0.15rem;
}

.shelf-book-item:hover {
    transform: translateY(-10px) scale(1.08);
    z-index: 100;
}

.shelf-book-item:hover .css-book {
    transform: rotateY(0deg) rotateX(0deg);
    box-shadow: 0 10px 25px rgba(125, 95, 255, 0.25);
}

.empty-shelf-message {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    padding: 3rem 0;
    width: 100%;
}

/* Modals & Inputs */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

.modal-content {
    max-width: 500px;
    width: 100%;
    padding: 2rem;
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.modal-header h2 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition-speed);
}

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

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.radio-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.radio-label input {
    display: none;
}

.radio-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.1);
    transition: all var(--transition-speed);
    height: 100%;
}

body.light-theme .radio-card {
    background: rgba(0, 0, 0, 0.01);
}

.radio-card i {
    font-size: 1.25rem;
    color: var(--text-muted);
}

.radio-card span {
    font-size: 0.85rem;
    font-weight: 600;
}

.radio-card small {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.2;
}

.radio-label input:checked + .radio-card {
    border-color: var(--accent-primary);
    background: rgba(125, 95, 255, 0.05);
    box-shadow: 0 0 12px var(--accent-glow);
}

body.light-theme .radio-label input:checked + .radio-card {
    background: rgba(108, 92, 231, 0.05);
}

.radio-label input:checked + .radio-card i {
    color: var(--accent-primary);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.input-with-icon input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 2.25rem;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-speed);
}

body.light-theme .input-with-icon input {
    background: rgba(0, 0, 0, 0.02);
}

.input-with-icon input:focus {
    border-color: var(--accent-primary);
}

.btn-toggle-pwd {
    position: absolute;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-toggle-pwd:hover {
    color: var(--text-primary);
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
}

/* Goodreads Import split modal layouts */
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    resize: vertical;
    transition: border-color var(--transition-speed);
}

body.light-theme textarea {
    background: rgba(0, 0, 0, 0.02);
}

textarea:focus {
    border-color: var(--accent-primary);
}

.import-intro {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 1.25rem;
}

.form-actions-split {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.right-actions {
    display: flex;
    gap: 1rem;
}

/* Footer Styling */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
    margin-top: auto;
    transition: background var(--transition-speed);
}

body.light-theme footer {
    background: rgba(0, 0, 0, 0.02);
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    color: var(--accent-primary);
}

/* Keyframes & Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

@keyframes verticalScan {
    0%, 100% { top: 0%; }
    50% { top: 100%; }
}

@keyframes scannerLine {
    0%, 100% { top: 5%; }
    50% { top: 95%; }
}
