/* =========================================================
   PS Grupo TDV — Frontend Accessories CSS v2
   Diseño inspirado en patinetestore.com
   ========================================================= */

/* Ocultar input checkbox de forma accesible */
.gtdv-accessory-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
    margin: 0;
}

/* ── Contenedor principal ─────────────────────────────── */
.gtdv-accessories-section {
    margin-top: 18px;
    margin-bottom: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    clear: both;
    display: block;
    float: none !important;
    overflow: hidden;
}

/* ── Grupo ────────────────────────────────────────────── */
.gtdv-group-container {
    margin-bottom: 14px;
    border: 1px solid #dde1e8;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* ── Header del grupo ─────────────────────────────────── */
.gtdv-group-title {
    background: var(--gtdv-accent, #019ed6);
    color: #fff;
    padding: 10px 15px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    line-height: 1;
}

/* ═══════════════════════════════════════════════════════
   TIPO RADIO — Carrusel horizontal de tarjetas
   ═══════════════════════════════════════════════════════ */

.gtdv-group-radio .gtdv-options-grid {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #f7f8fa;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f7f8fa;
    align-items: stretch;
}
.gtdv-group-radio .gtdv-options-grid::-webkit-scrollbar { height: 4px; }
.gtdv-group-radio .gtdv-options-grid::-webkit-scrollbar-track { background: #eee; }
.gtdv-group-radio .gtdv-options-grid::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* Tarjeta radio */
.gtdv-group-radio .gtdv-card-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 105px;
    min-width: 105px;
    border: 2px solid #dde1e7;
    border-radius: 8px;
    padding: 10px 7px 9px;
    cursor: pointer;
    background: #fff;
    text-align: center;
    position: relative;
    flex-shrink: 0;
    transition: border-color .18s, box-shadow .18s, transform .12s;
    user-select: none;
    box-sizing: border-box;
    margin: 0;
}

.gtdv-group-radio .gtdv-card-label:hover:not(.gtdv-out-of-stock) {
    border-color: var(--gtdv-accent, #019ed6);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
}

.gtdv-group-radio .gtdv-card-label.active {
    border-color: var(--gtdv-accent, #019ed6);
    box-shadow: 0 0 0 3px rgba(1,158,214,.13);
}

/* Indicador radio circular */
.gtdv-radio-dot {
    display: block;
    width: 15px;
    height: 15px;
    border: 2px solid #bbb;
    border-radius: 50%;
    position: absolute;
    top: 8px;
    left: 8px;
    background: #fff;
    transition: border-color .15s, background .15s;
    flex-shrink: 0;
}
.gtdv-group-radio .gtdv-card-label.active .gtdv-radio-dot {
    border-color: var(--gtdv-accent, #019ed6);
    background: var(--gtdv-accent, #019ed6);
    box-shadow: inset 0 0 0 3px #fff;
}

/* Imagen de tarjeta radio */
.gtdv-card-img-wrap {
    width: 76px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px 0 7px;
    flex-shrink: 0;
}
.gtdv-card-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

/* Nombre en tarjeta radio */
.gtdv-card-name {
    font-size: 10px;
    font-weight: 700;
    color: #2d3748;
    line-height: 1.3;
    margin-bottom: 5px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    width: 100%;
}

/* Precio en tarjeta radio */
.gtdv-card-price {
    font-size: 11px;
    font-weight: 800;
    color: var(--gtdv-accent, #019ed6);
    line-height: 1;
    margin-top: auto;
}

/* ═══════════════════════════════════════════════════════
   TIPO CHECKBOX — Lista vertical con toggle
   ═══════════════════════════════════════════════════════ */

.gtdv-group-checkbox .gtdv-options-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #fff;
}

/* Ítem de lista checkbox */
.gtdv-group-checkbox .gtdv-card-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #eef0f3;
    background: #fff;
    transition: background .12s;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}
.gtdv-group-checkbox .gtdv-card-label:last-child { border-bottom: none; }
.gtdv-group-checkbox .gtdv-card-label:hover:not(.gtdv-out-of-stock) { background: #fafbfc; }
.gtdv-group-checkbox .gtdv-card-label.active { background: #f0f9ff; }

/* Miniatura en lista */
.gtdv-list-img {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    border: 1px solid #eee;
}
.gtdv-list-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Info texto */
.gtdv-list-info {
    flex: 1;
    min-width: 0;
}
.gtdv-item-name {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gtdv-item-ref {
    display: block;
    font-size: 10px;
    color: #aaa;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Precio en lista */
.gtdv-list-price {
    flex-shrink: 0;
    margin-right: 10px;
}
.gtdv-price-badge {
    display: inline-block;
    background: var(--gtdv-accent, #019ed6);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    padding: 5px 11px;
    border-radius: 5px;
    white-space: nowrap;
    letter-spacing: .3px;
}

/* ── Toggle switch ─────────────────────────────────── */
.gtdv-list-toggle { flex-shrink: 0; }

.gtdv-toggle-track {
    display: block;
    width: 44px;
    height: 24px;
    background: #d1d5db;
    border-radius: 12px;
    position: relative;
    transition: background .2s;
    flex-shrink: 0;
}
.gtdv-toggle-thumb {
    display: block;
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    box-shadow: 0 1px 4px rgba(0,0,0,.25);
    transition: left .18s ease;
}

/* Estado activo del toggle */
.gtdv-group-checkbox .gtdv-card-label.active .gtdv-toggle-track {
    background: var(--gtdv-accent, #019ed6);
}
.gtdv-group-checkbox .gtdv-card-label.active .gtdv-toggle-thumb {
    left: 23px;
}

/* ── Badges comunes ───────────────────────────────────── */
.gtdv-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 9px;
    border-radius: 5px;
    white-space: nowrap;
}
.gtdv-badge-free { background: #16a34a; color: #fff; }
.gtdv-badge-out  { background: #9ca3af; color: #fff; }

/* ── Agotado ────────────────────────────────────────── */
.gtdv-out-of-stock { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ── Tarjeta "ninguno" ──────────────────────────────── */
.gtdv-card-none .gtdv-card-img-wrap { opacity: .35; }

/* ── Reset de posición dentro del tema ─────────────── */
/* Forzar que la sección no flote ni sea inline-block   */
.product-add-to-cart .gtdv-accessories-section,
.product-actions .gtdv-accessories-section {
    float: none !important;
    display: block !important;
    width: 100% !important;
    margin-top: 0;
}

/* ─── Resumen de precio ──────────────────────────────────── */
.gtdv-summary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px;
    margin-top: 20px;
    box-sizing: border-box;
}

.gtdv-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: #475569;
}

.gtdv-summary-row:first-child {
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 12px;
}

.gtdv-summary-row:last-child {
    padding-top: 12px;
}

#gtdv-extra-total {
    font-weight: 600;
    color: #0f172a;
}

.gtdv-summary-total {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.gtdv-summary-total-val {
    font-size: 20px;
    font-weight: 800;
    color: var(--gtdv-accent, #019ed6);
}

/* ── Responsive mobile ────────────────────────────────── */
@media (max-width: 767px) {
    .gtdv-group-radio .gtdv-card-label { width: 88px; min-width: 88px; padding: 8px 5px; }
    .gtdv-card-img-wrap { width: 58px; height: 50px; }
    .gtdv-card-name { font-size: 9px; }
    .gtdv-list-img { width: 42px; height: 42px; }
    .gtdv-item-name { font-size: 12px; }
    .gtdv-price-badge { font-size: 11px; padding: 4px 8px; }
    .gtdv-toggle-track { width: 38px; height: 21px; }
    .gtdv-toggle-thumb { width: 15px; height: 15px; }
    .gtdv-group-checkbox .gtdv-card-label.active .gtdv-toggle-thumb { left: 20px; }
    .gtdv-group-checkbox .gtdv-card-label { padding: 10px 12px; gap: 10px; }
}
