/* ═══════════════════════════════════════════════════════
   PHARMACY — Public pages (landing, catalog, product)
   ═══════════════════════════════════════════════════════ */

:root {
    --ph-primary: #0f172a;
    --ph-accent: #059669;
    --ph-accent-light: #d1fae5;
    --ph-accent-dark: #047857;
    --ph-success: #16a34a;
    --ph-warning: #d97706;
    --ph-bg: #f0fdf4;
    --ph-surface: #ffffff;
    --ph-text: #1e293b;
    --ph-secondary: #64748b;
    --ph-border: #e2e8f0;
    --ph-radius: 12px;
    --ph-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--ph-font);
    background: var(--ph-bg);
    color: var(--ph-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── View Transitions API ───────────────── */

::view-transition-old(root) { animation: phVtOut 0.15s ease-out both; }
::view-transition-new(root) { animation: phVtIn 0.2s ease-in both; }
@keyframes phVtOut { to { opacity: 0; } }
@keyframes phVtIn  { from { opacity: 0; } }

.ph-header { view-transition-name: header; }
::view-transition-group(header) { animation: none; }

.ph-fade-in { animation: phFadeIn 0.25s ease; }
@keyframes phFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Header ─────────────────────────────── */

.ph-header {
    background: var(--ph-surface);
    border-bottom: 1px solid var(--ph-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.ph-header-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ph-logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--ph-accent);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ph-logo svg { width: 24px; height: 24px; }

.ph-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ph-nav a {
    font-size: 13px;
    font-weight: 500;
    color: var(--ph-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.ph-nav a:hover { color: var(--ph-accent); }

/* ── Main ───────────────────────────────── */

.ph-main { flex: 1; }

/* ── Footer ─────────────────────────────── */

.ph-footer {
    background: var(--ph-surface);
    border-top: 1px solid var(--ph-border);
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--ph-secondary);
    margin-top: auto;
}

.ph-footer a { color: inherit; text-decoration: underline; }

/* ── Hero ────────────────────────────────── */

.ph-hero {
    background: linear-gradient(135deg, #064e3b 0%, #059669 100%);
    color: #fff;
    padding: 80px 16px;
    text-align: center;
}

.ph-hero-inner {
    max-width: 720px;
    margin: 0 auto;
}

.ph-hero h1 {
    font-size: clamp(28px, 5vw, 44px);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 16px;
}

.ph-hero h1 em {
    font-style: normal;
    color: #a7f3d0;
}

.ph-hero p {
    font-size: clamp(15px, 2.5vw, 18px);
    opacity: 0.9;
    line-height: 1.6;
    max-width: 560px;
    margin: 0 auto 32px;
}

.ph-hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────── */

.ph-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: inherit;
}

.ph-btn--primary {
    background: #fff;
    color: #059669;
}

.ph-btn--primary:hover {
    background: #d1fae5;
}

.ph-btn--outline {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.4);
}

.ph-btn--outline:hover {
    border-color: #fff;
    background: rgba(255,255,255,0.1);
}

.ph-btn--accent {
    background: var(--ph-accent);
    color: #fff;
}

.ph-btn--accent:hover {
    background: var(--ph-accent-dark);
}

/* ── Features grid ──────────────────────── */

.ph-features {
    max-width: 1120px;
    margin: 0 auto;
    padding: 64px 16px;
}

.ph-features h2 {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 48px;
}

.ph-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.ph-feature-card {
    background: var(--ph-surface);
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius);
    padding: 28px;
    transition: box-shadow 0.2s;
}

.ph-feature-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.ph-feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--ph-accent-light);
    color: var(--ph-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.ph-feature-icon svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.ph-feature-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.ph-feature-card p {
    font-size: 14px;
    color: var(--ph-secondary);
    line-height: 1.5;
}

/* ── Why section ─────────────────────────── */

.ph-why {
    background: var(--ph-surface);
    padding: 64px 16px;
}

.ph-why-inner {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

.ph-why h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 32px;
}

.ph-why-list {
    list-style: none;
    display: grid;
    gap: 16px;
    text-align: left;
}

.ph-why-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 15px;
    line-height: 1.5;
}

.ph-why-list li svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    color: var(--ph-accent);
}

/* ── CTA bottom ──────────────────────────── */

.ph-cta-bottom {
    background: linear-gradient(135deg, #064e3b 0%, #059669 100%);
    color: #fff;
    text-align: center;
    padding: 64px 16px;
}

.ph-cta-bottom h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
}

/* ── Catalog ─────────────────────────────── */

.ph-catalog {
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 16px 64px;
}

.ph-catalog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 32px;
}

.ph-catalog-header h1 {
    font-size: 24px;
    font-weight: 700;
}

.ph-search-box {
    position: relative;
    max-width: 400px;
    width: 100%;
}

.ph-search-box input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--ph-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--ph-surface);
    transition: border-color 0.15s;
}

.ph-search-box input:focus {
    outline: none;
    border-color: var(--ph-accent);
    box-shadow: 0 0 0 3px var(--ph-accent-light);
}

.ph-search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--ph-secondary);
    pointer-events: none;
}

/* ── Product grid ────────────────────────── */

