/* Collection button styles are in style.css - using global styles */

/* School Card Labels */
.school-card-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.school-card-labels .badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    font-weight: 500;
}

.featured-section {
    background-color: #fff;
}

.featured-section-intro {
    color: inherit;
}

.top-schools-section {
    background-color: #fff;
}

.top-schools-section .container,
.top-schools-section .school-carousel-container,
.top-schools-section .school-carousel-wrapper,
.top-schools-section .school-carousel,
.top-schools-section .school-item {
    background-color: #fff;
}

.top-schools-section-intro {
    color: inherit;
}

.featured-section-intro h2,
.featured-section-intro p,
.top-schools-section-intro h2,
.top-schools-section-intro p {
    transition: color 0.2s ease;
}

.featured-section-intro:hover h2,
.featured-section-intro:focus-visible h2,
.top-schools-section-intro:hover h2,
.top-schools-section-intro:focus-visible h2 {
    color: var(--primary-blue);
}

.featured-section-intro:hover p,
.featured-section-intro:focus-visible p,
.top-schools-section-intro:hover p,
.top-schools-section-intro:focus-visible p {
    color: var(--primary-blue) !important;
}

.featured-section .school-card {
    cursor: pointer;
}

.top-schools-section .school-card {
    cursor: pointer;
    border: none !important;
    box-shadow: var(--shadow-md) !important;
}

.featured-section .school-card .school-rating-display {
    margin-top: auto;
}

.top-schools-section .school-card .school-rating-display {
    margin-top: auto;
}

.featured-section .featured-school-card-link::after {
    z-index: 3;
}

.top-schools-section .top-school-card-link::after {
    z-index: 3;
}

.featured-section .school-card:focus-within {
    box-shadow: var(--shadow-xl);
}

.top-schools-section .school-card:focus-within {
    box-shadow: var(--shadow-xl);
}

.top-schools-section .school-card:hover,
.top-schools-section .school-card:focus-within {
    box-shadow: var(--shadow-xl) !important;
}

.top-school-rank-badge {
    pointer-events: none;
}

