/**
 * Public styles for PSH Bookshelf - Elegant Floating Shelf Design
 */

/* Reset and base styles */
.psh-bookshelf-container {
    margin: 2rem 0;
    padding: 0;
    font-family: inherit;
    position: relative;
    background: transparent;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    z-index: 1;
}

/* Bookshelf title and description */
.psh-bookshelf-title {
    font-size: 1.8rem;
    margin: 0 0 1.5rem 0;
    color: #333;
    text-align: center;
    font-weight: 500;
}

.psh-bookshelf-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 1rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Elegant wooden shelf design */
.psh-bookshelf-shelf {
    position: relative;
    padding: 25px 60px 5px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    max-width: 100%;
    filter: drop-shadow(0 6px 15px rgba(0, 0, 0, 0.3));
}

/* Beautiful wooden shelf - main surface */
.psh-bookshelf-shelf:before {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    height: 35px;
    background: linear-gradient(180deg, 
        #e6c578 0%, 
        #d4a574 30%, 
        #c19a6b 70%, 
        #a68b5b 100%);
    clip-path: polygon(10% 0%, 90% 0%, 100% 100%, 0% 100%);
    border-radius: 4px;
    z-index: 2;
}

/* Wooden shelf thickness/depth */
.psh-bookshelf-shelf:after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 12px;
    background: linear-gradient(180deg, 
        #c19a6b 0%, 
        #a68b5b 50%, 
        #8b7355 100%);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 1;
}



/* Carousel navigation */
.psh-carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    color: #333;
    box-shadow: 0 3px 12px rgba(0,0,0,0.2);
}

.psh-carousel-arrow {
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
}

.psh-carousel-nav:hover:not(:disabled) {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    border-color: #bbb;
}

.psh-carousel-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.7);
}

.psh-carousel-prev {
    left: 10px;
}

.psh-carousel-next {
    right: 10px;
}



/* Books container wrapper */
.psh-books-viewport {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding: 15px 0;
}

/* Books container */
.psh-books-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    position: relative;
    z-index: 3;
    transition: transform 0.4s ease;
    will-change: transform;
    padding: 0 10px;
}

/* Mobile scrolling */
@media (max-width: 768px) {
    .psh-books-viewport {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
        padding: 15px 0;
    }
    
    .psh-books-viewport::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
    
    .psh-books-container {
        transition: none;
        justify-content: flex-start;
        padding: 0 12px;
    }
}

/* Individual book items */
.psh-book-item {
    position: relative;
    cursor: pointer;
    transition: z-index 0.1s ease;
    z-index: 3;
    outline: none;
    flex-shrink: 0;
    min-width: 120px;
}

.psh-book-item:hover,
.psh-book-item:focus {
    z-index: 50;
}

/* Book cover styling */
.psh-book-cover-container {
    position: relative;
}

.psh-book-cover {
    display: block;
    border-radius: 4px;
    box-shadow: 
        0 3px 10px rgba(0,0,0,0.2),
        0 1px 4px rgba(0,0,0,0.1);
    object-fit: cover;
    transition: all 0.3s ease;
    max-width: 120px;
    max-height: 180px;
    width: auto;
    height: auto;
}

.psh-book-item:hover .psh-book-cover,
.psh-book-item:focus .psh-book-cover {
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.3),
        0 4px 15px rgba(0,0,0,0.15);
}

/* Book placeholder (no cover) - elegant book spine */
.psh-book-cover-placeholder {
    display: flex;
    align-items: stretch;
    border-radius: 4px;
    box-shadow: 
        0 3px 10px rgba(0,0,0,0.2),
        0 1px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    width: 120px;
    height: 180px;
}

.psh-book-item:hover .psh-book-cover-placeholder,
.psh-book-item:focus .psh-book-cover-placeholder {
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.3),
        0 4px 15px rgba(0,0,0,0.15);
}

.psh-book-spine {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 12px 8px;
    background: linear-gradient(135deg, 
        #2c5282 0%, 
        #2d3748 20%, 
        #1a202c 40%, 
        #2d3748 60%, 
        #4a5568 80%, 
        #2c5282 100%);
    color: white;
    text-align: center;
    position: relative;
}

.psh-book-spine:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, 
        rgba(255,255,255,0.3), 
        transparent 50%, 
        rgba(0,0,0,0.1));
}

