/**
 * components.css
 * FROZEN reusable component classes built on top of design-system.css
 * tokens. Later agents: APPEND new rules below the marker at the bottom
 * of this file — do not edit anything above it.
 */

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
    line-height: 1.2;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-rose-500), var(--color-rose-600));
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.btn-outline {
    background: transparent;
    border-color: var(--color-rose-500);
    color: var(--color-rose-600);
}

.btn-outline:hover {
    background: var(--color-blush-50);
    text-decoration: none;
}

.btn-gold {
    background: linear-gradient(135deg, var(--color-gold-400), var(--color-gold-500));
    color: var(--color-plum-900);
}

.btn-danger {
    background: var(--color-error);
    color: #fff;
}

.btn-danger:hover {
    opacity: 0.92;
    text-decoration: none;
}

.btn-sm {
    padding: 0.4rem 1rem;
    font-size: var(--font-size-sm);
}

.btn-block {
    display: flex;
    width: 100%;
}

/* ===== Card ===== */
.card {
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-5);
    border: 1px solid var(--color-border);
}

.card-flush {
    padding: 0;
    overflow: hidden;
}

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-xs);
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    background: var(--color-blush-100);
    color: var(--color-rose-600);
    line-height: 1.6;
}

/* Discount badge: intentionally the most visually prominent element in
   the whole system per product requirements — bold gold/red gradient,
   subtle pulse, larger than a normal badge. */
.badge-discount {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-size-sm);
    font-weight: 800;
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #ff6b81, var(--color-gold-400));
    color: #fff;
    box-shadow: 0 3px 10px rgba(216, 74, 103, 0.35);
    animation: badge-discount-pulse 2.2s ease-in-out infinite;
}

@keyframes badge-discount-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

.badge-verified {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--color-plum-800);
    background: var(--color-gold-300);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
}

.badge-verified::before {
    content: "✓";
    font-weight: 900;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 700;
    font-size: var(--font-size-sm);
    color: var(--color-plum-800);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--color-border);
    background: #fff;
    color: var(--color-text-main);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-rose-400);
    box-shadow: 0 0 0 3px var(--color-blush-100);
}

.form-textarea {
    resize: vertical;
    min-height: 6rem;
}

.form-error {
    color: var(--color-error);
    font-size: var(--font-size-sm);
    margin-top: var(--space-1);
}

.form-hint {
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    margin-top: var(--space-1);
}

/* ===== Modal ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(51, 19, 39, 0.55);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    padding: 0;
}

@media (min-width: 768px) {
    .modal-backdrop {
        align-items: center;
        padding: var(--space-5);
    }
}

.modal {
    background: var(--color-bg-card);
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-6) var(--space-5);
    box-shadow: var(--shadow-lg);
    max-height: 88vh;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .modal {
        border-radius: var(--radius-xl);
    }
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: var(--space-4);
    inset-inline: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    z-index: 2000;
    pointer-events: none;
    padding: 0 var(--space-4);
}

.toast {
    pointer-events: auto;
    max-width: 420px;
    width: 100%;
    background: var(--color-plum-800);
    color: var(--color-text-on-dark);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    animation: toast-in 0.18s ease-out;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.toast-success { background: var(--color-success); }
.toast-error   { background: var(--color-error); }
.toast-info    { background: var(--color-info); }

.toast-close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.8;
    cursor: pointer;
    font-size: var(--font-size-md);
    line-height: 1;
}

/* ===== Bottom nav (mobile tab bar) ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    inset-inline: 0;
    height: var(--bottom-nav-height);
    background: var(--color-bg-card);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    box-shadow: 0 -2px 12px rgba(92, 35, 64, 0.08);
    z-index: 900;
}

@media (min-width: 768px) {
    .bottom-nav { display: none; }
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
    text-decoration: none;
}

.bottom-nav-item.active {
    color: var(--color-rose-600);
    font-weight: 700;
}

.bottom-nav-item .icon {
    font-size: 1.35rem;
    line-height: 1;
}

/* ===== Story ring (IG-style unseen-story gradient ring) ===== */
.story-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    border-radius: var(--radius-full);
    background: var(--gradient-brand);
}

.story-ring.seen {
    background: var(--color-border);
}

