/**
 * Egata Grabado Premium - Frontend CSS
 * Diseño Minimalista, Moderno y Optimizado para Móvil & Escritorio
 */

.egata-grabado-wrapper {
    margin: 22px 0;
    width: 100%;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.egata-grabado-wrapper * {
    box-sizing: border-box;
}

/* -------------------------------------------------------------
   1. BARRA Y SWITCH PRINCIPAL (TOGGLE)
   ------------------------------------------------------------- */
.egata-grabado-toggle-bar {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 15px 18px;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.egata-grabado-wrapper.is-active .egata-grabado-toggle-bar {
    border-color: #e2e8f0;
    border-bottom-color: #f1f5f9;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    background: #ffffff;
}

.egata-toggle-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
    user-select: none;
    margin: 0;
    width: 100%;
}

.egata-toggle-label-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.egata-toggle-sparkle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.egata-grabado-wrapper.is-active .egata-toggle-sparkle {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.egata-toggle-text-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.egata-toggle-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.egata-toggle-subtitle {
    font-size: 11.5px;
    font-weight: 400;
    color: #64748b;
    line-height: 1.3;
}

/* Switch Estilo iOS / Minimalista */
.egata-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.egata-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    margin: 0;
}

.egata-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 26px;
}

.egata-switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.egata-switch input:checked + .egata-switch-slider {
    background-color: #0f172a;
}

.egata-switch input:checked + .egata-switch-slider:before {
    transform: translateX(20px);
}

/* -------------------------------------------------------------
   2. PANEL SECUNDARIO DESPLEGABLE
   ------------------------------------------------------------- */
.egata-grabado-panel {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-top: none;
    border-bottom-left-radius: 14px;
    border-bottom-right-radius: 14px;
    padding: 24px 22px 26px;
    box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.05);
}

.egata-grabado-panel-inner,
.egata-panel-inner {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Grupos de cada paso */
.egata-panel-group {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.egata-group-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.egata-group-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    cursor: default;
}

.egata-step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: #0f172a;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

.egata-step-text {
    line-height: 1.3;
}

.egata-badge-optional {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: middle;
}

/* -------------------------------------------------------------
   3. SELECTOR DE POSICIÓN (RADIO CARDS)
   ------------------------------------------------------------- */
.egata-position-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
}

.egata-pos-card {
    position: relative;
    cursor: pointer;
    margin: 0;
    user-select: none;
}

.egata-pos-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

.egata-pos-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 14px 10px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    min-height: 72px;
}

.egata-pos-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.egata-pos-radio-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid #cbd5e1;
    background: #ffffff;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    flex-shrink: 0;
}

.egata-pos-card:hover .egata-pos-card-inner {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.egata-pos-card.egata-pos-selected .egata-pos-card-inner,
.egata-pos-card input[type="radio"]:checked + .egata-pos-card-inner {
    border-color: #0f172a;
    background: #ffffff;
    box-shadow: 0 0 0 1px #0f172a, 0 4px 12px -2px rgba(15, 23, 42, 0.08);
}

.egata-pos-card.egata-pos-selected .egata-pos-radio-indicator,
.egata-pos-card input[type="radio"]:checked + .egata-pos-card-inner .egata-pos-radio-indicator {
    border-color: #0f172a;
    background: #0f172a;
    box-shadow: inset 0 0 0 3.5px #ffffff;
}

.egata-pos-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.25;
}

.egata-pos-right {
    display: flex;
    align-items: center;
}

.egata-pos-price {
    font-size: 11.5px;
    font-weight: 500;
    color: #64748b;
    line-height: 1.2;
}

.egata-pos-card.egata-pos-selected .egata-pos-price,
.egata-pos-card input[type="radio"]:checked + .egata-pos-card-inner .egata-pos-price {
    color: #0f172a;
    font-weight: 600;
}

.egata-free-tag {
    display: inline-block;
    background: #ecfdf5;
    color: #059669;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    letter-spacing: 0.01em;
}

/* -------------------------------------------------------------
   4. CAMPO DE TEXTO A GRABAR
   ------------------------------------------------------------- */
.egata-textarea-wrap {
    width: 100%;
}

.egata-text-input {
    width: 100%;
    padding: 13px 15px;
    font-size: 14px;
    line-height: 1.5;
    color: #0f172a;
    background: #f8fafc;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    outline: none;
    transition: all 0.2s ease;
    resize: vertical;
    font-family: inherit;
    min-height: 74px;
}

