/* ================================================================
   SRJ Book Reviews — Frontend Styles
   Designed to integrate seamlessly with the SRJ Library aesthetic
   ================================================================ */

/* ─ Reviews Section in Book Modal ─────────────────────────── */
.srjr-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1.5px solid #f0e8e0;
}

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

.srjr-section-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 15px;
    font-weight: 600;
    color: #2a1a12;
    letter-spacing: 0.02em;
    margin: 0;
}

/* Write a Review button */
.srjr-write-btn {
    background: linear-gradient(135deg, #c0446e 0%, #e8789e 100%);
    color: #fff !important;
    border: none;
    border-radius: 20px;
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.03em;
    font-family: inherit;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(192,68,110,0.25);
    flex-shrink: 0;
}

.srjr-write-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(192,68,110,0.4);
    color: #fff !important;
}

/* Form area slide container */
.srjr-form-area {
    overflow: hidden;
}

/* ─ Aggregate Rating Bar ─────────────────────────────────── */
.srjr-agg {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #fff5f8 0%, #fde8f0 100%);
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(244,184,207,0.4);
}

.srjr-agg-score {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 34px;
    font-weight: 700;
    color: #c0446e;
    line-height: 1;
    min-width: 52px;
}

.srjr-agg-right {
    flex: 1;
}

.srjr-agg-stars {
    display: flex;
    gap: 3px;
    margin-bottom: 4px;
    align-items: center;
}

.srjr-agg-count {
    font-size: 12px;
    color: #9c7a8c;
    letter-spacing: 0.01em;
}

/* ─ Star SVGs ─────────────────────────────────────────────── */
.srjr-star {
    width: 18px;
    height: 18px;
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.srjr-star svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ─ Interactive Star Picker ──────────────────────────────── */
.srjr-picker {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
    cursor: pointer;
    user-select: none;
    align-items: center;
}

.srjr-picker-star {
    width: 32px;
    height: 32px;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

.srjr-picker-star svg {
    width: 100%;
    height: 100%;
    display: block;
    transition: transform 0.12s ease;
}

.srjr-picker-star:hover svg {
    transform: scale(1.15);
}

.srjr-picker-star .srjr-star-left,
.srjr-picker-star .srjr-star-right {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
}

.srjr-picker-star .srjr-star-left  { left: 0; }
.srjr-picker-star .srjr-star-right { right: 0; }

.srjr-rating-label {
    font-size: 13px;
    color: #c0446e;
    font-weight: 600;
    margin-left: 8px;
    min-width: 40px;
}

/* ─ Review Form ──────────────────────────────────────────── */
.srjr-form-wrap {
    background: #fff;
    border: 1.5px solid #f0e8e0;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 24px;
}

.srjr-form-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 14px;
    font-weight: 600;
    color: #2a1a12;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.srjr-form-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: linear-gradient(180deg, #c0446e, #f4b8cf);
    border-radius: 2px;
    display: block;
}

.srjr-picker-row {
    margin-bottom: 14px;
}

.srjr-picker-label {
    font-size: 12px;
    font-weight: 600;
    color: #9c7a8c;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: block;
}

/* Rich Text Editor */
.srjr-editor-wrap {
    position: relative;
    margin-bottom: 14px;
}

.srjr-editor {
    width: 100%;
    min-height: 100px;
    max-height: 280px;
    overflow-y: auto;
    border: 1.5px solid #e8ddd5;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.6;
    color: #2a1a12;
    background: #fafaf9;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s;
    word-break: break-word;
}

.srjr-editor:focus {
    border-color: #d4af37;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(212,175,55,0.1);
}

.srjr-editor:empty::before {
    content: attr(data-placeholder);
    color: #bba99a;
    pointer-events: none;
}

/* Editor Toolbar */
.srjr-toolbar {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    background: #f8f4f0;
    border: 1.5px solid #e8ddd5;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    flex-wrap: wrap;
    align-items: center;
}

.srjr-toolbar + .srjr-editor {
    border-radius: 0 0 10px 10px;
}

.srjr-tb-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 13px;
    color: #6a4a3c;
    font-weight: 600;
    line-height: 1;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
}

.srjr-tb-btn:hover,
.srjr-tb-btn.active {
    background: #fff;
    border-color: #e8ddd5;
    color: #c0446e;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.srjr-tb-sep {
    width: 1px;
    height: 20px;
    background: #e0d5cc;
    margin: 0 4px;
    flex-shrink: 0;
}

/* Emoji picker trigger */
.srjr-emoji-btn {
    font-size: 16px;
    line-height: 1;
}

/* Emoji grid */
.srjr-emoji-popup {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 9999;
    background: #fff;
    border: 1.5px solid #f0e8e0;
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(44,24,16,0.15);
    width: 280px;
    display: none;
}

.srjr-emoji-popup.open {
    display: block;
    animation: srjrPopIn 0.18s cubic-bezier(.22,1,.36,1);
}

@keyframes srjrPopIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to   { opacity: 1; transform: none; }
}

.srjr-emoji-categories {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.srjr-emoji-cat-btn {
    background: #f8f4f0;
    border: 1.5px solid transparent;
    border-radius: 8px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.15s;
}

.srjr-emoji-cat-btn:hover,
.srjr-emoji-cat-btn.active {
    background: #fde8f0;
    border-color: #f4b8cf;
}

.srjr-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    max-height: 160px;
    overflow-y: auto;
}

.srjr-emoji-item {
    background: none;
    border: none;
    border-radius: 6px;
    padding: 4px;
    cursor: pointer;
    font-size: 20px;
    text-align: center;
    transition: background 0.12s;
    line-height: 1.3;
}

.srjr-emoji-item:hover {
    background: #fde8f0;
}