.story-ring-inner {
    background: var(--color-bg-card);
    border-radius: var(--radius-full);
    padding: 2px;
}

/* ===== Avatar ===== */
.avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    object-fit: cover;
    background: var(--color-blush-100);
    display: block;
}

.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 72px; height: 72px; }

/* ===== Rating stars ===== */
.rating-stars {
    display: inline-flex;
    gap: 0.15rem;
    color: var(--color-gold-500);
    font-size: var(--font-size-base);
    line-height: 1;
}

.rating-stars .star-empty {
    color: var(--color-border);
}

/* ===== Skeleton loading placeholder ===== */
.skeleton {
    background: linear-gradient(90deg, var(--color-blush-100) 25%, var(--color-blush-50) 37%, var(--color-blush-100) 63%);
    background-size: 400% 100%;
    animation: skeleton-shimmer 1.4s ease infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ===== Grid / flex utilities ===== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
}

.flex {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.flex-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.flex-wrap { flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; justify-content: center; }

/* ===== Spacing utilities ===== */
.mt-1 { margin-top: var(--space-1); } .mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); } .mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); } .mt-6 { margin-top: var(--space-6); }
.mb-1 { margin-bottom: var(--space-1); } .mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); } .mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); } .mb-6 { margin-bottom: var(--space-6); }
.p-0 { padding: 0; }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.w-full { width: 100%; }

/* ===== Phase 2 additions below — APPEND ONLY, do not edit rules above this line ===== */

/* ===== Agent A: Public / discovery pages ===== */

/* ---- Stories bar (horizontal scroll of salon avatars) ---- */
.stories-bar {
    display: flex;
    gap: var(--space-4);
    overflow-x: auto;
    padding: var(--space-2) 0 var(--space-3);
    scrollbar-width: none;
}

.stories-bar::-webkit-scrollbar {
    display: none;
}

.story-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    flex: 0 0 auto;
    width: 72px;
    text-decoration: none;
    text-align: center;
}

.story-bar-name {
    font-size: var(--font-size-xs);
    color: var(--color-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 72px;
}

/* ---- Category filter chips ---- */
.category-chips {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    padding: var(--space-1) 0;
    scrollbar-width: none;
}

.category-chips::-webkit-scrollbar {
    display: none;
}

.category-chip {
    flex: 0 0 auto;
    padding: 0.45rem 1.1rem;
    border-radius: var(--radius-full);
    background: var(--color-bg-card);
    border: 1.5px solid var(--color-border);
    color: var(--color-text-main);
    font-size: var(--font-size-sm);
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
}

.category-chip.active {
    background: var(--gradient-brand);
    color: #fff;
    border-color: transparent;
}

/* ---- Salon card (used on index.php / search.php / map popups) ---- */
.salon-card {
    display: block;
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.salon-card-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--color-blush-100);
    overflow: hidden;
}

.salon-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.salon-card-discount-badge {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
}

.salon-card-fav-btn {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: none;
    background: rgba(255, 255, 255, 0.85);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.salon-card-body {
    padding: var(--space-4);
}

.salon-card-name {
    font-size: var(--font-size-base);
    color: var(--color-plum-800);
}

.salon-card-distance {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
}

/* ---- Salon profile hero ---- */
.salon-hero {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--color-blush-100);
}

.salon-hero-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---- Service card with discount price display ---- */
.service-card {
    padding: var(--space-4);
}

.price-original {
    text-decoration: line-through;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
    margin-inline-end: var(--space-2);
}

.price-discounted {
    color: var(--color-rose-600);
}

/* ---- Gallery grid thumbnails ---- */
.gallery-thumb-link {
    display: block;
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1 / 1;
}

.gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---- Full-screen story viewer (story/view.php) ---- */
.story-progress-container {
    display: flex;
    gap: 4px;
    padding: var(--space-3) var(--space-3) 0;
}

.story-progress-seg {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.story-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
}

.story-viewer-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3);
    color: #fff;
}

.story-viewer-salon-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: #fff;
    text-decoration: none;
}

.story-viewer-close {
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    text-decoration: none;
    padding: var(--space-2);
}

.story-media-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.story-media {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.story-caption {
    color: #fff;
    text-align: center;
    padding: var(--space-3);
    font-size: var(--font-size-sm);
    margin: 0;
}
