/**
 * Alixa Bridge - Drug Detail Page Styles
 *
 * RTL-first design. Mobile-first responsive layout.
 *
 * @since 0.7.0
 */

/* =========================================================
   Container
   ========================================================= */

.alixa-drug-detail {
    max-width: 900px;
    margin: 32px auto;
    padding: 24px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    font-family: Tahoma, "IRANSans", "Vazirmatn", "Segoe UI", sans-serif;
    color: #2c3e50;
    line-height: 1.7;
}

.alixa-drug-detail--error {
    max-width: 600px;
    padding: 40px 24px;
    text-align: center;
    color: #7f1d1d;
    background: #fef2f2;
    border-color: #fecaca;
}

/* =========================================================
   Media (image)
   ========================================================= */

.alixa-drug-detail__media {
    margin-bottom: 24px;
    text-align: center;
}

.alixa-drug-detail__image {
    max-width: 100%;
    max-height: 400px;
    height: auto;
    border-radius: 8px;
    border: 1px solid #f0f0f0;
}

.alixa-drug-detail__image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 200px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8edf3 100%);
    border-radius: 8px;
    border: 2px dashed #cbd5e0;
    color: #94a3b8;
    font-size: 14px;
}


/* =========================================================
   Image link wrapper (for clickable main image)
   ========================================================= */

.alixa-drug-detail__image-link {
    display: inline-block;
    cursor: zoom-in;
    transition: transform 0.15s;
}

.alixa-drug-detail__image-link:hover {
    transform: scale(1.01);
}

/* =========================================================
   Thumbnails (multi-image gallery)
   ========================================================= */

.alixa-drug-detail__thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f4f8;
}

.alixa-drug-detail__thumb {
    display: block;
    width: 64px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    transition: all 0.15s;
}

.alixa-drug-detail__thumb:hover,
.alixa-drug-detail__thumb:focus {
    border-color: #0ea5e9;
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.2);
}

.alixa-drug-detail__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* =========================================================
   Gallery container (multi-image)
   ========================================================= */

.alixa-drug-detail__gallery {
    text-align: center;
}

/* =========================================================
   Thumbnail interactive states
   ========================================================= */

.alixa-drug-detail__thumb {
    background: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

.alixa-drug-detail__thumb.is-active {
    border-color: #0ea5e9;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35);
}

.alixa-drug-detail__thumb.is-active img {
    opacity: 1;
}

.alixa-drug-detail__thumb:not(.is-active) img {
    opacity: 0.85;
}

.alixa-drug-detail__thumb:focus {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

@media (max-width: 600px) {
    .alixa-drug-detail__thumb {
        width: 56px;
        height: 56px;
    }
}

/* =========================================================
   Header (names)
   ========================================================= */

.alixa-drug-detail__header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f4f8;
}

.alixa-drug-detail__name-fa {
    margin: 0 0 6px 0;
    font-size: 24px;
    font-weight: 700;
    color: #1e3a5f;
}

.alixa-drug-detail__name-en {
    margin: 0;
    font-size: 14px;
    color: #64748b;
    font-style: italic;
    letter-spacing: 0.3px;
}

/* =========================================================
   Rows (label + value)
   ========================================================= */

.alixa-drug-detail__row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #f7f9fb;
}

.alixa-drug-detail__row:last-of-type {
    border-bottom: none;
}

.alixa-drug-detail__label {
    flex: 0 0 auto;
    min-width: 100px;
    font-weight: 600;
    color: #475569;
    font-size: 14px;
}

.alixa-drug-detail__value {
    flex: 1;
    color: #1e3a5f;
    font-size: 15px;
}

.alixa-drug-detail__value small {
    color: #94a3b8;
    font-size: 12px;
}

.alixa-drug-detail__muted {
    color: #94a3b8;
    font-style: italic;
}

/* =========================================================
   Commerce (price + stock)
   ========================================================= */

.alixa-drug-detail__commerce {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
}

.alixa-drug-detail__price {
    flex: 1 1 200px;
    font-size: 18px;
}

.alixa-drug-detail__price .alixa-drug-detail__value {
    font-weight: 700;
    color: #0077a8;
    font-size: 22px;
}

.alixa-drug-detail__price small {
    font-size: 12px;
    font-weight: 400;
    color: #64748b;
}

