/**
 * Raynez Resort & Suites — Shared Premium Room Card
 * Single design source for room cards on home.php, rooms.php and the
 * hero availability search results. Namespaced with `rrc-` to avoid
 * collisions with page-local styles.
 */

:root {
    --rrc-gold: #D4AF37;
    --rrc-gold-soft: rgba(212, 175, 55, 0.14);
    --rrc-black: #0a0a0a;
    --rrc-ink: #121212;
    --rrc-cream: #F7F3EC;
    --rrc-white: #ffffff;
    --rrc-muted: #9a938a;
    /* Gold-tinted rather than a white hairline, so it reads consistently
       whether the card sits on a light or dark page section. */
    --rrc-line: rgba(212, 175, 55, 0.16);
    --rrc-radius: 18px;

    /* Dark mode (default) surface colors — same navy used by the nav/footer */
    --rrc-card-bg: #141d33;
    --rrc-media-bg: linear-gradient(135deg, #1a2540, #0c1220);
    --rrc-title-color: #fff;
    --rrc-text-1: rgba(255, 255, 255, 0.55);   /* meta, rating, amenity chip text */
    --rrc-text-2: rgba(255, 255, 255, 0.42);   /* description */
    --rrc-text-3: rgba(255, 255, 255, 0.35);   /* price label / "was" price */
    --rrc-chip-bg: rgba(255, 255, 255, 0.04);
    --rrc-chip-border: rgba(255, 255, 255, 0.08);
    --rrc-chip-icon-bg: rgba(212, 175, 55, 0.1);
    --rrc-shadow: 0 16px 36px -18px rgba(10, 15, 30, 0.45);
    --rrc-shadow-hover: 0 25px 45px -18px rgba(0, 0, 0, 0.6);
}

html[data-theme="light"] {
    --rrc-card-bg: #ffffff;
    --rrc-media-bg: linear-gradient(135deg, #f8f3e9, #f1e7d3);
    --rrc-title-color: #1a1a1a;
    --rrc-text-1: #4b5563;
    --rrc-text-2: #5b6470;
    --rrc-text-3: #7a7f87;
    --rrc-chip-bg: rgba(17, 24, 39, 0.04);
    --rrc-chip-border: rgba(17, 24, 39, 0.08);
    --rrc-chip-icon-bg: rgba(212, 175, 55, 0.14);
    --rrc-line: rgba(212, 175, 55, 0.25);
    --rrc-shadow: 0 16px 36px -20px rgba(15, 23, 42, 0.18);
    --rrc-shadow-hover: 0 24px 42px -20px rgba(15, 23, 42, 0.2);
}

body.light-mode {
    --rrc-card-bg: #ffffff;
    --rrc-media-bg: linear-gradient(135deg, #f8f3e9, #f1e7d3);
    --rrc-title-color: #1a1a1a;
    --rrc-text-1: #4b5563;
    --rrc-text-2: #5b6470;
    --rrc-text-3: #7a7f87;
    --rrc-chip-bg: rgba(17, 24, 39, 0.04);
    --rrc-chip-border: rgba(17, 24, 39, 0.08);
    --rrc-chip-icon-bg: rgba(212, 175, 55, 0.14);
    --rrc-line: rgba(212, 175, 55, 0.25);
    --rrc-shadow: 0 16px 36px -20px rgba(15, 23, 42, 0.18);
    --rrc-shadow-hover: 0 24px 42px -20px rgba(15, 23, 42, 0.2);
}

html[data-theme="light"] .rrc-card,
body.light-mode .rrc-card {
    color: #1f2937;
}

html[data-theme="light"] .rrc-card .rrc-title,
body.light-mode .rrc-card .rrc-title {
    color: #111827;
}

html[data-theme="light"] .rrc-card .rrc-desc,
body.light-mode .rrc-card .rrc-desc {
    color: #4b5563;
}

html[data-theme="light"] .rrc-card .rrc-meta-item,
body.light-mode .rrc-card .rrc-meta-item,
html[data-theme="light"] .rrc-card .rrc-rating,
body.light-mode .rrc-card .rrc-rating {
    color: #374151;
}

html[data-theme="light"] .rrc-card .rrc-price-label,
body.light-mode .rrc-card .rrc-price-label,
html[data-theme="light"] .rrc-card .rrc-price-value small,
body.light-mode .rrc-card .rrc-price-value small {
    color: #4b5563;
}

html[data-theme="light"] .rrc-card .rrc-amenity-chip,
body.light-mode .rrc-card .rrc-amenity-chip {
    color: #374151;
}

.rrc-card {
    position: relative;
    background: var(--rrc-card-bg);
    border: 1px solid var(--rrc-line);
    border-radius: var(--rrc-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* A soft ambient gold glow at rest (not just on hover) so the card reads
       as a premium object sitting on the page, not a flat cutout. */
    box-shadow: var(--rrc-shadow), 0 0 0 1px rgba(212,175,55,0.05), 0 18px 40px -24px rgba(212,175,55,0.25);
    will-change: transform;
    animation: rrcCardReveal 620ms cubic-bezier(.16,1,.3,1) both;
    transition: transform 320ms cubic-bezier(.16,1,.3,1), box-shadow 320ms cubic-bezier(.16,1,.3,1), border-color 320ms ease;
}
.rrc-card:nth-child(2) { animation-delay: 70ms; }
.rrc-card:nth-child(3) { animation-delay: 140ms; }
.rrc-card:nth-child(4) { animation-delay: 210ms; }
.rrc-card:nth-child(5) { animation-delay: 280ms; }
.rrc-card:nth-child(6) { animation-delay: 350ms; }
@keyframes rrcCardReveal {
    from { opacity: 0; transform: translateY(18px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes rrcScrollReveal {
    0% { opacity: 0; transform: translateY(32px) scale(0.97); }
    45% { opacity: 1; }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
.rrc-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--rrc-gold) 25%, #f4e5a1 50%, var(--rrc-gold) 75%, transparent);
    box-shadow: 0 0 12px rgba(212,175,55,0.6);
    opacity: 0.85;
    z-index: 2;
}
.rrc-card:hover, .rrc-card.rz-flap-active {
    /* !important: the entrance animation below (rrcCardReveal, fill-mode
       "both") stays bound to this element's `transform` after it finishes
       playing, and a CSS Animation's value outranks a plain author rule in
       the cascade regardless of specificity — without !important this hover
       transform is silently ignored no matter how it's written. */
    transform: perspective(900px) rotateX(4deg) translateY(-6px) scale(1.015) !important;
    border-color: rgba(212, 175, 55, 0.35);
    box-shadow: var(--rrc-shadow-hover);
}
@media (prefers-reduced-motion: reduce) {
    .rrc-card:hover, .rrc-card.rz-flap-active { transform: none !important; }
}

/* ---------- Media ---------- */
.rrc-media {
    position: relative;
    height: 210px;
    background: var(--rrc-media-bg);
    overflow: hidden;
    flex-shrink: 0;
    isolation: isolate;
}
.rrc-media::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(10, 10, 10, 0.08) 35%, rgba(10, 10, 10, 0.5) 100%);
    opacity: 0.78;
    transition: opacity 420ms ease;
    pointer-events: none;
}
.rrc-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 600ms cubic-bezier(.16,1,.3,1);
}
.rrc-card:hover .rrc-media img { transform: scale(1.07); }
.rrc-card:hover .rrc-media::after { opacity: 0.58; }
.rrc-media-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.1rem;
    color: rgba(212, 175, 55, 0.35);
}

.rrc-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    pointer-events: none;
    z-index: 3;
}
.rrc-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 5px 11px;
    border-radius: 100px;
    white-space: nowrap;
}
.rrc-badge-marketing { background: var(--rrc-gold); color: #0a0a0a; }
.rrc-badge-marketing { animation: rrcBadgePulse 2.8s ease-in-out 900ms infinite; }
.rrc-badge-discount { background: #ef4444; color: #fff; }
.rrc-badge-limited { background: rgba(20, 29, 51, 0.78); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.4); backdrop-filter: blur(4px); }
.rrc-badge-unavailable { background: rgba(20, 29, 51, 0.82); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.4); }

