/**
 * Books System Styles
 * File: css/books.css
 * Author: EduPedia Team
 * Version: 1.0.3
 */

/* ====================================================================
   CSS RESET & BASE STYLES
   ==================================================================== */

.books-system * {
    box-sizing: border-box;
}

.books-system img {
    max-width: 100%;
    height: auto;
}

/* ====================================================================
   BOOK REVIEWS SECTION
   ==================================================================== */

.book-reviews-section {
    margin: 30px 0;
    padding: 30px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

.reviews-title {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.reviews-title .dashicons {
    color: #ff9800;
    font-size: 28px;
}

/* ====================================================================
   REVIEWS SUMMARY
   ==================================================================== */

.reviews-summary {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid #e3e6ea;
}

.summary-overview {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 30px;
    align-items: start;
}

.average-rating {
    text-align: center;
    min-width: 150px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.rating-number {
    font-size: 48px;
    font-weight: bold;
    color: #ff9800;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(255, 152, 0, 0.2);
}

.rating-stars {
    margin: 10px 0;
    font-size: 20px;
    color: #ff9800;
    letter-spacing: 2px;
}

.rating-stars .star {
    display: inline-block;
    transition: transform 0.2s ease;
}

.rating-stars .star:hover {
    transform: scale(1.1);
}

.total-reviews {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

/* ====================================================================
   RATING BREAKDOWN
   ==================================================================== */

.rating-breakdown {
    flex: 1;
    padding: 10px 0;
}

.rating-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.rating-bar:hover {
    transform: translateX(5px);
}

.star-label {
    width: 40px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff9800, #ffa726);
    transition: width 0.8s ease;
    border-radius: 8px;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.percent-label {
    width: 40px;
    text-align: right;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* ====================================================================
   REVIEWS LIST
   ==================================================================== */

.reviews-list {
    margin-top: 30px;
}

.review-item {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    background: #fff;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.review-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff9800, #ffa726);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.review-item:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.review-item:hover::before {
    transform: scaleX(1);
}

/* ====================================================================
   REVIEWER INFO
   ==================================================================== */

.reviewer-info {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.reviewer-avatar {
    position: relative;
}

.avatar-placeholder {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #007cba, #0056b3);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 3px 10px rgba(0, 124, 186, 0.3);
    position: relative;
    overflow: hidden;
}

.avatar-placeholder::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: avatarShine 3s infinite;
}

@keyframes avatarShine {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.reviewer-details {
    flex: 1;
}

.reviewer-name {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
    color: #333;
}

.reviewer-stats {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.reviewer-activity {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #999;
    flex-wrap: wrap;
}

.reviewer-activity span {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
}

/* ====================================================================
   REVIEW CONTENT
   ==================================================================== */

.review-content {
    margin-left: 65px;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.review-rating {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.review-rating .star {
    color: #ff9800;
    font-size: 16px;
    transition: all 0.2s ease;
}

.review-rating .star-full {
    text-shadow: 0 1px 3px rgba(255, 152, 0, 0.5);
}

.review-title {
    font-weight: bold;
    color: #333;
    font-size: 15px;
}

.verified-purchase {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #4caf50;
    font-size: 14px;
    padding: 4px 8px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 12px;
    font-weight: 500;
}

.verified-purchase .dashicons {
    font-size: 16px;
}

/* ====================================================================
   REVIEW TEXT & FOOTER
   ==================================================================== */

.review-text {
    line-height: 1.6;
    margin-bottom: 15px;
    color: #333;
    font-size: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    border-left: 3px solid #ff9800;
}

.review-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
    flex-wrap: wrap;
    gap: 15px;
}

.review-date {
    font-size: 14px;
    color: #666;
    font-style: italic;
}

/* ====================================================================
   REVIEW ACTIONS
   ==================================================================== */

.review-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    background: none;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.action-btn:hover::before {
    width: 100%;
    height: 100%;
}

.action-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.action-btn.clicked {
    background: #4caf50 !important;
    color: white !important;
    border-color: #4caf50 !important;
    transform: scale(0.95);
}

.action-btn.processing {
    pointer-events: none;
    opacity: 0.7;
}

.action-btn .dashicons {
    font-size: 14px;
}

/* ====================================================================
   LOAD MORE SECTION
   ==================================================================== */

.reviews-load-more {
    text-align: center;
    margin: 30px 0;
}

.load-more-reviews {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 2px solid #007cba;
    color: #007cba;
    padding: 15px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 20px auto;
    transition: all 0.3s ease;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.load-more-reviews::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.load-more-reviews:hover {
    background: #007cba;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 124, 186, 0.3);
}

.load-more-reviews:hover::before {
    left: 100%;
}

.load-more-reviews:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.load-more-reviews .dashicons {
    transition: transform 0.3s ease;
}

.load-more-reviews:hover .dashicons {
    transform: translateY(2px);
}

/* ====================================================================
   NO REVIEWS SECTION
   ==================================================================== */

.no-reviews-section {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    margin: 30px 0;
    border: 1px dashed #dee2e6;
}

.no-reviews-section h3 {
    color: #6c757d;
    margin-bottom: 20px;
    font-size: 20px;
}

.no-reviews-section .dashicons {
    font-size: 24px;
    color: #6c757d;
}

.no-reviews-message {
    max-width: 400px;
    margin: 0 auto;
}

.no-reviews-message p {
    color: #666;
    margin: 10px 0;
    font-size: 15px;
    line-height: 1.5;
}

.no-reviews-icon {
    margin-bottom: 20px;
}

.no-reviews-icon .dashicons {
    font-size: 64px !important;
    color: #bdc3c7;
    opacity: 0.7;
}

/* ====================================================================
   ANIMATIONS
   ==================================================================== */

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Animation classes */
.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.slide-in-right {
    animation: slideInRight 0.4s ease forwards;
}

.pulse {
    animation: pulse 2s infinite;
}

/* ====================================================================
   LOADING STATES
   ==================================================================== */

.loading {
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

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

/* ====================================================================
   NOTIFICATIONS
   ==================================================================== */

.books-notification {
    position: fixed;
    top: 32px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    padding: 15px 20px;
    border-left: 4px solid;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    animation: slideInRight 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.books-notification.notice-success {
    border-left-color: #4caf50;
}

.books-notification.notice-error {
    border-left-color: #f44336;
}

.books-notification.notice-warning {
    border-left-color: #ff9800;
}

.books-notification.notice-info {
    border-left-color: #2196f3;
}

.books-notification p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    line-height: 1.4;
}

.books-notification .notice-dismiss {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: #666;
    transition: color 0.2s ease;
}

.books-notification .notice-dismiss:hover {
    color: #333;
}

/* ====================================================================
   RESPONSIVE DESIGN
   ==================================================================== */

@media (max-width: 768px) {
    .book-reviews-section {
        padding: 20px 15px;
        margin: 20px 0;
    }

    .reviews-title {
        font-size: 20px;
        text-align: center;
    }

    .summary-overview {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }

    .average-rating {
        min-width: auto;
        padding: 15px;
    }

    .rating-number {
        font-size: 36px;
    }

    .review-content {
        margin-left: 0;
        margin-top: 15px;
    }

    .reviewer-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
    }

    .review-footer {
        flex-direction: column;
        gap: 15px;
        align-items: center;
        text-align: center;
    }

    .review-actions {
        justify-content: center;
    }

    .action-btn {
        font-size: 11px;
        padding: 6px 10px;
    }

    .load-more-reviews {
        padding: 12px 20px;
        font-size: 13px;
    }

    .books-notification {
        top: 46px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .book-reviews-section {
        padding: 15px 10px;
    }

    .reviews-summary {
        padding: 15px;
    }

    .review-item {
        padding: 15px;
    }

    .review-text {
        padding: 10px;
        font-size: 14px;
    }

    .rating-bar {
        gap: 8px;
    }

    .star-label {
        width: 30px;
        font-size: 12px;
    }

    .percent-label {
        width: 30px;
        font-size: 12px;
    }

    .reviewer-activity {
        justify-content: center;
        gap: 8px;
    }

    .reviewer-activity span {
        font-size: 11px;
        padding: 1px 4px;
    }
}

/* ====================================================================
   DARK MODE SUPPORT
   ==================================================================== */

@media (prefers-color-scheme: dark) {
    .book-reviews-section {
        background: #1e1e1e;
        color: #ffffff;
    }

    .reviews-summary {
        background: linear-gradient(135deg, #2d2d2d 0%, #3a3a3a 100%);
        border-color: #404040;
    }

    .average-rating {
        background: rgba(255, 255, 255, 0.1);
    }

    .review-item {
        background: #2d2d2d;
        border-color: #404040;
    }

    .review-text {
        background: rgba(255, 255, 255, 0.05);
        color: #e0e0e0;
    }

    .reviewer-name {
        color: #ffffff;
    }

    .review-title {
        color: #ffffff;
    }

    .action-btn {
        border-color: #555;
        color: #e0e0e0;
    }

    .action-btn:hover {
        background: #404040;
        border-color: #666;
    }

    .no-reviews-section {
        background: linear-gradient(135deg, #2d2d2d 0%, #3a3a3a 100%);
        border-color: #404040;
    }

    .books-notification {
        background: #2d2d2d;
        color: #ffffff;
    }
}

/* ====================================================================
   HIGH CONTRAST MODE
   ==================================================================== */

@media (prefers-contrast: high) {
    .book-reviews-section {
        border: 2px solid #000;
    }

    .review-item {
        border: 2px solid #000;
    }

    .action-btn {
        border: 2px solid #000;
    }

    .progress-bar {
        border: 1px solid #000;
    }

    .avatar-placeholder {
        border: 2px solid #000;
    }
}

/* ====================================================================
   REDUCED MOTION
   ==================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ====================================================================
   PRINT STYLES
   ==================================================================== */

@media print {
    .book-reviews-section {
        box-shadow: none;
        border: 1px solid #000;
    }

    .review-actions,
    .load-more-reviews,
    .books-notification {
        display: none !important;
    }

    .review-item {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .reviews-title {
        color: #000 !important;
    }

    .avatar-placeholder {
        background: #ccc !important;
        color: #000 !important;
    }
}

