/* ============================================================
   ESTILOS ESPECÍFICOS: GENERADOR DE CÓDIGOS & ETIQUETAS POR MEDIDAS
   PaperTools PRO v2.0
   ============================================================ */

/* BARRA SUPERIOR DE ACCIONES */
.codigos-topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.codigos-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.codigos-mobile-menu-btn {
    display: none;
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm, 8px);
    width: 36px;
    height: 36px;
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.codigos-mobile-menu-btn:hover {
    background: var(--bg-hover);
    color: var(--color-primary);
}

@media (max-width: 900px) {
    .codigos-mobile-menu-btn {
        display: inline-flex;
    }
}

.codigos-title-wrap {
    display: flex;
    flex-direction: column;
}

.codigos-page-title {
    font-size: 1.22rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
}

.codigos-page-subtitle {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 2px 0 0 0;
}

.codigos-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ENCABEZADO DE TARJETA DE VISTA PREVIA */
.preview-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border-color);
}

.preview-card-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.codigos-workspace {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 1.5rem;
    align-items: start;
    margin-top: 1.25rem;
}

@media (max-width: 1080px) {
    .codigos-workspace {
        grid-template-columns: 1fr;
    }
}

/* PANEL IZQUIERDO DE CONFIGURACIÓN */
.config-panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl, 16px);
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.config-section-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.85rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}

.type-selector-pills {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 1.25rem;
}

.type-pill-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    background: var(--bg-surface, var(--bg-muted));
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.type-pill-btn:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.type-pill-btn.active {
    border-color: var(--color-primary);
    background: var(--color-primary-soft, rgba(0, 96, 223, 0.08));
    color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(0, 96, 223, 0.15);
}

.type-pill-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.type-pill-label {
    font-size: 0.84rem;
    font-weight: 800;
}

.preset-measures-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 1rem;
}

.preset-measure-btn {
    padding: 0.55rem 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-surface, var(--bg-muted));
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.18s ease;
    text-align: center;
    line-height: 1.2;
}

.preset-measure-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.preset-measure-btn.active {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #ffffff;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(0, 96, 223, 0.25);
}

.custom-measure-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 1.25rem;
}

.measure-input-group {
    flex: 1;
}

.measure-input-group label {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 4px;
    display: block;
}

.measure-input-group input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.9rem;
}

/* FORM GROUPS */
.field-group {
    margin-bottom: 1rem;
}

.field-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.field-label span.badge-opt {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-muted);
    padding: 2px 6px;
    border-radius: 4px;
}

.field-input, .field-select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.field-input:focus, .field-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 96, 223, 0.12);
}

.checkbox-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    margin-top: 4px;
}

.checkbox-toggle-wrap input[type="checkbox"] {
    accent-color: var(--color-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* PANEL DERECHO DE VISTA PREVIA */
.preview-panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl, 16px);
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.preview-tabs-nav {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.25rem;
}

.preview-tab-btn {
    padding: 0.65rem 1.2rem;
    font-size: 0.88rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.preview-tab-btn:hover {
    color: var(--color-primary);
}

.preview-tab-btn.active {
    color: var(--color-primary);
    font-weight: 800;
}

.preview-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2.5px;
    background: var(--color-primary);
    border-radius: 2px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* CONTENEDOR DE LA ETIQUETA INDIVIDUAL */
.single-label-viewport {
    background: var(--bg-muted, #f8fafc);
    border: 1.5px dashed var(--border-color);
    border-radius: var(--radius-lg, 12px);
    padding: 2rem;
    min-height: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: auto;
}

/* TARJETA DE LA ETIQUETA RENDERIZADA */
.render-label-box {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    padding: 6px 8px;
    position: relative;
    transition: transform 0.2s ease;
}

.render-label-box .label-header-text {
    font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    line-height: 1.15;
    color: #1e293b;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.render-label-box .label-code-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    width: 100%;
    margin: 2px 0;
    overflow: hidden;
}

.render-label-box .label-code-wrap svg,
.render-label-box .label-code-wrap canvas,
.render-label-box .label-code-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.render-label-box .label-price-tag {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    color: #0f172a;
    line-height: 1;
}

.render-label-box .label-footer-text {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.1;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* VISTA PREVIA DE LA HOJA COMPLETA */
.sheet-preview-viewport {
    background: var(--bg-muted, #f1f5f9);
    border: 1.5px dashed var(--border-color);
    border-radius: var(--radius-lg, 12px);
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow: auto;
    max-height: 620px;
}

.sheet-paper-sim {
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    width: 215.9mm;
    min-height: 279.4mm;
    box-sizing: border-box;
    position: relative;
    transform-origin: top center;
}

.sheet-grid-container {
    display: grid;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
}

.sheet-mini-label {
    box-sizing: border-box;
    border: 0.5px dashed #cbd5e1;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2px;
    overflow: hidden;
    position: relative;
}

.sheet-mini-label .mini-title {
    font-size: 5px;
    font-weight: 700;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
}

.sheet-mini-label .mini-code {
    max-width: 90%;
    max-height: 60%;
    object-fit: contain;
}

.sheet-mini-label .mini-price {
    font-size: 6px;
    font-weight: 900;
    color: #0f172a;
    line-height: 1;
}

/* BARRA DE ACCIONES PRINCIPALES */
.action-buttons-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.action-buttons-bar .btn {
    flex: 1;
    min-width: 180px;
    justify-content: center;
    font-weight: 800;
}

/* INFO BADGE CAPACITY */
.capacity-info-badge {
    background: var(--color-primary-soft, rgba(0, 96, 223, 0.08));
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-lg, 12px);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.capacity-info-text {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