@media (max-width: 1199.98px) {
    .hero-section h1 {
        text-align: center !important;
    }

    .hero-section h1 .hero-line {
        display: block;
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 991.98px) {
    /* Home page - mobile shrinking (excluding review container) */
    .hero-section {
        padding: 100px 0 25px !important;
    }
    
    .hero-section h1 {
        font-size: 1.25rem !important;
        line-height: 1.2;
        margin-bottom: 0.75rem !important;
    }
    
    .hero-section .lead {
        font-size: 0.75rem !important;
    }
    
    .welcome-message h2 {
        font-size: 1rem !important;
    }
    
    .welcome-message p {
        font-size: 0.7rem !important;
    }
    
    .search-box {
        padding: 12px 10px !important;
        margin-top: 8px !important;
    }
    
    .search-row .form-select-lg,
    .search-row .form-control-lg {
        font-size: 0.65rem !important;
        padding: 0.35rem 0.5rem !important;
    }
    
    /* Override HTML margin classes */
    .action-buttons-row.mb-3 {
        margin-bottom: 0.1rem !important;
    }
    
    .action-buttons-row {
        margin-bottom: 0.1rem !important;
    }
    
    .action-buttons-row .btn-lg {
        font-size: 0.5rem !important;
        padding: 0.18rem 0.4rem !important;
        line-height: 1.2 !important;
    }
    
    .action-buttons-row .btn i {
        font-size: 0.45rem !important;
        margin-right: 0.25rem !important;
    }
    
    /* Make level buttons closer to action buttons */
    .level-buttons-row {
        margin-top: 0.2rem !important;
    }
    
    /* Override mb-1 on label */
    .level-buttons-row .mb-1 {
        margin-bottom: 0.32rem !important;
    }
    
    .level-buttons-row .text-white.small {
        font-size: clamp(0.58rem, 0.5rem + 0.4vw, 0.68rem) !important;
        margin-bottom: 0 !important;
        letter-spacing: 0.035em;
    }
    
    .level-buttons-row .d-flex {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: clamp(0.35rem, 0.9vw, 0.5rem) !important;
        width: 100%;
        max-width: min(100%, 420px);
        margin: 0 auto;
        align-items: stretch !important;
    }

    .level-buttons-row .btn-level-filter {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        min-width: 0 !important;
        min-height: clamp(32px, 3.9vw, 38px);
        padding: clamp(0.36rem, 0.8vw, 0.46rem) clamp(0.44rem, 0.9vw, 0.62rem) !important;
        font-size: clamp(0.62rem, 0.54rem + 0.25vw, 0.72rem) !important;
        line-height: 1.12 !important;
        text-align: center;
        white-space: nowrap;
        letter-spacing: 0;
    }
    
    /* Reviews section - smaller with proportional content */
    .reviews-section {
        padding: 20px 0 !important;
    }
    
    .reviews-section h2 {
        font-size: 0.85rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .reviews-section h2 i {
        font-size: 0.8rem !important;
    }
    
    /* Discover what parents are saying - smaller */
    .reviews-section p.text-center.text-muted {
        font-size: 0.65rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .reviews-section .container {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .reviews-section .reviews-masonry {
        column-count: 2 !important;
        column-gap: 6px !important;
        margin-top: 0.75rem !important;
    }
    
    .reviews-section .review-card {
        margin-bottom: 0.5rem !important;
        border-radius: 8px !important;
    }

    .reviews-section .review-content,
    .reviews-section .review-school-chip,
    .reviews-section .review-card-footer-bar {
        padding: 0.45rem 0.6rem !important;
    }

    .reviews-section .review-user-info {
        gap: 0.4rem !important;
    }

    .reviews-section .review-user-name {
        font-size: 0.7rem !important;
    }

    .reviews-section .review-date {
        font-size: 0.58rem !important;
    }

    .reviews-section .review-text {
        font-size: 0.65rem !important;
        line-height: 1.4 !important;
    }

    /* Mobile: Smaller "Show Original" button in review container */
    .reviews-section .review-show-original-btn {
        font-size: 0.6rem !important;
        margin-top: 0.15rem !important;
    }

    .reviews-section .review-show-original-btn i {
        font-size: 0.55rem !important;
    }

    .reviews-section .review-school-link {
        font-size: 0.65rem !important;
        margin-bottom: 0.1rem !important;
    }

    .reviews-section .review-school-link i {
        font-size: 0.6rem !important;
    }

    .reviews-section .review-school-address {
        font-size: 0.58rem !important;
    }

    .reviews-section .review-school-address i {
        font-size: 0.55rem !important;
    }

    .reviews-section .review-action-btn {
        font-size: 0.6rem !important;
        gap: 0.2rem !important;
        padding: 0.18rem 0.28rem !important;
    }

    .reviews-section .review-action-btn i {
        font-size: 0.55rem !important;
    }
    
    /* View details and view all schools buttons - smaller */
    .btn-primary.btn-sm,
    .btn-warning.btn-sm {
        font-size: 0.6rem !important;
        padding: 0.3rem 0.5rem !important;
    }
    
    .btn-primary.btn-sm i,
    .btn-warning.btn-sm i {
        font-size: 0.55rem !important;
    }
    
    .btn-outline-primary {
        font-size: 0.65rem !important;
        padding: 0.35rem 0.6rem !important;
    }
    
    .btn-outline-primary i {
        font-size: 0.6rem !important;
    }
    
    /* Based on verified reviews and ratings - smaller */
    .top-schools-section p.text-center.text-muted {
        font-size: 0.65rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Ranking badge (#1, #2, etc.) - smaller */
    .top-schools-section .position-absolute.top-0.start-0.m-2 {
        margin: 0.5rem !important;
    }
    
    .top-schools-section .badge.bg-warning.fs-6 {
        font-size: 0.6rem !important;
        padding: 0.3rem 0.6rem !important;
    }
    
    .top-schools-section .badge.bg-warning.fs-6 i {
        font-size: 0.55rem !important;
        margin-right: 0.25rem !important;
    }
    
    /* School level badge - smaller for featured and top schools */
    .featured-section .school-level-badge-bottom,
    .top-schools-section .school-level-badge-bottom {
        bottom: 0.5rem !important;
        left: 0.5rem !important;
    }
    
    .featured-section .school-level-badge,
    .top-schools-section .school-level-badge,
    .featured-section .school-level-badge-bottom .badge,
    .top-schools-section .school-level-badge-bottom .badge {
        font-size: 0.5rem !important;
        padding: 0.25rem 0.6rem !important;
    }
    
    /* School carousel - smaller */
    .school-carousel-container {
        padding: 0 20px !important;
    }
    
    .carousel-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.85rem !important;
    }
    
    .school-item .card {
        margin-bottom: 0.75rem !important;
    }
    
    .school-item .card-body {
        padding: 0.75rem !important;
    }
    
    .school-item h5,
    .school-item h6 {
        font-size: 0.75rem !important;
    }
    
    .school-item .school-card-image {
        height: 120px !important;
    }
    
    .school-card-heart-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.75rem !important;
    }
    
    .school-card-labels .badge {
        font-size: 0.6rem !important;
        padding: 0.2rem 0.4rem !important;
    }
    
    /* Featured section - smaller with proportional content */
    .featured-section {
        padding: 25px 0 !important;
    }
    
    .featured-section h2 {
        font-size: 0.85rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .featured-section h2 i {
        font-size: 0.8rem !important;
    }
    
    .featured-section p {
        font-size: 0.65rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Featured school cards - smaller with proportional content */
    .featured-section .school-card {
        margin-bottom: 0.6rem !important;
    }
    
    .featured-section .school-card .card-body {
        padding: 0.6rem !important;
    }
    
    .featured-section .school-card h5 {
        font-size: 0.7rem !important;
        margin-bottom: 0.4rem !important;
    }
    
    .featured-section .school-card .text-muted,
    .featured-section .school-card small {
        font-size: 0.6rem !important;
    }
    
    .featured-section .school-card .text-muted i {
        font-size: 0.55rem !important;
    }
    
    .featured-section .school-card-image {
        height: 100px !important;
    }
    
    .featured-section .school-card-labels .badge {
        font-size: 0.55rem !important;
        padding: 0.15rem 0.35rem !important;
    }
    
    .featured-section .school-card-labels .badge i {
        font-size: 0.5rem !important;
    }
    
    .featured-section .school-card .btn-sm {
        font-size: 0.6rem !important;
        padding: 0.3rem 0.5rem !important;
    }
    
    .featured-section .school-card .btn-sm i {
        font-size: 0.55rem !important;
    }
    
    .featured-section .school-rating-display {
        padding: 0.4rem 0.6rem !important;
    }
    
    .featured-section .school-rating-score .rating-number {
        font-size: 0.95rem !important;
    }
    
    .featured-section .school-rating-stars i {
        font-size: 0.6rem !important;
    }
    
    /* Top schools section - smaller with proportional content */
    .top-schools-section {
        padding: 25px 0 !important;
    }
    
    .top-schools-section h2 {
        font-size: 0.85rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .top-schools-section h2 i {
        font-size: 0.8rem !important;
    }
    
    .top-schools-section .school-card {
        margin-bottom: 0.6rem !important;
    }
    
    .top-schools-section .school-card .card-body {
        padding: 0.6rem !important;
    }
    
    .top-schools-section .school-card h5 {
        font-size: 0.7rem !important;
        margin-bottom: 0.4rem !important;
    }
    
    .top-schools-section .school-card .text-muted,
    .top-schools-section .school-card small {
        font-size: 0.6rem !important;
    }
    
    .top-schools-section .school-card .text-muted i {
        font-size: 0.55rem !important;
    }
    
    .top-schools-section .school-card-image {
        height: 100px !important;
    }
    
    .top-schools-section .school-card-labels .badge {
        font-size: 0.55rem !important;
        padding: 0.15rem 0.35rem !important;
    }
    
    .top-schools-section .school-card-labels .badge i {
        font-size: 0.5rem !important;
    }
    
    .top-schools-section .school-card .btn-sm {
        font-size: 0.6rem !important;
        padding: 0.3rem 0.5rem !important;
    }
    
    .top-schools-section .school-card .btn-sm i {
        font-size: 0.55rem !important;
    }
    
    .top-schools-section .school-rating-display {
        padding: 0.4rem 0.6rem !important;
    }
    
    .top-schools-section .school-rating-score .rating-number {
        font-size: 0.95rem !important;
    }
    
    .top-schools-section .school-rating-stars i {
        font-size: 0.6rem !important;
    }
    
    /* Page headings */
    h1, h2, h3 {
        font-size: 0.9rem !important;
    }
    
    /* Buttons */
    .btn {
        font-size: 0.7rem !important;
        padding: 0.35rem 0.6rem !important;
    }
    
    .btn i {
        font-size: 0.65rem !important;
    }
}

/* Homepage Level Filter Buttons */
.btn-level-filter {
    transition: all 0.3s ease;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: none;
    line-height: 1.4;
    text-transform: none;
}

.btn-level-filter:hover {
    background-color: var(--primary-orange) !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-level-filter:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Ensure proper alignment of level buttons */
.col-12.mt-2 .text-center {
    width: 100%;
}

.col-12.mt-2 .d-flex {
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 auto;
}

.col-12.mt-2 .text-center .mb-1 {
    margin-bottom: 0.25rem !important;
}

/* Compact search box spacing */
.search-box .row.g-2 > * {
    padding-top: calc(var(--bs-gutter-y) * 0.5);
    padding-bottom: calc(var(--bs-gutter-y) * 0.5);
}

/* School Carousel Styles */
.school-carousel-container {
    position: relative;
    padding: 0 60px;
}

.school-carousel-wrapper {
    width: 100%;
    overflow: hidden;
}

.school-carousel {
    display: flex;
    transition: transform 0.6s ease-in-out;
    will-change: transform;
}

.school-item {
    flex-shrink: 0;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    background: rgba(79, 163, 247, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.carousel-btn:hover {
    background: rgba(79, 163, 247, 1);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.carousel-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.carousel-btn-prev-featured,
.carousel-btn-prev-top {
    left: 10px;
}

.carousel-btn-next-featured,
.carousel-btn-next-top {
    right: 10px;
}

/* Welcome Message Animation */
.animate-fade-in {
    animation: fadeIn 0.8s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive adjustments */
/* iPad Pro specific (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .featured-section .school-item,
    .top-schools-section .school-item {
        width: calc(50% - 15px) !important;
        margin-right: 15px !important;
    }
    
    .school-carousel-container {
        padding: 0 50px;
    }
}

/* Tablet portrait / compact desktop home layout */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .hero-section {
        padding: 124px 0 52px !important;
    }

    .hero-section.hero-with-image {
        background-attachment: scroll !important;
    }

    .hero-section h1 {
        font-size: clamp(2.65rem, 4vw, 3.1rem) !important;
        line-height: 1.1 !important;
        max-width: 26ch;
        margin-left: auto;
        margin-right: auto;
        word-break: keep-all;
        text-wrap: balance;
    }

    .hero-section .container {
        max-width: 980px;
    }

    .search-box {
        max-width: 920px;
        padding: 22px 24px;
        margin-top: 18px;
    }

    .search-row .d-flex {
        gap: 0.75rem;
    }

    .state-dropdown-wrapper {
        min-width: 170px;
        max-width: 190px;
    }

    .search-box .form-control,
    .search-box .form-select {
        font-size: 0.9rem;
        padding: 0.68rem 1rem;
    }

    .action-buttons-row .d-flex {
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .action-buttons-row .btn {
        min-width: 220px;
        padding: 0.72rem 1rem;
        font-size: 0.82rem;
    }

    .level-buttons-row .text-white.small {
        font-size: 0.76rem;
    }

    .level-buttons-row .d-flex {
        flex-wrap: wrap !important;
        gap: 0.75rem !important;
        justify-content: center !important;
    }

    .level-buttons-row .btn-level-filter {
        min-width: 145px;
        padding: 0.5rem 1rem;
        font-size: 0.78rem;
    }

    .reviews-section .container {
        max-width: 980px;
    }

    .reviews-section .reviews-masonry {
        column-count: 2;
        column-gap: 18px;
    }

    .reviews-section .review-card {
        margin-bottom: 18px;
    }
}

@media (max-width: 768px) {
    .school-carousel-container {
        padding: 0 28px;
    }
    
    .school-carousel {
        gap: 0;
    }
    
    .school-item {
        width: 100% !important;
        margin-right: 0 !important;
    }
}

@media (max-width: 576px) {
    .level-buttons-row .d-flex {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-width: min(100%, 252px);
        gap: 0.36rem !important;
    }

    .level-buttons-row .btn-level-filter {
        min-height: 33px;
        padding: 0.34rem 0.28rem !important;
        font-size: 0.54rem !important;
        line-height: 1.05 !important;
    }

    .school-carousel-container {
        padding: 0 18px;
    }

    .school-carousel {
        gap: 0;
    }
    
    .school-item {
        width: 100% !important;
        margin-right: 0 !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .level-buttons-row .text-white.small {
        font-size: 0.58rem !important;
    }

    .level-buttons-row .d-flex {
        max-width: 330px;
        gap: 0.34rem !important;
    }

    .level-buttons-row .btn-level-filter {
        min-height: 30px;
        padding: 0.32rem 0.36rem !important;
        font-size: 0.58rem !important;
    }
}

/* Reviews Masonry Layout — Dianping Style */
.reviews-section {
    background-color: #f8f9fa;
}

.reviews-masonry {
    column-count: 5;
    column-gap: 16px;
    margin-top: 30px;
}

#reviews-load-sentinel {
    height: 1px;
    margin-top: 10px;
}

.review-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    column-break-inside: avoid;
    cursor: pointer;
}

.review-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* Header: School name + Rating */
.review-card-header {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.review-card-school-info {
    flex: 1;
    min-width: 0;
}

.review-card-school-name-link {
    text-decoration: none;
    color: inherit;
    display: inline;
    transition: color 0.2s ease;
}

.review-card-school-name-link:hover .review-card-school-name {
    color: #4fa3f7;
}

.review-card-school-name {
    font-weight: 700;
    font-size: 13px;
    color: #333;
    margin: 0;
    line-height: 1.3;
    display: inline;
    transition: color 0.2s ease;
}

.review-card-school-area {
    font-size: 11px;
    color: #888;
    margin: 0;
    display: inline;
    margin-left: 4px;
}

.review-card-school-rating {
    flex-shrink: 0;
}

.review-card-school-rating .smarttag-score--sm {
    display: flex;
    align-items: baseline;
    gap: 1px;
}

.review-card-school-rating .smarttag-score-value {
    font-size: 14px;
    color: #ff6b35;
    font-weight: 700;
}

.review-card-school-rating .smarttag-score-scale {
    font-size: 11px;
    color: #999;
}

/* Media section (photo or placeholder with title) */
.review-card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #e8e8e8;
    flex-shrink: 0;
}

.review-card-media img,
.review-card-media video {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

/* ── XHS-style text placeholder cards ── */
.review-card-media--placeholder {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    position: relative;
    overflow: hidden;
}

.review-title-placeholder-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    flex: 1;
    display: flex;
    padding: 13px 13px 34px; /* bottom clears the rating badge overlay */
}

.review-title-placeholder {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.55;
    margin: 0;
    word-break: break-word;
    overflow-wrap: break-word;
    width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── D0: Quote / Taupe — warm brown, text pushed to bottom, serif ── */
.rtb-d0 { background: #7b6b5c; }
.rtb-d0::before {
    content: '\201C';
    position: absolute;
    top: 4px;
    left: 10px;
    font-size: 58px;
    color: rgba(255, 255, 255, 0.22);
    font-family: Georgia, serif;
    line-height: 1;
    pointer-events: none;
    z-index: 1;
}
.rtb-d0 .review-title-placeholder-wrapper {
    align-items: flex-start;
    padding-top: 46px;
}
.rtb-d0 .review-title-placeholder {
    color: #ffffff;
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
    text-align: left;
}

/* ── D1: Blush — soft pink, italic, vertically centered ── */
.rtb-d1 { background: linear-gradient(155deg, #ffe8f0 0%, #ffcadf 100%); }
.rtb-d1 .review-title-placeholder-wrapper { align-items: center; }
.rtb-d1 .review-title-placeholder {
    color: #7a1235;
    font-style: italic;
    text-align: center;
}

/* ── D2: Ink — deep dark, white, right-aligned, bottom ── */
.rtb-d2 { background: linear-gradient(160deg, #1a1925 0%, #2c2a42 100%); }
.rtb-d2 .review-title-placeholder-wrapper { align-items: flex-start; }
.rtb-d2 .review-title-placeholder {
    color: #e8e8ff;
    text-align: right;
    letter-spacing: 0.02em;
    font-weight: 700;
}

/* ── D3: Garden — sage green, dark text, top-left ── */
.rtb-d3 { background: linear-gradient(145deg, #e9f5ec 0%, #cde9d3 100%); }
.rtb-d3 .review-title-placeholder-wrapper { align-items: flex-start; }
.rtb-d3 .review-title-placeholder {
    color: #1b4332;
    text-align: left;
}

/* ── D4: Cream — warm honey, heavy, centered ── */
.rtb-d4 { background: linear-gradient(140deg, #fff9ec 0%, #ffe8a0 100%); }
.rtb-d4 .review-title-placeholder-wrapper { align-items: center; }
.rtb-d4 .review-title-placeholder {
    color: #4a2e00;
    font-weight: 900;
    text-align: center;
}

.review-card-play-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2;
    font-size: 38px;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

/* Translation toggle for title/media */
.review-card-translation-toggle {
    padding: 6px 12px;
    border-bottom: 1px solid #f0f0f0;
    text-align: right;
    display: none; /* Hidden as per new design */
}

.review-card-translation-toggle .review-show-original-btn {
    color: #888 !important;
}

/* Smaller translation button in comment section */
.review-card-translate-toggle {
    color: #aaa !important;
}

.review-card-translate-toggle:hover {
    color: #666 !important;
}

/* Review title section (shown only when title exists) */
.review-card-title-section {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.review-card-title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Rating tag overlaid on media (bottom-left) */
.review-card-media .review-rating-tag {
    position: absolute;
    bottom: 7px;
    left: 7px;
    z-index: 2;
    display: inline-flex;
    align-items: baseline;
    gap: 1px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.review-card-media .review-rating-tag .review-rating-value {
    color: #4fa3f7;
    font-size: 12px;
}

.review-card-media .review-rating-tag .review-rating-scale {
    color: #999;
    font-size: 9px;
    font-weight: 500;
}


/* Review comment */
.review-content {
    padding: 10px 12px 8px;
    flex: 1;
}

.review-text {
    color: #555;
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer: User info + Actions */
.review-card-footer {
    padding: 10px 12px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.review-user-section {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.review-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e8e8e8;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}

.review-user-details {
    min-width: 0;
    flex: 1;
}

.review-user-name {
    font-weight: 600;
    font-size: 12px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.review-date {
    font-size: 11px;
    color: #aaa;
    display: block;
    white-space: nowrap;
}

.review-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 1200px) {
    .reviews-masonry { column-count: 4; column-gap: 14px; }
}

@media (max-width: 992px) {
    .reviews-masonry { column-count: 3; column-gap: 12px; }
}

@media (max-width: 768px) {
    .reviews-masonry { column-count: 2; column-gap: 10px; }
}

@media (max-width: 520px) {
    .reviews-masonry { column-count: 1; }
}

/* Review Actions (inside footer bar) */
.review-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}

.review-action-btn {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 3px 5px;
    border-radius: 4px;
}

.review-action-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.review-action-btn i {
    font-size: 12px;
}

.review-action-btn.helpful-btn.helpful {
    color: #17a2b8;
}

.review-action-btn.helpful-btn.helpful i {
    color: #17a2b8;
}

.content-report-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid #f2c2bd;
    background: #fff8f7;
    color: #c24b41;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.content-report-btn:hover {
    background: #fdeceb;
    color: #a5342b;
    transform: translateY(-1px);
}

.content-report-btn i {
    font-size: 0.72rem;
}

.content-report-btn.reported {
    background: #fdeceb;
    border-color: #ebb1ab;
    color: #a5342b;
}

.action-count {
    font-size: 11px;
    font-weight: 500;
}

/* Review Detail Modal — split-panel (dianping style) */
.review-detail-modal .modal-dialog {
    max-width: 920px;
    width: 95vw;
}

.review-detail-modal .modal-content {
    height: 88vh;
    max-height: 680px;
    overflow: hidden;
    position: relative;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

.review-detail-modal .modal-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.rdm-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    background: rgba(0,0,0,0.42);
    filter: invert(1) brightness(2);
    opacity: 0.85;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    padding: 4px;
}

.rdm-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* Left: media panel */
.rdm-left {
    flex: 0 0 55%;
    background: #111;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rdm-media-container {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rdm-media-slide {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rdm-media-slide img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.rdm-media-slide video {
    max-width: 100%;
    max-height: 100%;
}

.rdm-left-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 32px;
    text-align: center;
}

.rdm-media-prev,
.rdm-media-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.42);
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    font-size: 13px;
    transition: background 0.2s;
}

.rdm-media-prev:hover,
.rdm-media-next:hover { background: rgba(0,0,0,0.7); }
.rdm-media-prev { left: 10px; }
.rdm-media-next { right: 10px; }

.rdm-media-nav {
    position: absolute;
    bottom: 12px;
    left: 0; right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 3;
}

.rdm-media-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    border: none;
    padding: 0;
    transition: background 0.2s;
}

.rdm-media-dot.active { background: white; }

/* Right: scrollable content */
.rdm-right {
    flex: 0 0 45%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #f0f0f0;
}

.rdm-author-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.rdm-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.rdm-user-name {
    font-weight: 600;
    font-size: 14px;
    color: #222;
}

.rdm-rating-date {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
}

.rdm-date {
    font-size: 12px;
    color: #999;
}

.rdm-comment {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    line-height: 1.65;
    color: #333;
    flex-shrink: 0;
}

.review-title {
    margin: 6px 0 0 0 !important;
    padding: 0 !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
    line-height: 1.5;
    display: block;
    overflow-wrap: break-word;
    word-break: break-all;
    min-width: 0;
}

.review-comment-wrapper {
    margin-top: 6px !important;
    overflow-wrap: break-word;
    word-break: break-all;
    min-width: 0;
}

.review-comment-text {
    margin: 0 !important;
    font-size: 12px;
    line-height: 1.55;
    color: #555;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-all;
    min-width: 0;
}

.review-detail-text {
    font-size: 13px;
    line-height: 1.65;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.rdm-school-card {
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
    flex-shrink: 0;
}

.rdm-school-card a {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    text-decoration: none;
    color: #333;
    font-size: 13px;
}

.rdm-school-card a i {
    color: #4fa3f7;
    margin-top: 2px;
    flex-shrink: 0;
}

.rdm-school-card a:hover { text-decoration: underline; color: #4fa3f7; }

.rdm-school-name {
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.rdm-school-address {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 2px;
    font-weight: 400;
}

.rdm-actions {
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

.rdm-replies {
    padding: 8px 12px;
    flex: 1;
    background: #fafafa;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Compact reply items scoped to the modal */
.rdm-replies .review-reply-item {
    font-size: 0.75rem !important;
    padding-bottom: 8px;
}
.rdm-replies .review-reply-item img.rounded-circle {
    width: 22px !important;
    height: 22px !important;
}
.rdm-replies .review-reply-item strong {
    font-size: 0.72rem !important;
}
.rdm-replies .review-reply-item small,
.rdm-replies .review-reply-item .text-muted {
    font-size: 0.62rem !important;
}
.rdm-replies .review-reply-item p,
.rdm-replies .reply-message-text {
    font-size: 0.72rem !important;
    line-height: 1.35 !important;
    margin-bottom: 4px !important;
}
.rdm-replies .reply-to-reply-btn,
.rdm-replies .show-all-nested-replies-btn,
.rdm-replies .show-more-nested-btn {
    font-size: 0.62rem !important;
}
.rdm-replies .nested-replies-container {
    margin-left: 16px;
    padding-top: 4px;
}
.rdm-replies .review-reply-item .d-flex.align-items-start {
    gap: 6px !important;
}
.rdm-replies .review-reply-item .d-flex.align-items-center.gap-2 {
    gap: 4px !important;
    margin-bottom: 2px !important;
}
.rdm-replies .nested-replies-container .review-reply-item {
    margin-bottom: 8px;
}

/* Replies (reuse existing classes within rdm-replies) */
.review-detail-replies {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.review-replies-list {
    margin-top: 4px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.review-reply-form {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

.review-reply-form .input-group {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-radius: 20px;
    overflow: hidden;
    background: white;
}

.review-reply-form .form-control {
    border: 1px solid #e0e0e0;
    border-right: none;
    border-radius: 20px 0 0 20px;
    padding: 4px 10px;
    font-size: 0.8rem;
}

.review-reply-form .form-control:focus { border-color: #4fa3f7; box-shadow: none; }

.review-reply-form .btn {
    border-radius: 0 20px 20px 0;
    border-left: none;
    padding: 4px 12px;
    font-size: 0.8rem;
}

.review-reply-item {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 12px;
    margin-bottom: 0;
}

.review-reply-item:last-child { border-bottom: none; padding-bottom: 0; }

.nested-replies-container .review-reply-item {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 12px;
}

.nested-replies-container .review-reply-item:last-child { margin-bottom: 0; }

.show-more-replies-btn { transition: color 0.2s ease; }
.show-more-replies-btn:hover { color: #4fa3f7 !important; text-decoration: underline !important; }

.reply-form-container {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

.reply-form-container .input-group {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-radius: 20px;
    overflow: hidden;
    background: white;
}

.reply-form-container .form-control {
    border: 1px solid #e0e0e0;
    border-right: none;
    border-radius: 20px 0 0 20px;
    padding: 6px 12px;
    font-size: 0.875rem;
}

.reply-form-container .form-control:focus { border-color: #4fa3f7; box-shadow: none; }

.reply-form-container .btn {
    border-radius: 0 20px 20px 0;
    border-left: none;
    padding: 6px 14px;
}

.nested-replies-container {
    margin-top: 0;
    margin-left: 20px;
    padding-top: 8px;
}

.nested-replies-container .nested-replies-container { margin-left: 0; padding-top: 0; }

/* Mobile: stack vertically */
@media (max-width: 767.98px) {
    .review-detail-modal .modal-dialog {
        max-width: 100%;
        width: 100%;
        margin: 0;
        height: 100%;
        align-items: flex-end;
    }

    .review-detail-modal .modal-content {
        height: 93vh;
        max-height: none;
        border-radius: 16px 16px 0 0;
        display: flex;
        flex-direction: column;
    }

    .rdm-layout { flex-direction: column; }

    .rdm-left {
        flex: 0 0 auto;
        height: min(52vw, 260px);
        width: 100%;
    }

    .rdm-right { flex: 1; min-height: 0; }
}

.hero-with-image { background-position: center; }
.school-card-image { aspect-ratio: 16 / 10; overflow: hidden; }
.school-card-image > img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 991.98px) {
    .hero-with-image { background-attachment: scroll !important; }
}