/* ---------- Body ---------- */
.rrc-body {
    padding: 1.25rem 1.25rem 1.35rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    background: var(--rrc-card-bg);
}
.rrc-type {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--rrc-gold);
    margin-bottom: 0.3rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.rrc-type::before {
    content: '';
    width: 18px;
    height: 1px;
    background: var(--rrc-gold);
    opacity: 0.7;
}
.rrc-title {
    color: var(--rrc-title-color);
    font-size: 1.22rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 0 0 0.4rem;
    line-height: 1.28;
}
.rrc-desc {
    color: var(--rrc-text-2);
    font-size: 0.8rem;
    line-height: 1.55;
    margin: 0 0 0.85rem;
}

.rrc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.9rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--rrc-line);
}
.rrc-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.73rem;
    color: var(--rrc-text-1);
}
.rrc-meta-item i,
.rrc-meta-item svg { color: rgba(212, 175, 55, 0.65); font-size: 0.7rem; width: 12px; text-align: center; }

.rrc-amenities {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.rrc-amenity-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--rrc-text-1);
    background: var(--rrc-chip-bg);
    border: 1px solid var(--rrc-chip-border);
    padding: 5px 11px 5px 5px;
    border-radius: 100px;
    transition: border-color 200ms ease, background-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.rrc-amenity-chip:hover {
    background: var(--rrc-gold-soft);
    border-color: rgba(212, 175, 55, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 14px -6px rgba(212, 175, 55, 0.45);
}
.rrc-amenity-chip:hover i,
.rrc-amenity-chip:hover svg { transform: scale(1.1); }
.rrc-amenity-chip i,
.rrc-amenity-chip svg {
    color: #17140e;
    font-size: 0.62rem;
    transition: transform 200ms ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #f4e5a1 0%, var(--rrc-gold) 60%, #b8901f 100%);
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.35);
    padding: 0.34rem;
    box-sizing: border-box;
}
.rrc-amenity-chip-extra { display: none; }
.rrc-amenities.expanded .rrc-amenity-chip-extra { display: inline-flex; animation: rrcChipIn 260ms cubic-bezier(.16,1,.3,1); }
@keyframes rrcChipIn {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}
.rrc-amenity-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.67rem;
    font-weight: 700;
    color: var(--rrc-gold);
    background: var(--rrc-gold-soft);
    border: 1px solid rgba(212, 175, 55, 0.35);
    padding: 4px 10px;
    border-radius: 100px;
    cursor: pointer;
    transition: background 200ms ease, border-color 200ms ease, transform 150ms ease;
}
.rrc-amenity-toggle:hover {
    background: rgba(212, 175, 55, 0.24);
    border-color: rgba(212, 175, 55, 0.55);
    transform: translateY(-1px);
}
.rrc-amenity-toggle i,
.rrc-amenity-toggle svg { color: var(--rrc-gold); font-size: 0.65rem; transition: transform 220ms ease; }
.rrc-amenity-toggle.is-expanded i,
.rrc-amenity-toggle.is-expanded svg { transform: rotate(45deg); }

