/**
 * E-Shop Connector — Structural CSS
 * Minimal layout styles. Theme should override colors, fonts, spacing.
 */

/* ─── Grid ──────────────────────────────────────────────────────── */

.eshop-grid {
    display: grid;
    gap: 1.25rem;
}

.eshop-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.eshop-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.eshop-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .eshop-grid--cols-3,
    .eshop-grid--cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .eshop-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Product Card ──────────────────────────────────────────────── */

.eshop-product-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--eshop-border, #e5e7eb);
    border-radius: var(--eshop-radius, 8px);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.eshop-product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.eshop-product-card__image img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.eshop-product-card__body {
    padding: 0.75rem 1rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.eshop-product-card__title {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    line-height: 1.3;
}

.eshop-product-card__price {
    margin: 0 0 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--eshop-price-color, inherit);
}

.eshop-product-card__price-original {
    margin: -0.4rem 0 0.5rem;
    text-decoration: line-through;
    opacity: 0.5;
    font-size: 0.9rem;
}

.eshop-product-card__actions {
    margin-top: auto;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ─── Category Card ─────────────────────────────────────────────── */

.eshop-category-card {
    border: 1px solid var(--eshop-border, #e5e7eb);
    border-radius: var(--eshop-radius, 8px);
    overflow: hidden;
    text-align: center;
}

.eshop-category-card__image img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
}

.eshop-category-card__body {
    padding: 0.75rem 1rem;
}

.eshop-category-card__title {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.eshop-category-card__count {
    font-size: 0.85rem;
    opacity: 0.6;
}

/* ─── Product Detail ────────────────────────────────────────────── */

.eshop-product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1000px;
}

@media (max-width: 768px) {
    .eshop-product-detail {
        grid-template-columns: 1fr;
    }
}

.eshop-product-detail__gallery {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.eshop-product-detail__image {
    width: 100%;
    border-radius: var(--eshop-radius, 8px);
}

.eshop-product-detail__image--main {
    border: 1px solid var(--eshop-border, #e5e7eb);
}

.eshop-product-detail__title {
    margin: 0 0 0.5rem;
}

.eshop-product-detail__price {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 1rem;
    color: var(--eshop-price-color, inherit);
}

.eshop-product-detail__attributes {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 1rem;
    margin: 1rem 0;
}

.eshop-product-detail__attributes dt {
    font-weight: 600;
}

.eshop-product-detail__cart-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.eshop-qty-input {
    width: 4rem;
    padding: 0.5rem;
    text-align: center;
    border: 1px solid var(--eshop-border, #e5e7eb);
    border-radius: var(--eshop-radius, 8px);
}

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

.eshop-btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: var(--eshop-radius, 8px);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: opacity 0.2s;
    line-height: 1.4;
}

.eshop-btn:hover {
    opacity: 0.85;
}

.eshop-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.eshop-btn--detail {
    background: var(--eshop-btn-secondary-bg, #f3f4f6);
    color: var(--eshop-btn-secondary-color, #374151);
}

.eshop-btn--add-to-cart {
    background: var(--eshop-btn-primary-bg, #3b82f6);
    color: var(--eshop-btn-primary-color, #fff);
}

.eshop-btn--added {
    background: var(--eshop-btn-success-bg, #10b981);
}

.eshop-btn--large {
    padding: 0.65rem 1.75rem;
    font-size: 1rem;
}

.eshop-btn--apply-filters {
    background: var(--eshop-btn-primary-bg, #3b82f6);
    color: var(--eshop-btn-primary-color, #fff);
    width: 100%;
    margin-top: 0.75rem;
}

.eshop-btn--reset-filters {
    background: var(--eshop-btn-secondary-bg, #f3f4f6);
    color: var(--eshop-btn-secondary-color, #374151);
    width: 100%;
    margin-top: 0.25rem;
}

/* ─── Filters Panel ─────────────────────────────────────────────── */

.eshop-filters {
    padding: 1rem;
    border: 1px solid var(--eshop-border, #e5e7eb);
    border-radius: var(--eshop-radius, 8px);
}

.eshop-filters__title {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

.eshop-filters__group {
    border: none;
    padding: 0;
    margin: 0 0 1rem;
}

.eshop-filters__group-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    padding: 0;
}

.eshop-filters__option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0;
    cursor: pointer;
    font-size: 0.9rem;
}

.eshop-filters__option input {
    margin: 0;
}

.eshop-filters__range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.eshop-filters__range input {
    width: 5rem;
    padding: 0.4rem;
    border: 1px solid var(--eshop-border, #e5e7eb);
    border-radius: var(--eshop-radius, 8px);
    text-align: center;
}

/* ─── Cart Widget ───────────────────────────────────────────────── */

.eshop-cart-widget {
    position: relative;
    display: inline-block;
}

.eshop-cart-widget__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: var(--eshop-btn-secondary-bg, #f3f4f6);
    border: 1px solid var(--eshop-border, #e5e7eb);
    border-radius: var(--eshop-radius, 8px);
    cursor: pointer;
    font-size: 0.95rem;
}

.eshop-cart-widget__badge {
    background: var(--eshop-btn-primary-bg, #3b82f6);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 1.25rem;
    height: 1.25rem;
    line-height: 1.25rem;
    text-align: center;
    border-radius: 999px;
    padding: 0 0.35rem;
}

.eshop-cart-widget__dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 280px;
    background: var(--eshop-dropdown-bg, #fff);
    border: 1px solid var(--eshop-border, #e5e7eb);
    border-radius: var(--eshop-radius, 8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    padding: 1rem;
}

.eshop-cart-widget__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.9rem;
    gap: 0.5rem;
}

.eshop-cart-widget__item-name {
    flex: 1;
}

.eshop-cart-widget__item-qty {
    opacity: 0.6;
    white-space: nowrap;
}

.eshop-cart-widget__item-price {
    font-weight: 600;
    white-space: nowrap;
}

.eshop-cart-widget__footer {
    border-top: 1px solid var(--eshop-border, #e5e7eb);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    text-align: right;
    font-weight: 700;
}

.eshop-cart-widget__empty {
    text-align: center;
    opacity: 0.6;
    padding: 1rem 0;
}

/* ─── Auth (login / register / logout / account) ───────────────── */

.eshop-btn--primary {
    background: var(--eshop-btn-primary-bg, #3b82f6);
    color: var(--eshop-btn-primary-color, #fff);
}

.eshop-btn--logout {
    background: var(--eshop-btn-secondary-bg, #f3f4f6);
    color: var(--eshop-btn-secondary-color, #374151);
}

.eshop-auth-form {
    max-width: 360px;
}

.eshop-auth-form__row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0 0 0.9rem;
}

.eshop-auth-form__row label {
    font-size: 0.9rem;
    font-weight: 600;
}

.eshop-auth-form__row input {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--eshop-border, #e5e7eb);
    border-radius: var(--eshop-radius, 8px);
}

.eshop-auth-form__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.eshop-auth-form__message {
    font-size: 0.85rem;
    opacity: 0.8;
}

.eshop-auth-form__message--error {
    color: var(--eshop-error-color, #dc2626);
    opacity: 1;
}

.eshop-account-widget {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.eshop-account-widget--guest {
    opacity: 0.7;
}

/* ─── States ────────────────────────────────────────────────────── */

.eshop-loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s;
}

.eshop-error,
.eshop-empty {
    text-align: center;
    padding: 2rem 1rem;
    opacity: 0.6;
}
