﻿/* ============================================
   PERFECT SERVES READ PAGE (SCOPED)
   - No collisions: everything is under .read-perfectserves-page
   - Clean syntax (fixes :root, :not(), accidental spaces, etc.)
   - Keeps modern colorful design + filters + masonry + pagination
   ============================================ */

:root {
    --gin-primary: #BC70A4;
    --gin-secondary: #BFD641;
    --gin-primary-light: #d89bc4;
    --gin-secondary-light: #d4e577;
    --gin-gradient: linear-gradient(135deg, var(--gin-primary) 0%, var(--gin-secondary) 100%);
    --ps-shadow: 0 2px 16px rgba(188,112,164,0.10), 0 1.5px 6px rgba(60,0,40,0.06);
    --ps-shadow-hover: 0 10px 32px rgba(188,112,164,0.18), 0 6px 14px rgba(60,0,40,0.10);
    --ps-soft-bg: #F8ECEA;
    --ps-soft-bg-2: #FFF7FB;
    --ps-text: #222;
    --ps-muted: #8a8a8a;
}

/* =========================================================
   PAGE WRAPPER (scope)
   ========================================================= */
.read-perfectserves-page {
    background: transparent;
}

    /* =========================================================
   HERO (optional – only if used in razor)
   ========================================================= */
    .read-perfectserves-page .read-ps-hero {
        background: var(--gin-gradient);
        padding: 4rem 0 3rem;
        margin-bottom: 2rem;
        border-radius: 0 0 2rem 2rem;
        box-shadow: 0 4px 30px rgba(0, 0, 0, 0.10);
    }

    .read-perfectserves-page .read-ps-hero-title {
        font-size: 3rem;
        font-weight: 800;
        color: #fff;
        text-align: center;
        margin-bottom: 1rem;
        text-shadow: 2px 2px 8px rgba(0,0,0,0.20);
    }

    .read-perfectserves-page .read-ps-hero-subtitle {
        font-size: 1.25rem;
        color: rgba(255,255,255,0.95);
        text-align: center;
        font-weight: 300;
        max-width: 700px;
        margin: 0 auto;
    }

    /* =========================================================
   FILTERS (compatible with your existing markup)
   ========================================================= */
    .read-perfectserves-page .filters-panel {
        background: linear-gradient(180deg, rgba(248,236,234,0.92), rgba(255,255,255,0.92));
        border: 2px solid rgba(188,112,164,0.20);
        border-radius: 16px;
        box-shadow: var(--ps-shadow);
        padding: 16px 18px;
    }

        /* Pending glow */
        .read-perfectserves-page .filters-panel.pending {
            border-color: rgba(191,214,65,0.65);
            box-shadow: 0 2px 16px rgba(191,214,65,0.22), 0 1.5px 6px rgba(60,0,40,0.06);
        }

        /* Align columns like all-gins */
        .read-perfectserves-page .filters-panel .row.g-3.align-items-end > [class*="col-"] {
            display: flex;
            flex-direction: column;
        }

    /* Icon inputs (same pattern as all-gins) */
    .read-perfectserves-page .input-with-icon,
    .read-perfectserves-page .select-with-icon {
        position: relative;
    }

        .read-perfectserves-page .input-with-icon > i,
        .read-perfectserves-page .select-with-icon > i {
            position: absolute;
            top: 50%;
            left: 12px;
            transform: translateY(-50%);
            color: var(--ps-muted);
            pointer-events: none;
        }

        .read-perfectserves-page .input-with-icon > .form-control,
        .read-perfectserves-page .select-with-icon > .form-select {
            padding-left: 36px;
        }

    /* Inputs look */
    .read-perfectserves-page .filters-panel .form-control,
    .read-perfectserves-page .filters-panel .form-select {
        border-radius: 10px;
        border: 1.5px solid rgba(188,112,164,0.35);
        background: #fff;
        transition: border-color .15s ease, box-shadow .15s ease;
    }

        .read-perfectserves-page .filters-panel .form-control:focus,
        .read-perfectserves-page .filters-panel .form-select:focus {
            border-color: var(--gin-primary);
            box-shadow: 0 0 0 3px rgba(188,112,164,0.18);
        }

    /* Advanced panel */
    .read-perfectserves-page .filters-advanced {
        background: var(--ps-soft-bg-2);
        border: 1px solid rgba(188,112,164,0.20);
        box-shadow: 0 1px 8px rgba(188,112,164,0.08);
    }

    /* Buttons (you already have btn-gin-* in Gins.css, but keep safe fallback here scoped) */
    .read-perfectserves-page .btn-gin-green {
        background-color: var(--gin-secondary);
        border: 2px solid var(--gin-secondary);
        color: var(--ps-text);
        font-weight: 600;
        box-shadow: 0 2px 8px rgba(191,214,65,0.20);
    }

        .read-perfectserves-page .btn-gin-green:hover {
            filter: brightness(0.98);
            box-shadow: 0 4px 14px rgba(191,214,65,0.24);
        }

    .read-perfectserves-page .btn-gin-ghost {
        background: rgba(248,236,234,0.65);
        border: 1.5px solid rgba(188,112,164,0.25);
        color: #333;
    }

        .read-perfectserves-page .btn-gin-ghost:hover {
            border-color: var(--gin-primary);
        }

    /* Active filters area (chips exist in Gins.css; these are only safe fallbacks scoped) */
    .read-perfectserves-page .chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 10px;
        border-radius: 999px;
        border: 1.5px solid rgba(188,112,164,0.25);
        background: #fff;
        color: #333;
        font-size: .875rem;
        line-height: 1;
    }

    .read-perfectserves-page .chip-accent {
        background: linear-gradient(90deg, rgba(188,112,164,0.10), rgba(191,214,65,0.10));
    }

    /* =========================================================
   STATES (loading / empty)
   ========================================================= */
    .read-perfectserves-page .read-ps-loading {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 320px;
    }

    .read-perfectserves-page .read-ps-empty {
        text-align: center;
        padding: 3rem 1rem;
        color: #95a5a6;
    }

    /* =========================================================
   PAGINATION (scoped)
   ========================================================= */
    .read-perfectserves-page .pagination-nav {
        display: flex;
        justify-content: center;
        margin: 2rem 0;
    }

    .read-perfectserves-page .pagination {
        gap: .5rem;
    }

        .read-perfectserves-page .pagination .page-link {
            border-radius: 0.75rem;
            border: 2px solid #e9ecef;
            color: var(--gin-primary);
            font-weight: 600;
            background: #fff;
            transition: all .2s ease;
        }

        .read-perfectserves-page .pagination .page-item.active .page-link {
            background: var(--gin-gradient);
            color: #fff;
            border-color: transparent;
        }

        .read-perfectserves-page .pagination .page-item .page-link:hover:not(.active) {
            background: var(--gin-primary);
            color: #fff;
            border-color: var(--gin-primary);
            transform: translateY(-1px);
        }

    /* =========================================================
   MASONRY (READ – no collisions)
   ========================================================= */
    .read-perfectserves-page .read-perfectserve-masonry {
        column-count: 3;
        column-gap: 22px;
        padding: 6px 4px 18px;
    }

