/**
 * Books Module Frontend Styles
 * SophiaDesign Elegant Commerce
 *
 * @package SophiaDesign_Elegant_Commerce
 * @since 1.0.0
 */

/* ========================================
   書籍ギャラリー
   ======================================== */

.sdec-books-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    padding: 20px 0;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .sdec-books-gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
}

.sdec-book-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sdec-book-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.sdec-book-thumbnail {
    position: relative;
    overflow: hidden;
    display: block;
    padding-top: 140%; /* 書籍カバー比率 */
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eaf0 100%);
}

.sdec-book-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.sdec-book-card:hover .sdec-book-thumbnail img {
    transform: scale(1.05);
}

.sdec-limited-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #d4af37 0%, #f4e4a0 100%);
    color: #333;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
    z-index: 2;
}

.sdec-book-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sdec-book-info h3 {
    margin: 0 0 8px;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 700;
    color: #1a1a1a;
}

.sdec-book-info h3 a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.sdec-book-info h3 a:hover {
    color: #d4af37;
}

.sdec-book-author {
    font-size: 14px;
    color: #666;
    margin: 0 0 12px;
}

.sdec-book-price {
    font-size: 24px;
    font-weight: 700;
    color: #d4af37;
    margin: auto 0 16px;
}

.sdec-book-button {
    display: inline-block;
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    color: #fff;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    transition: all 0.3s;
}

.sdec-book-button:hover {
    background: linear-gradient(135deg, #d4af37 0%, #f4e4a0 100%);
    color: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.sdec-no-books {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    color: #999;
}

/* ========================================
   個別書籍ページ
   ======================================== */

.sdec-book-single {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.sdec-book-single-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    align-items: start;
}

@media (max-width: 992px) {
    .sdec-book-single-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

.sdec-book-description {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.sdec-book-meta-info {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eaf0 100%);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.sdec-book-meta-info p {
    margin: 0 0 12px;
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}

.sdec-book-meta-info p:last-child {
    margin-bottom: 0;
}

.sdec-book-meta-info strong {
    color: #1a1a1a;
    font-weight: 600;
    display: inline-block;
    min-width: 80px;
}

.sdec-book-sidebar {
    position: sticky;
    top: 20px;
    align-self: start;
}

.sdec-book-purchase-section {
    /* Purchase form within sidebar */
}

/* ========================================
   購入フォーム
   ======================================== */

.sdec-book-purchase-form {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.sdec-book-purchase-form h3 {
    margin: 0 0 24px;
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    border-bottom: 2px solid #d4af37;
    padding-bottom: 12px;
}

.sdec-form-group {
    margin-bottom: 24px;
}

.sdec-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.sdec-form-group input[type="radio"],
.sdec-form-group input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.sdec-form-group input[type="radio"] + label,
.sdec-form-group input[type="checkbox"] + label {
    display: inline;
    margin-bottom: 0;
    font-weight: 400;
    cursor: pointer;
}

.sdec-form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.2s;
}

.sdec-form-group textarea:focus {
    outline: none;
    border-color: #d4af37;
}

.sdec-limited-edition-number {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eaf0 100%);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.sdec-limited-edition-number p {
    margin: 0;
    font-size: 16px;
    color: #333;
}

#sdec-edition-number {
    font-weight: 700;
    color: #d4af37;
    font-size: 18px;
}

.sdec-total-price {
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    color: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.sdec-total-price h4 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#sdec-total-amount {
    color: #d4af37;
    font-size: 28px;
}

.sdec-submit-order {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #d4af37 0%, #f4e4a0 100%);
    color: #1a1a1a;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s;
}

.sdec-submit-order:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.4);
}

.sdec-submit-order:active {
    transform: translateY(0);
}

.sdec-submit-order:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========================================
   ARプレビューモーダル（将来実装）
   ======================================== */

.sdec-ar-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.sdec-ar-preview-modal.active {
    display: flex;
}

.sdec-ar-preview-content {
    width: 90%;
    max-width: 800px;
    height: 80vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.sdec-ar-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    z-index: 10;
    transition: background 0.2s;
}

.sdec-ar-close:hover {
    background: rgba(212, 175, 55, 1);
    color: #1a1a1a;
}

/* ========================================
   レスポンシブデザイン
   ======================================== */

@media (max-width: 600px) {
    .sdec-book-purchase-form {
        padding: 20px;
    }

    .sdec-book-purchase-form h3 {
        font-size: 20px;
    }

    .sdec-total-price h4 {
        flex-direction: column;
        gap: 8px;
    }

    #sdec-total-amount {
        font-size: 24px;
    }

    .sdec-submit-order {
        font-size: 16px;
        padding: 14px 20px;
    }
}

/* ========================================
   ローディングアニメーション
   ======================================== */

.sdec-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    border-top-color: #d4af37;
    animation: sdec-spin 0.8s linear infinite;
}

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

/* ========================================
   エラー・成功メッセージ
   ======================================== */

.sdec-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.sdec-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.sdec-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.sdec-message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}