.alixa-drug-detail__stock {
    flex: 0 0 auto;
}

.alixa-drug-detail__badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.alixa-drug-detail__badge--in-stock {
    background: #cdeefb;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alixa-drug-detail__badge--out-of-stock {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* =========================================================
   Tags (chips)
   ========================================================= */

.alixa-drug-detail__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 16px 0;
}

.alixa-drug-detail__chip {
    display: inline-block;
    padding: 4px 12px;
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-radius: 16px;
    font-size: 12px;
}

/* =========================================================
   Identifiers (collapsible)
   ========================================================= */

.alixa-drug-detail__identifiers {
    margin: 20px 0;
    padding: 12px 16px;
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.alixa-drug-detail__identifiers summary {
    cursor: pointer;
    font-weight: 600;
    color: #475569;
    font-size: 14px;
    padding: 4px 0;
}

.alixa-drug-detail__identifiers summary:hover {
    color: #1e3a5f;
}

.alixa-drug-detail__identifiers dl {
    margin: 12px 0 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 8px 16px;
}

.alixa-drug-detail__identifiers dt {
    font-weight: 600;
    color: #64748b;
    font-size: 13px;
}

.alixa-drug-detail__identifiers dd {
    margin: 0;
    font-size: 13px;
    word-break: break-all;
}

.alixa-drug-detail__identifiers code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #334155;
}

/* =========================================================
   Sync info
   ========================================================= */

.alixa-drug-detail__sync {
    margin: 16px 0 0 0;
    padding-top: 12px;
    border-top: 1px solid #f0f4f8;
    font-size: 12px;
    color: #94a3b8;
    text-align: left;
}

.alixa-drug-detail__sync time {
    font-family: monospace;
    direction: ltr;
    display: inline-block;
}

/* =========================================================
   Actions
   ========================================================= */

.alixa-drug-detail__actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 2px solid #f0f4f8;
}

.alixa-drug-detail__btn {
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.alixa-drug-detail__btn--cart {
    background: #0ea5e9;
    color: #fff;
}

.alixa-drug-detail__btn--cart:hover:not(:disabled) {
    background: #0284c7;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.alixa-drug-detail__btn:disabled {
    background: #cbd5e0;
    color: #94a3b8;
    cursor: not-allowed;
}

/* =========================================================
   Responsive (mobile-first considerations)
   ========================================================= */

@media (max-width: 600px) {
    .alixa-drug-detail {
        margin: 16px;
        padding: 16px;
    }

    .alixa-drug-detail__name-fa {
        font-size: 20px;
    }

    .alixa-drug-detail__row {
        flex-direction: column;
        gap: 2px;
    }

    .alixa-drug-detail__label {
        min-width: auto;
    }

    .alixa-drug-detail__commerce {
        flex-direction: column;
        align-items: flex-start;
    }

    .alixa-drug-detail__identifiers dl {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .alixa-drug-detail__identifiers dt {
        margin-top: 8px;
    }
}
/* ============================================================
   Active add-to-cart section on detail page (Phase 7.6)
   Overrides the placeholder disabled button styles
   ============================================================ */
.alixa-drug-detail__cart {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.alixa-drug-detail__qty-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}
.alixa-drug-detail__qty-input {
    width: 70px;
    height: 36px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    -moz-appearance: textfield;
}
.alixa-drug-detail__qty-input::-webkit-outer-spin-button,
.alixa-drug-detail__qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.alixa-drug-detail__qty-input:focus {
    outline: none;
    border-color: #0096c7;
    box-shadow: 0 0 0 2px rgba(44, 122, 78, 0.15);
}

/* Override the disabled placeholder style for active cart button */
.alixa-drug-detail__btn--cart.alixa-detail-cart-add {
    background: #0096c7;
    color: #fff;
    border: none;
    padding: 0.55rem 1.4rem;
    border-radius: 8px;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    opacity: 1;
}
.alixa-drug-detail__btn--cart.alixa-detail-cart-add:hover {
    background: #0077a8;
}
.alixa-drug-detail__btn--cart.alixa-detail-cart-add:active {
    transform: scale(0.98);
}
.alixa-drug-detail__btn--cart.alixa-detail-cart-add:disabled {
    background: #6b7280;
    cursor: default;
    opacity: 0.85;
}