@media (min-width: 1400px) {
    .read-perfectserves-page .read-perfectserve-masonry {
        column-count: 4;
    }
}

@media (max-width: 992px) {
    .read-perfectserves-page .read-perfectserve-masonry {
        column-count: 2;
    }
}

@media (max-width: 576px) {
    .read-perfectserves-page .read-perfectserve-masonry {
        column-count: 1;
    }
}

.read-perfectserves-page .read-ps-tile {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    margin: 0 0 22px;
}

/* Tile */
.read-perfectserves-page .read-ps-tile-link {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(188,112,164,0.18);
    box-shadow: var(--ps-shadow);
    transition: transform .16s ease, box-shadow .20s ease;
}

    .read-perfectserves-page .read-ps-tile-link:hover {
        transform: translateY(-2px);
        box-shadow: var(--ps-shadow-hover);
    }

/* Image: keep natural ratio (irregulars are fine) */
.read-perfectserves-page .read-ps-tile-img {
    width: 100%;
    height: auto;
    display: block;
    image-rendering: auto;
    backface-visibility: hidden;
    transform: translateZ(0);
    /* subtle enhancement without degrading */
    filter: saturate(1.02) contrast(1.02);
}

/* Footer / title pill */
.read-perfectserves-page .read-ps-tile-footer {
    padding: 12px 12px 14px;
}