.egata-text-input:focus {
    background: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.egata-text-input::placeholder {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 400;
}

.egata-input-helper {
    font-size: 11.5px;
    color: #64748b;
    margin-top: 6px;
    line-height: 1.4;
}

.egata-char-counter {
    font-size: 11.5px;
    font-weight: 500;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------
   5. DRAG & DROP FILE UPLOAD (ZONA DE ARCHIVOS)
   ------------------------------------------------------------- */
.egata-dropzone-box {
    position: relative;
    border: 1.5px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    padding: 22px 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.egata-dropzone-box:hover,
.egata-dropzone-box.dragover {
    border-color: #0f172a;
    background: #f1f5f9;
}

.egata-file-native-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.egata-dropzone-idle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.egata-dropzone-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    transition: all 0.2s ease;
}

.egata-dropzone-box:hover .egata-dropzone-icon {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

.egata-dropzone-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.egata-dropzone-main-text {
    font-size: 13.5px;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.35;
}

.egata-browse-link {
    color: #0f172a;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
}

.egata-dropzone-sub-text {
    font-size: 11.5px;
    color: #64748b;
}

/* Vista de archivo seleccionado */
.egata-dropzone-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 14px;
    position: relative;
    z-index: 3;
    pointer-events: auto;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.egata-file-preview-wrap {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
}

.egata-file-preview-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.egata-file-icon svg {
    stroke: #475569;
}

.egata-file-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    flex: 1;
    overflow: hidden;
    text-align: left;
}

.egata-file-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.egata-file-size {
    font-size: 11px;
    color: #64748b;
}

.egata-file-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.egata-file-remove-btn:hover {
    color: #ef4444;
    background: #fee2e2;
}

/* -------------------------------------------------------------
   6. NOTA DE CONFIANZA Y ATENCIÓN PERSONALIZADA
   ------------------------------------------------------------- */
.egata-grabado-warning-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fafaf9;
    border: 1px solid #e7e5e4;
    border-radius: 12px;
    padding: 14px 16px;
    line-height: 1.45;
    margin-top: 4px;
}

.egata-warning-icon {
    color: #0f172a;
    flex-shrink: 0;
    margin-top: 2px;
}

.egata-warning-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.egata-warning-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.egata-warning-text {
    font-size: 12px;
    color: #52525b;
    line-height: 1.45;
}

/* -------------------------------------------------------------
   7. ENLACES EN CARRITO Y CHECKOUT
   ------------------------------------------------------------- */
.egata-cart-file-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #0f172a !important;
    text-decoration: underline !important;
    font-weight: 600 !important;
    font-size: 12px !important;
}

.egata-cart-file-link:hover {
    color: #475569 !important;
}

/* -------------------------------------------------------------
   8. RESPONSIVE Y OPTIMIZACIÓN MOBILE
   ------------------------------------------------------------- */
@media (max-width: 640px) {
    .egata-grabado-wrapper {
        margin: 18px 0;
    }

    .egata-grabado-toggle-bar {
        padding: 13px 14px;
    }

    .egata-toggle-sparkle {
        width: 34px;
        height: 34px;
        border-radius: 8px;
    }

    .egata-toggle-title {
        font-size: 13.5px;
        line-height: 1.3;
    }

    .egata-toggle-subtitle {
        font-size: 11px;
    }

    .egata-switch {
        width: 44px;
        height: 24px;
    }

    .egata-switch-slider:before {
        height: 18px;
        width: 18px;
    }

    .egata-switch input:checked + .egata-switch-slider:before {
        transform: translateX(20px);
    }

    .egata-grabado-panel {
        padding: 18px 14px 22px;
        border-radius: 0 0 12px 12px;
    }

    .egata-grabado-panel-inner,
    .egata-panel-inner {
        gap: 20px;
    }

    .egata-panel-group {
        gap: 9px;
    }

    .egata-group-label {
        font-size: 13px;
    }

    /* Selector de posición: lista táctil ergonómica para pulgar */
    .egata-position-cards {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .egata-pos-card-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 12px 14px;
        min-height: 48px;
        border-radius: 10px;
        text-align: left;
    }

    .egata-pos-left {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .egata-pos-radio-indicator {
        margin-bottom: 0;
        width: 18px;
        height: 18px;
    }

    .egata-pos-name {
        font-size: 13.5px;
    }

    .egata-pos-price {
        font-size: 12px;
    }

    /* Evitar zoom automático en Safari iOS: mínimo 16px */
    .egata-text-input {
        font-size: 16px;
        padding: 12px 14px;
        border-radius: 10px;
        min-height: 78px;
    }

    .egata-text-input::placeholder {
        font-size: 13px;
    }

    /* Zona de archivos en móvil */
    .egata-dropzone-box {
        padding: 18px 14px;
        border-radius: 10px;
    }

    .egata-dropzone-icon {
        width: 38px;
        height: 38px;
    }

    .egata-dropzone-main-text {
        font-size: 12.5px;
    }

    .egata-dropzone-sub-text {
        font-size: 11px;
    }

    /* Nota de confianza en móvil */
    .egata-grabado-warning-box {
        padding: 12px 13px;
        border-radius: 10px;
        gap: 10px;
    }

    .egata-warning-title {
        font-size: 12px;
    }

    .egata-warning-text {
        font-size: 11.5px;
    }
}