.ph-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.ph-product-card {
    background: var(--ph-surface);
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.ph-product-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.ph-product-thumb {
    aspect-ratio: 1;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.ph-product-thumb::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 40%, #e2e8f0 80%);
    background-size: 200% 100%;
    animation: phShimmer 1.4s ease-in-out infinite;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.ph-product-thumb.is-loaded::before {
    opacity: 0;
    pointer-events: none;
}

.ph-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.ph-product-thumb.is-loaded img {
    opacity: 1;
}

.ph-product-thumb svg {
    width: 48px;
    height: 48px;
    color: #cbd5e1;
    position: relative;
    z-index: 2;
}

@keyframes phShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.ph-product-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ph-product-body h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
}

.ph-product-meta {
    font-size: 13px;
    color: var(--ph-secondary);
    margin-bottom: 12px;
}

.ph-product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.ph-product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--ph-accent-dark);
}

.ph-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ph-badge--rx {
    background: #fef3c7;
    color: #92400e;
}

.ph-badge--otc {
    background: var(--ph-accent-light);
    color: var(--ph-accent-dark);
}

.ph-badge--stock {
    background: var(--ph-accent-light);
    color: var(--ph-accent-dark);
}

.ph-badge--out {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Product detail ──────────────────────── */

.ph-product-detail {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 16px 64px;
}

.ph-product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.ph-product-image {
    aspect-ratio: 1;
    background: var(--ph-surface);
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ph-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ph-product-image svg {
    width: 80px;
    height: 80px;
    color: #cbd5e1;
}

.ph-product-info h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.ph-product-info .ph-product-meta {
    margin-bottom: 16px;
}

.ph-product-info .ph-product-price {
    font-size: 28px;
    margin-bottom: 16px;
}

.ph-product-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.ph-info-table {
    width: 100%;
    border-collapse: collapse;
}

.ph-info-table tr {
    border-bottom: 1px solid var(--ph-border);
}

.ph-info-table td {
    padding: 10px 0;
    font-size: 14px;
    vertical-align: top;
}

.ph-info-table td:first-child {
    font-weight: 600;
    color: var(--ph-secondary);
    width: 140px;
    padding-right: 16px;
}

.ph-detail-section {
    background: var(--ph-surface);
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius);
    padding: 24px;
    margin-bottom: 20px;
}

.ph-detail-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.ph-detail-section p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--ph-secondary);
}

.ph-consult-banner {
    background: var(--ph-accent-light);
    border: 1px solid #a7f3d0;
    border-radius: var(--ph-radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--ph-accent-dark);
}

.ph-consult-banner svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* ── Breadcrumb ──────────────────────────── */

.ph-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ph-secondary);
    margin-bottom: 24px;
}

.ph-breadcrumb a {
    color: var(--ph-accent);
    text-decoration: none;
}

.ph-breadcrumb a:hover { text-decoration: underline; }

/* ── Pagination ──────────────────────────── */

.ph-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.ph-pagination a,
.ph-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}

.ph-pagination a {
    color: var(--ph-text);
    background: var(--ph-surface);
    border: 1px solid var(--ph-border);
}

.ph-pagination a:hover {
    border-color: var(--ph-accent);
    color: var(--ph-accent);
}

.ph-pagination .is-active {
    background: var(--ph-accent);
    color: #fff;
    border-color: var(--ph-accent);
}

/* ── Empty state ─────────────────────────── */

.ph-empty {
    text-align: center;
    padding: 64px 16px;
    color: var(--ph-secondary);
}

.ph-empty svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    color: #cbd5e1;
}

.ph-empty p {
    font-size: 15px;
}

/* ── Language panel (reused pattern) ─────── */

.ph-lang-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: var(--ph-secondary);
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
}

.ph-lang-btn:hover {
    background: var(--ph-border);
    color: var(--ph-accent);
}

.ph-lang-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.ph-lang-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.ph-lang-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--ph-surface);
    border-radius: 16px 16px 0 0;
    padding: 20px;
    z-index: 301;
    transform: translateY(100%);
    transition: transform 0.25s ease;
    max-width: 480px;
    margin: 0 auto;
    pointer-events: none;
    visibility: hidden;
}

.ph-lang-panel.is-open {
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
}

.ph-lang-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--ph-text);
    font-size: 15px;
    transition: background 0.15s;
}

.ph-lang-item:hover {
    background: var(--ph-accent-light);
}

.ph-lang-item.is-active {
    font-weight: 600;
    color: var(--ph-accent);
}

/* ── Responsive ──────────────────────────── */

@media (max-width: 768px) {
    .ph-hero { padding: 48px 16px; }

    .ph-features-grid {
        grid-template-columns: 1fr;
    }

    .ph-product-detail-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .ph-catalog-header {
        flex-direction: column;
        align-items: stretch;
    }

    .ph-search-box { max-width: none; }
}

@media (max-width: 375px) {
    .ph-hero h1 { font-size: 24px; }
    .ph-hero-actions { flex-direction: column; }
    .ph-hero-actions .ph-btn { width: 100%; justify-content: center; }
}

/* ── Animations ──────────────────────────── */

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

/* ── Cloak ───────────────────────────────── */

[x-cloak] { display: none !important; }
.announcer { position: absolute; clip: rect(0,0,0,0); height: 1px; width: 1px; overflow: hidden; }