.read-perfectserves-page .read-ps-tile-title {
    display: -webkit-box; /* required for line-clamp */
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; /* max 2 lines */
    overflow: hidden;
    /* remove the single-line behavior */
    white-space: normal;
    text-overflow: ellipsis;
    /* keep your pill style */
    max-width: 100%;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #222;
    background: linear-gradient(180deg, #ffffff, #fff7fb);
    border: 1px solid rgba(188,112,164,0.22);
    box-shadow: 0 2px 10px rgba(188,112,164,0.08);
    /* optional: stable height so masonry feels less “jumpy” */
    line-height: 1.2;
    min-height: calc(1.2em * 2); /* reserve 2 lines */
}

/* Add at the end of the file (scoped) */
.read-perfectserves-page .read-ps-tile {
    position: relative;
}

.read-perfectserves-page .read-ps-tile-top {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    pointer-events: none; /* only button is clickable */
}

.read-perfectserves-page .read-ps-edit-btn {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(188,112,164,0.22);
    box-shadow: 0 2px 10px rgba(188,112,164,0.12);
    color: #BC70A4;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}

    .read-perfectserves-page .read-ps-edit-btn:hover {
        transform: translateY(-1px);
        background: #fff;
        box-shadow: 0 10px 20px rgba(188,112,164,0.18);
        color: #222;
    }

/* =========================================================
   Filters row alignment (match all-gins layout)
   ========================================================= */


/* Important: keep icons vertically centered with the 44px controls */
.read-perfectserves-page .input-with-icon > i,
.read-perfectserves-page .select-with-icon > i {
    top: 50%;
    transform: translateY(-50%);
}

/* Keep controls same height in header filters */
.read-perfectserves-page .filters-panel .form-control,
.read-perfectserves-page .filters-panel .form-select,
.read-perfectserves-page .filters-panel .filters-actions .btn {
    height: 44px;
}

/* Add at the end of the file (scoped) */
.read-perfectserves-page .filters-summary-bar {
    gap: 12px;
}

.read-perfectserves-page .apply-btn.apply-armed {
    box-shadow: 0 0 0 3px rgba(191,214,65,0.25), 0 8px 22px rgba(191,214,65,0.18);
}

/* =========================================================
   PerfectServe card footer hierarchy
   - Primary: gin name
   - Secondary: tonic
   ========================================================= */

.read-perfectserves-page .read-ps-tile-footer {
    padding: 12px 12px 14px;
    display: grid;
    gap: 6px;
}

/* Primary line: Gin name (2 lines max) */
.read-perfectserves-page .read-ps-gin-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 1.02rem;
    font-weight: 900;
    letter-spacing: 0.01em;
    line-height: 1.15;
    color: #1f1f1f;
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff, #fff7fb);
    border: 1px solid rgba(188,112,164,0.22);
    box-shadow: 0 2px 10px rgba(188,112,164,0.08);
}

/* Secondary line: Tonic (1 line max, subtle) */
.read-perfectserves-page .read-ps-tonic {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1;
    color: rgba(34,34,34,0.70);
    background: rgba(248,236,234,0.55);
    border: 1px solid rgba(188,112,164,0.16);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .read-perfectserves-page .read-ps-tonic i {
        color: rgba(188,112,164,0.75);
        flex: 0 0 auto;
    }

/* Optional: remove/neutralize old title style if still present somewhere */
.read-perfectserves-page .read-ps-tile-title {
    display: none;
}

/* =========================================================
   PerfectServe cards – premium dark backdrop + tonic ellipsis
   Add this block at the VERY END of the file
   ========================================================= */

/* 1) Dark premium backdrop behind the masonry area */
.read-perfectserves-page .read-perfectserve-masonry {
    /* Dark, slightly tinted to match your palette */
    background: radial-gradient(1200px 700px at 15% 10%, rgba(188,112,164,0.22) 0%, rgba(0,0,0,0.00) 55%), radial-gradient(1100px 650px at 85% 25%, rgba(191,214,65,0.16) 0%, rgba(0,0,0,0.00) 55%), linear-gradient(180deg, #0b0b10 0%, #0a0a0e 55%, #08080c 100%);
    border-radius: 18px;
    padding: 18px 14px 22px; /* override earlier padding to create the “panel” */
    box-shadow: 0 18px 60px rgba(0,0,0,0.30);
}

/* Optional: a subtle inner border so it feels “contained” */
.read-perfectserves-page .read-perfectserve-masonry {
    border: 1px solid rgba(255,255,255,0.06);
}

/* 2) Make cards pop more on dark background */
.read-perfectserves-page .read-ps-tile-link {
    background: rgba(255,255,255,0.94);
    border-color: rgba(255,255,255,0.10);
    box-shadow: 0 10px 28px rgba(0,0,0,0.22), 0 2px 10px rgba(0,0,0,0.12);
}

    .read-perfectserves-page .read-ps-tile-link:hover {
        box-shadow: 0 18px 48px rgba(0,0,0,0.34), 0 10px 22px rgba(0,0,0,0.18);
    }

/* 3) Tonic: force one-line truncation with ellipsis (robust) */
.read-perfectserves-page .read-ps-tonic {
    min-width: 0; /* IMPORTANT in flex containers */
    max-width: 100%;
}

    .read-perfectserves-page .read-ps-tonic,
    .read-perfectserves-page .read-ps-tonic * {
        min-width: 0; /* ensure children can shrink */
    }

.read-perfectserves-page .read-ps-tonic {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    /* If tonic contains an icon + text, ensure the text truncates properly */
    .read-perfectserves-page .read-ps-tonic i {
        flex: 0 0 auto;
    }

.read-perfectserves-page .read-ps-tonic {
    display: flex;
    align-items: center;
    gap: 6px;
}

    .read-perfectserves-page .read-ps-tonic > :not(i) {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

/* Footer layout */
.read-perfectserves-page .read-ps-tile-footer {
    display: grid;
    gap: 6px;
}

/* Gin name: clamp 2 lines on the inner span */
.read-perfectserves-page .read-ps-gin-name {
    width: 100%;
}

.read-perfectserves-page .read-ps-gin-name-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

/* Tonic: one-line ellipsis on inner span */
.read-perfectserves-page .read-ps-tonic {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0; /* critical */
}

.read-perfectserves-page .read-ps-tonic-text {
    display: block;
    min-width: 0; /* critical */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}