.rrc-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0.85rem;
    font-size: 0.76rem;
    color: var(--rrc-text-1);
}
.rrc-rating i,
.rrc-rating svg { color: var(--rrc-gold); font-size: 0.68rem; }

.rrc-footer {
    margin-top: auto;
    padding-top: 1rem;
}
.rrc-price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.9rem;
}
.rrc-price-label {
    display: block;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--rrc-text-3);
    margin-bottom: 2px;
}
.rrc-price-value {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    background: linear-gradient(120deg, #f4e5a1 0%, var(--rrc-gold) 55%, #b8901f 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    transition: transform 260ms ease;
}
.rrc-card:hover .rrc-price-value { transform: translateX(2px); }
.rrc-price-value small {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--rrc-text-3);
    text-transform: uppercase;
    margin-left: 3px;
}
.rrc-price-was {
    font-size: 0.76rem;
    color: var(--rrc-text-3);
    text-decoration: line-through;
    margin-right: 6px;
}

.rrc-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}
.rrc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none !important;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 200ms ease;
    white-space: nowrap;
    min-height: 42px;
}
.rrc-btn-outline {
    background: rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.28);
    color: var(--rrc-gold) !important;
}
.rrc-btn-outline:hover { background: rgba(212, 175, 55, 0.16); }
.rrc-btn-solid {
    background: linear-gradient(135deg, #f4e5a1 0%, var(--rrc-gold) 55%, #b8901f 100%);
    color: #17140e !important;
    box-shadow: 0 6px 16px -6px rgba(212, 175, 55, 0.5);
}
.rrc-btn-solid:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 8px 20px -6px rgba(212, 175, 55, 0.65); }
.rrc-btn:focus-visible,
.rrc-amenity-toggle:focus-visible {
    outline: 3px solid rgba(212, 175, 55, 0.45);
    outline-offset: 2px;
}

/* ---------- Layout variants ---------- */

/* Grid: used by rooms.php listing */
.rrc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.75rem;
}

/* Featured: horizontal-scroll card used by home.php (fixed width tile) */
.rrc-card--featured {
    flex: 0 0 300px;
    scroll-snap-align: start;
}
.rrc-card--featured .rrc-media { height: 190px; }

/* Compact: horizontal row used by the hero search results popup */
.rrc-card--compact {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-radius: 13px;
}
.rrc-card--compact .rrc-media {
    width: 84px;
    height: 84px;
    flex-shrink: 0;
    border-radius: 11px;
}
.rrc-card--compact .rrc-body { padding: 0; flex: 1; min-width: 0; }
.rrc-card--compact .rrc-desc { display: none; }
.rrc-card--compact .rrc-footer { border-top: none; padding-top: 0.5rem; }
.rrc-card--compact .rrc-actions { grid-template-columns: 1fr; }

@keyframes rrcBadgePulse {
    0%, 72%, 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); }
    82% { box-shadow: 0 0 0 5px rgba(212, 175, 55, 0.16); }
}

@media (prefers-reduced-motion: reduce) {
    .rrc-card,
    .rrc-badge-marketing,
    .rrc-media img,
    .rrc-media::after,
    .rrc-price-value {
        animation: none;
        transition: none;
    }
    .rrc-card:hover { transform: none; }
}

@media (max-width: 600px) {
    .rrc-card {
        animation-duration: 700ms;
    }
}

@supports (animation-timeline: view()) {
    @media (max-width: 600px) {
        .rrc-card {
            animation-name: rrcScrollReveal;
            animation-duration: 1ms;
            animation-timeline: view(block 12% 8%);
            animation-range: entry 0% cover 38%;
            animation-fill-mode: both;
        }
        .rrc-card:nth-child(n) { animation-delay: 0ms; }
    }
}

@media (max-width: 480px) {
    .rrc-grid { grid-template-columns: 1fr; gap: 1.1rem; }
    .rrc-card--featured { flex: 0 0 82vw; }
    .rrc-actions { grid-template-columns: 1fr 1fr; }
}
