/* =============================================================
   passenger/feedback.css
   Ride Feedback & Rating System — passenger-side styles.
   Follows LiphtUp design tokens (--gy-green, --gy-border, etc.)
   defined in css/style.css.  All classes are namespaced with
   `fb-` to avoid collisions with existing Bootstrap / LiphtUp styles.
   Compatible with both web-PWA and Android Capacitor WebView.
   ============================================================= */

/* ---------------------------------------------------------------
   Feedback modal card (shown over the modal-layer backdrop)
   Uses the same .modal-layer pattern as #passenger-payment-view
--------------------------------------------------------------- */
.fb-card {
    position: relative;
    width: 100%;
    max-width: 380px;
    max-height: calc(100vh - 80px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent iOS/Android overscroll bounce from escaping */
    overscroll-behavior: contain;
}

.fb-card-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* iOS momentum scroll */
    padding: 24px 20px 20px;
}

/* ---------------------------------------------------------------
   Card header row (back arrow + close ×)
--------------------------------------------------------------- */
.fb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.fb-back-btn,
.fb-close-btn {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(26, 122, 46, 0.18);
    background: rgba(255, 255, 255, 0.94);
    color: var(--gy-muted);
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.fb-back-btn:hover,
.fb-back-btn:focus,
.fb-close-btn:hover,
.fb-close-btn:focus {
    background: #fff;
    transform: scale(1.06);
    outline: none;
}

.fb-back-btn:focus-visible,
.fb-close-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(26, 122, 46, 0.22);
}

.fb-back-btn.d-invisible {
    visibility: hidden;
    pointer-events: none;
}

/* ---------------------------------------------------------------
   Step containers
--------------------------------------------------------------- */
.fb-step {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.fb-step.fb-active {
    display: flex;
}

/* ---------------------------------------------------------------
   Step 1 — Thank you (appears on payment receipt card)
   These styles target the injected buttons inside the receipt card.
--------------------------------------------------------------- */
.fb-rate-btn {
    display: block;
    width: 100%;
    padding: 13px;
    background: var(--gy-green);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 14px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.18s, transform 0.12s;
}

.fb-rate-btn:active {
    transform: scale(0.98);
    background: #145e23;
}

.fb-maybe-later-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: none;
    border: none;
    color: var(--gy-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    margin-top: 4px;
    -webkit-tap-highlight-color: transparent;
}

/* ---------------------------------------------------------------
   Step 2 — Experience illustration + title
--------------------------------------------------------------- */
.fb-illustration {
    width: 88px;
    height: 88px;
    margin: 0 auto 12px;
    display: block;
}

.fb-illustration-spin {
    animation: fb-spin 1s linear infinite;
}

.fb-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--gy-text);
    margin: 0 0 4px;
    line-height: 1.25;
}

.fb-subtitle {
    font-size: 13px;
    color: var(--gy-muted);
    margin: 0 0 20px;
}

/* ---------------------------------------------------------------
   Experience chips grid (2×2)
--------------------------------------------------------------- */
.fb-exp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    margin-bottom: 18px;
}

.fb-exp-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px 12px;
    border: 2px solid var(--gy-border);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s, transform 0.12s;
    -webkit-tap-highlight-color: transparent;
    /* Large touch target for mobile */
    min-height: 80px;
}

.fb-exp-chip:active {
    transform: scale(0.97);
}

.fb-exp-chip img {
    width: 44px;
    height: 44px;
    pointer-events: none;
}

.fb-exp-chip span {
    font-size: 12px;
    font-weight: 700;
    color: var(--gy-muted);
}

/* Selected states per experience level */
.fb-exp-chip[data-exp="poor"].fb-selected {
    border-color: #E53E3E;
    background: #FEF2F2;
}
.fb-exp-chip[data-exp="poor"].fb-selected span { color: #E53E3E; }

.fb-exp-chip[data-exp="decent"].fb-selected {
    border-color: #F59E0B;
    background: #FFFBEB;
}
.fb-exp-chip[data-exp="decent"].fb-selected span { color: #D97706; }

.fb-exp-chip[data-exp="good"].fb-selected {
    border-color: #22C55E;
    background: #F0FDF4;
}
.fb-exp-chip[data-exp="good"].fb-selected span { color: #16A34A; }

.fb-exp-chip[data-exp="loved"].fb-selected {
    border-color: #1A7A2E;
    background: #EAF8ED;
}
.fb-exp-chip[data-exp="loved"].fb-selected span { color: #1A7A2E; }

/* ---------------------------------------------------------------
   Anonymous note (bottom of experience step)
--------------------------------------------------------------- */
.fb-anon-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: var(--gy-green-soft);
    border-radius: 10px;
    text-align: left;
    font-size: 12px;
    color: #1A7A2E;
    font-weight: 500;
    line-height: 1.4;
    margin-top: 0;
    width: 100%;
}

.fb-anon-note svg {
    flex-shrink: 0;
    margin-top: 1px;
}

/* ---------------------------------------------------------------
   Step 3 — Secondary reasons
--------------------------------------------------------------- */
.fb-reasons-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--gy-text);
    text-align: left;
    width: 100%;
    margin: 0 0 2px;
}

.fb-reasons-subtitle {
    font-size: 12px;
    color: var(--gy-muted);
    text-align: left;
    width: 100%;
    margin: 0 0 14px;
}

.fb-count-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--gy-green);
    text-align: right;
    width: 100%;
    margin: -10px 0 10px;
}

