/**
 * 虛擬書架系統 - 前台樣式
 * Virtual Bookshelf - Frontend Styles
 */

:root {
    --vb-primary: #6366f1;
    --vb-secondary: #8b5cf6;
    --vb-success: #10b981;
    --vb-danger: #ef4444;
    --vb-warning: #f59e0b;
    --vb-info: #3b82f6;
    --vb-dark: #1e293b;
    --vb-light: #f8fafc;
    --vb-gradient: linear-gradient(135deg, var(--vb-primary) 0%, var(--vb-secondary) 100%);
    --vb-text: #334155;
    --vb-muted: #475569; /* WCAG AA compliant - upgraded from #64748b for better contrast */
}

/* 基本設定 */
body {
    font-family: 'Segoe UI', 'Microsoft JhengHei', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--vb-text);
    line-height: 1.6;
    background-color: var(--vb-light);
}

main {
    padding-top: 76px;
    min-height: calc(100vh - 300px);
}

a {
    color: var(--vb-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--vb-secondary);
}

/* 工具類別 */
.text-vb-primary { color: var(--vb-primary) !important; }
.text-vb-secondary { color: var(--vb-secondary) !important; }
.bg-vb-primary { background-color: var(--vb-primary) !important; }
.bg-vb-secondary { background-color: var(--vb-secondary) !important; }
.bg-vb-gradient { background: var(--vb-gradient) !important; }

/* 按鈕 */
.btn-vb-primary {
    background: var(--vb-gradient);
    border: none;
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-vb-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    color: white;
}

.btn-vb-secondary {
    background: white;
    border: 2px solid var(--vb-primary);
    color: var(--vb-primary);
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-vb-secondary:hover {
    background: var(--vb-primary);
    color: white;
}

.btn-vb-outline {
    background: transparent;
    border: 2px solid var(--vb-primary);
    color: var(--vb-primary);
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-vb-outline:hover {
    background: var(--vb-gradient);
    border-color: transparent;
    color: white;
}

/* Navbar */
.navbar {
    transition: all 0.3s ease;
}

.navbar-brand {
    font-size: 1.25rem;
    color: var(--vb-primary) !important;
}

.navbar .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    position: relative;
}

.navbar .nav-link:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--vb-gradient);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.navbar .nav-link:hover:after,
.navbar .nav-link.active:after {
    width: 80%;
}

.navbar .nav-link.active {
    color: var(--vb-primary) !important;
}

/* Hero Section */
.hero-section {
    background: var(--vb-gradient);
    color: white;
    padding: 100px 0 80px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-section p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.card-header {
    background: white;
    border-bottom: 2px solid var(--vb-light);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.card-img-top {
    height: 200px;
    object-fit: cover;
}

/* Stat Cards */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
}

.stat-icon.bg-primary {
    background: rgba(99, 102, 241, 0.15) !important;
    color: var(--vb-primary) !important;
}

.stat-icon.bg-success {
    background: rgba(16, 185, 129, 0.15) !important;
    color: var(--vb-success) !important;
}

.stat-icon.bg-warning {
    background: rgba(245, 158, 11, 0.15) !important;
    color: var(--vb-warning) !important;
}

.stat-icon.bg-info {
    background: rgba(59, 130, 246, 0.15) !important;
    color: var(--vb-info) !important;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--vb-dark);
    line-height: 1.2;
}

.stat-label {
    color: var(--vb-muted);
    font-size: 0.9rem;
}

/* Bookshelf Card */
.bookshelf-card {
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.bookshelf-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(99, 102, 241, 0.15);
}

.bookshelf-card .card-img-top {
    height: 180px;
    object-fit: cover;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.bookshelf-card .book-count {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(99, 102, 241, 0.9);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.bookshelf-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.bookshelf-card .card-text {
    color: var(--vb-muted);
    font-size: 0.9rem;
}

/* Book Card */
.book-card {
    border-radius: 10px;
    transition: all 0.3s ease;
}

.book-card:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.book-card .book-cover {
    height: 200px;
    object-fit: contain;
    background: #f1f5f9;
    padding: 1rem;
}

.book-card .card-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-card .book-author {
    font-size: 0.85rem;
    color: var(--vb-muted);
}

/* Section Header */
.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--vb-dark);
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--vb-muted);
    margin-bottom: 1rem;
}

.section-header .divider {
    width: 60px;
    height: 4px;
    background: var(--vb-gradient);
    margin: 0 auto;
    border-radius: 2px;
}

/* Tags */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 0.25rem;
    transition: all 0.3s ease;
}

.tag-primary {
    background: rgba(99, 102, 241, 0.1);
    color: var(--vb-primary);
}

.tag-primary:hover {
    background: var(--vb-primary);
    color: white;
}

/* Search Form */
.search-form {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

.search-form .form-control {
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    padding: 0.75rem 1rem;
}

.search-form .form-control:focus {
    border-color: var(--vb-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Pagination */
.pagination .page-link {
    border: none;
    color: var(--vb-text);
    border-radius: 8px;
    margin: 0 2px;
    padding: 0.5rem 0.85rem;
}

.pagination .page-link:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--vb-primary);
}

.pagination .page-item.active .page-link {
    background: var(--vb-gradient);
    color: white;
}

/* Footer */
.footer {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white;
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item a {
    color: var(--vb-muted);
}

.breadcrumb-item.active {
    color: var(--vb-primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--vb-muted);
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.empty-state h4 {
    color: var(--vb-dark);
    margin-bottom: 0.5rem;
}

/* Book Detail */
.book-detail-cover {
    max-width: 300px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.book-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.book-meta-item {
    background: #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.book-meta-item i {
    color: var(--vb-primary);
    margin-right: 0.5rem;
}

/* Shelf Books Grid */
.shelf-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section {
        padding: 80px 0 60px;
    }

    .hero-section h1 {
        font-size: 1.75rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .section-header h2 {
        font-size: 1.4rem;
    }

    .shelf-books-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1rem;
    }
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}