/* Photo upload */
.srjr-photo-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.srjr-photo-label {
    font-size: 12px;
    font-weight: 600;
    color: #9c7a8c;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    flex-shrink: 0;
}

.srjr-photo-upload-btn {
    background: #f8f4f0;
    border: 1.5px dashed #d4af37;
    border-radius: 8px;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 13px;
    color: #7a5c3c;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.srjr-photo-upload-btn:hover {
    background: #fff5e8;
    border-color: #c0446e;
    color: #c0446e;
}

.srjr-photo-input {
    display: none;
}

.srjr-photo-preview {
    position: relative;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    display: none;
}

.srjr-photo-preview.has-photo {
    display: block;
}

.srjr-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 1.5px solid #f0e8e0;
}

.srjr-photo-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: #c0446e;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.srjr-photo-uploading {
    font-size: 12px;
    color: #9c7a8c;
    font-style: italic;
}

/* Submit button */
.srjr-submit-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.srjr-submit-btn {
    background: linear-gradient(135deg, #c0446e 0%, #e8789e 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.02em;
    font-family: inherit;
}

.srjr-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(192,68,110,0.35);
}

.srjr-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.srjr-form-msg {
    font-size: 13px;
    font-weight: 500;
    display: none;
}

.srjr-form-msg.success { color: #3d7a5c; }
.srjr-form-msg.error   { color: #c0446e; }

/* Login prompt */
.srjr-login-prompt {
    background: #f8f4f0;
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 13px;
    color: #7a5c3c;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.srjr-login-prompt a {
    color: #c0446e;
    font-weight: 600;
    text-decoration: none;
}

.srjr-login-prompt a:hover { text-decoration: underline; }

/* Cardholder only message */
.srjr-cardholder-prompt {
    background: linear-gradient(135deg, #fff5f8, #fde8f0);
    border: 1px solid rgba(244,184,207,0.5);
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 13px;
    color: #9c4070;
    margin-bottom: 20px;
}

/* ─ Individual Reviews List ──────────────────────────────── */
.srjr-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.srjr-review-card {
    background: #fff;
    border: 1.5px solid #f0e8e0;
    border-radius: 14px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.srjr-review-card:hover {
    box-shadow: 0 4px 16px rgba(44,24,16,0.08);
}

.srjr-review-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 10px;
    flex-wrap: wrap;
}

.srjr-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}
.srjr-avatar-img {
    object-fit: cover;
    display: block;
    border: 1.5px solid rgba(0,0,0,0.08);
}
.srjr-avatar-initial {
    background: linear-gradient(135deg, #f4b8cf, #d4af37);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.srjr-review-meta {
    flex: 1;
    min-width: 0;
}

.srjr-reviewer-name {
    font-weight: 700;
    font-size: 14px;
    color: #2a1a12;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.srjr-review-stars {
    display: flex;
    gap: 2px;
    align-items: center;
}

.srjr-review-date {
    font-size: 11px;
    color: #b09a8c;
    white-space: nowrap;
    flex-shrink: 0;
}

.srjr-review-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.srjr-review-action-btn {
    background: none;
    border: 1px solid #e8ddd5;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 11px;
    cursor: pointer;
    color: #9c7a8c;
    transition: all 0.15s;
    font-family: inherit;
}

.srjr-review-action-btn:hover {
    border-color: #c0446e;
    color: #c0446e;
}

.srjr-review-action-btn.delete:hover {
    background: #fff0f5;
}

.srjr-review-body {
    padding: 0 16px 14px;
}

.srjr-review-text {
    font-size: 14px;
    line-height: 1.7;
    color: #3a2a1f;
    margin-bottom: 10px;
    word-break: break-word;
}

.srjr-review-text p { margin: 0 0 8px; }
.srjr-review-text p:last-child { margin-bottom: 0; }
.srjr-review-text strong, .srjr-review-text b { font-weight: 700; }
.srjr-review-text em, .srjr-review-text i { font-style: italic; }

.srjr-review-photo {
    max-width: 200px;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 8px;
    border: 1.5px solid #f0e8e0;
}

.srjr-review-photo img {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    transition: opacity 0.2s;
}

.srjr-review-photo img:hover {
    opacity: 0.9;
}

/* ─ Empty State ──────────────────────────────────────────── */
.srjr-empty {
    text-align: center;
    padding: 28px 20px;
    color: #b09a8c;
    font-size: 13px;
    background: #fafaf9;
    border-radius: 12px;
    border: 1.5px dashed #e8ddd5;
}

.srjr-empty-icon {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
}

/* ─ Loading ──────────────────────────────────────────────── */
.srjr-loading {
    text-align: center;
    padding: 20px;
    color: #b09a8c;
    font-size: 13px;
    font-style: italic;
}

/* ─ Photo Lightbox ───────────────────────────────────────── */
.srjr-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(30,15,10,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

.srjr-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 16px 64px rgba(0,0,0,0.6);
    object-fit: contain;
}

/* ─ Star SVG fill colors ─────────────────────────────────── */
:root {
    --srjr-star-full:   #e8a020;
    --srjr-star-empty:  #e8ddd5;
    --srjr-star-active: #c0446e;
}

/* Responsive adjustments for inside the modal */
@media (max-width: 600px) {
    .srjr-agg {
        gap: 10px;
        padding: 12px 14px;
    }

    .srjr-agg-score {
        font-size: 28px;
        min-width: 44px;
    }

    .srjr-form-wrap {
        padding: 16px;
    }

    .srjr-picker-star {
        width: 28px;
        height: 28px;
    }

    .srjr-emoji-popup {
        width: 240px;
    }

    .srjr-emoji-grid {
        grid-template-columns: repeat(7, 1fr);
    }
}