.fb-count-label.fb-maxed {
    color: #F59E0B;
}

.fb-reasons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    margin-bottom: 18px;
}

.fb-reason-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    border: 1.5px solid var(--gy-border);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--gy-text);
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    text-align: center;
    line-height: 1.3;
    min-height: 44px; /* accessible touch target */
}

.fb-reason-chip:active {
    transform: scale(0.97);
}

.fb-reason-chip.fb-selected {
    border-color: var(--gy-green);
    background: #EAF8ED;
    color: var(--gy-green);
}

.fb-reason-chip.fb-selected::before {
    content: "✓";
    font-size: 11px;
    font-weight: 800;
    color: var(--gy-green);
    flex-shrink: 0;
}

.fb-reason-chip.fb-disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

/* Validation error message */
.fb-validation-msg {
    font-size: 12px;
    color: #E53E3E;
    text-align: left;
    width: 100%;
    margin: -10px 0 8px;
    min-height: 16px;
}

/* ---------------------------------------------------------------
   Submit button (step 3)
--------------------------------------------------------------- */
.fb-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: var(--gy-green);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.18s, transform 0.12s, opacity 0.18s;
    margin-top: 2px;
}

.fb-submit-btn:active:not(:disabled) {
    transform: scale(0.98);
    background: #145e23;
}

.fb-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Mini spinner inside submit button */
.fb-btn-spinner {
    width: 17px;
    height: 17px;
    border: 2.5px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fb-spin 0.7s linear infinite;
    flex-shrink: 0;
}

/* ---------------------------------------------------------------
   Step 4 — Loading
--------------------------------------------------------------- */
.fb-loading-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 12px 0 8px;
    width: 100%;
}

/* ---------------------------------------------------------------
   Step 5 — Success
--------------------------------------------------------------- */
.fb-success-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 8px 0 16px;
    width: 100%;
}

.fb-success-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--gy-text);
    margin: 0;
    line-height: 1.2;
}

.fb-success-sub {
    font-size: 13px;
    color: var(--gy-muted);
    margin: 0;
    line-height: 1.5;
}

.fb-done-btn {
    display: block;
    width: 100%;
    padding: 13px;
    background: var(--gy-green);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.18s, transform 0.12s;
}

.fb-done-btn:active {
    transform: scale(0.98);
    background: #145e23;
}

/* ---------------------------------------------------------------
   Minimized feedback banner (floating strip over the map)
--------------------------------------------------------------- */
.fb-minimized-banner {
    position: fixed;
    bottom: 76px; /* above bottom-nav */
    left: 12px;
    right: 12px;
    max-width: 440px;
    margin: 0 auto;
    z-index: 2500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1.5px solid var(--gy-green);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    /* Slide-up animation */
    animation: fb-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.fb-minimized-banner.d-none {
    display: none !important;
}

.fb-minimized-banner:active {
    transform: scale(0.985);
}

.fb-minimized-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.fb-minimized-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: #EAF8ED;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.fb-minimized-text {
    flex: 1;
    min-width: 0;
}

.fb-minimized-text strong {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--gy-text);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fb-minimized-text span {
    font-size: 11px;
    color: var(--gy-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fb-minimized-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.fb-minimized-expand-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #EAF8ED;
    color: var(--gy-green);
    border: 1px solid rgba(26, 122, 46, 0.2);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
    transition: background 0.15s;
}

.fb-minimized-expand-chip svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

.fb-minimized-close {
    width: 28px;
    height: 28px;
    border: 1px solid var(--gy-border);
    background: #f8fafc;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 14px;
    color: var(--gy-muted);
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.fb-minimized-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* ---------------------------------------------------------------
   Keyframes
--------------------------------------------------------------- */
@keyframes fb-spin {
    to { transform: rotate(360deg); }
}

@keyframes fb-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------
   Safe area support (iOS notch / Android cutouts in Capacitor)
--------------------------------------------------------------- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .fb-minimized-banner {
        bottom: calc(72px + env(safe-area-inset-bottom));
    }
    .fb-card-scroll {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* ---------------------------------------------------------------
   Responsive tweaks for small screens (< 360 wide, typical
   Android budget phones)
--------------------------------------------------------------- */
@media (max-width: 360px) {
    .fb-exp-grid {
        gap: 8px;
    }
    .fb-exp-chip {
        padding: 10px 8px;
        min-height: 72px;
    }
    .fb-exp-chip img {
        width: 38px;
        height: 38px;
    }
    .fb-reasons-grid {
        gap: 6px;
    }
    .fb-title {
        font-size: 16px;
    }
}