.psh-book-title-spine {
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.psh-book-author-spine {
    font-size: 8px;
    opacity: 0.8;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Book info overlay - appears on cover hover */
.psh-book-info {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.3) 50%,
        rgba(0, 0, 0, 0.8) 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 12px 8px;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
    backdrop-filter: blur(1px);
    color: white;
    text-align: center;
}

.psh-book-item:hover .psh-book-info,
.psh-book-item:focus .psh-book-info {
    opacity: 1;
    visibility: visible;
}

.psh-book-title {
    font-size: 0.8rem;
    margin: 0 0 4px 0;
    color: white;
    font-weight: 600;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.psh-book-author {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Modal styles - clean and modern */
.psh-book-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: none;
}

.psh-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(3px);
    z-index: 999999;
}

.psh-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 80px rgba(0,0,0,0.4);
    animation: modalSlideIn 0.3s ease-out;
    z-index: 1000000;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.psh-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
}

.psh-modal-title {
    margin: 0;
    color: #1f2937;
    font-size: 1.3rem;
    font-weight: 600;
}

.psh-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.psh-modal-close:hover {
    background: #e5e7eb;
    color: #374151;
    transform: scale(1.1);
}

.psh-close-icon {
    font-size: 24px;
    font-weight: normal;
    line-height: 1;
}

.psh-modal-body {
    padding: 24px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

.psh-loading {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.psh-spinner {
    width: 32px;
    height: 32px;
    margin: 0 auto 12px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    display: block;
    animation: psh-spin 1s linear infinite;
}

.psh-spin {
    animation: psh-spin 1s linear infinite;
}

@keyframes psh-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.psh-book-details {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 24px;
    align-items: start;
}

.psh-book-cover-large {
    text-align: center;
}

.psh-book-cover-large img {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.psh-modal-book-title {
    margin: 0 0 8px 0;
    color: #1f2937;
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.3;
}

.psh-modal-book-author {
    margin: 0 0 16px 0;
    color: #6b7280;
    font-size: 1rem;
    font-style: italic;
}

.psh-modal-book-synopsis {
    margin: 0 0 20px 0;
    line-height: 1.6;
    color: #374151;
    font-size: 0.95rem;
}

.psh-modal-book-synopsis p {
    margin-bottom: 12px;
}

.psh-modal-book-meta {
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    font-size: 0.85rem;
    color: #6b7280;
}

.psh-modal-book-meta p {
    margin: 4px 0;
}

/* Error and empty states */
.psh-bookshelf-error,
.psh-bookshelf-empty {
    padding: 40px 20px;
    text-align: center;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
    font-size: 1rem;
    margin: 20px 0;
}

.psh-bookshelf-error {
    border-color: #f87171;
    background: #fef2f2;
    color: #dc2626;
}

/* Responsive design */
@media (max-width: 768px) {
    .psh-bookshelf-container {
        margin: 1rem 0;
    }

    .psh-bookshelf-title {
        font-size: 1.5rem;
    }

    .psh-bookshelf-shelf {
        padding: 20px 0 30px;
    }
    
    .psh-carousel-nav {
        width: 38px;
        height: 38px;
    }
    
    .psh-carousel-prev {
        left: 5px;
    }
    
    .psh-carousel-next {
        right: 5px;
    }

    .psh-books-container {
        gap: 12px;
    }

    .psh-bookshelf-shelf:before {
        left: 0;
        right: 0;
        height: 28px;
        bottom: 5px;
    }

    .psh-bookshelf-shelf:after {
        left: 0;
        right: 0;
        height: 10px;
        bottom: -2px;
    }

    .psh-book-cover {
        max-width: 100px;
        max-height: 150px;
    }

    .psh-book-cover-placeholder {
        width: 100px;
        height: 150px;
    }

    .psh-book-info {
        padding: 8px 6px;
    }
    
    .psh-book-title {
        font-size: 0.7rem;
        -webkit-line-clamp: 2;
        line-height: 1.1;
    }
    
    .psh-book-author {
        font-size: 0.65rem;
    }

    .psh-book-details {
        grid-template-columns: 1fr;
        gap: 16px;
        text-align: center;
    }

    .psh-modal-overlay {
        align-items: center !important;
        justify-content: center !important;
        padding: 20px !important;
    }
    
    .psh-modal-content {
        width: 90% !important;
        height: 80vh !important;
        max-height: 80vh !important;
        border-radius: 12px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        background: #fff !important;
        display: flex !important;
        flex-direction: column !important;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3) !important;
        position: relative !important;
    }
    
    .psh-modal-header {
        flex: 0 0 60px !important;
        background: #fff !important;
        border-bottom: 1px solid #eee !important;
        display: flex !important;
        align-items: center !important;
        padding: 0 20px !important;
    }
    
    .psh-modal-body {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        padding: 20px !important;
        background: #fff !important;
        -webkit-overflow-scrolling: touch !important;
    }
} 