/* CSS for PDF Number Tool */
/* Reusing variables from pdf-tools-ui.css where possible, but user provided specific styles */

.tool-container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 20px;
}

.tool-header {
    text-align: center;
    margin-bottom: 30px;
}

.tool-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 10px;
}

/* ZONA DE CARGA */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 16px;
    background: white;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: rgba(14, 165, 233, 0.08);
}

/* WORKSPACE */
.workspace {
    display: none;
    grid-template-columns: 350px 1fr;
    gap: 40px;
    align-items: start;
    margin-top: 30px;
    margin-bottom: 100px;
    /* Space for action bar */
}

@media (max-width: 800px) {
    .workspace {
        grid-template-columns: 1fr;
    }
}

/* PANEL IZQUIERDO */
.settings-card {
    background: white;
    padding: 25px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.control-group {
    margin-bottom: 20px;
}

.control-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Inputs Generales */
input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: 0.2s;
    background: white;
    color: var(--text-main);
}

input:focus,
select:focus {
    border-color: var(--primary);
}

/* --- NUEVO: Segmented Buttons (Botones de opción unidos) --- */
.segmented-control {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.seg-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.seg-btn:hover {
    color: var(--text-main);
}

.seg-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

/* Tips y ayudas */
.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.tag {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--primary);
}

/* ÁREA DE VISUALIZACIÓN */
.preview-area {
    background: #e2e8f0;
    padding: 40px;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    position: relative;
    min-height: 500px;
}

/* HOJA INTERACTIVA */
.interactive-page {
    width: 380px;
    /* aspect-ratio: 1/1.414;  Use fixed height to avoid layout shift issues or calc in CSS */
    height: 537px;
    /* 380 * 1.414 */
    background: white;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.page-header-area,
.page-footer-area {
    height: 70px;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 10px 20px;
    gap: 5px;
}

.pos-zone {
    border: 1px dashed transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.pos-zone.left {
    justify-content: flex-start;
}

.pos-zone.center {
    justify-content: center;
}

.pos-zone.right {
    justify-content: flex-end;
}

.pos-zone:hover {
    background: var(--zone-hover);
    border-color: #cbd5e1;
}

.pos-zone.selected {
    background: var(--zone-active);
    border-color: var(--primary);
    border-style: solid;
}

.number-preview {
    font-size: 12px;
    color: var(--text-main);
    pointer-events: none;
    white-space: nowrap;
}

/* Cuerpo dummy */
.page-body-dummy {
    flex: 1;
    margin: 10px 40px;
    border: 1px solid #f1f5f9;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
}

.dummy-line {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    width: 100%;
}

/* BARRA DE ACCIÓN */
.action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    padding: 15px 40px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transform: translateY(100%);
    transition: transform 0.3s;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.action-bar.visible {
    transform: translateY(0);
}

.apply-btn {
    background: var(--primary);
    color: white;
    padding: 12px 30px;
    border-radius: 10px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.apply-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.result-native {
    margin-top: 20px;
    padding: 20px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.success-message {
    text-align: center;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #10b981;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: 0.2s;
}

.download-btn:hover {
    background: #059669;
}

.is-dragging {
    border-color: var(--primary);
    background: rgba(14, 165, 233, 0.12);
}

/* Hide helper */
.hidden {
    display: none !important;
}

body.theme-dark .tool-header h1,
body.theme-dark .tool-header p {
    color: var(--text-main);
}

body.theme-dark .upload-zone,
body.theme-dark .settings-card,
body.theme-dark .preview-area,
body.theme-dark .interactive-page,
body.theme-dark .action-bar,
body.theme-dark .result-native {
    background: #0f172a;
    border-color: var(--border);
    color: var(--text-main);
}

body.theme-dark .segmented-control {
    background: #111827;
}

body.theme-dark .seg-btn {
    color: var(--text-muted);
}

body.theme-dark .seg-btn.active {
    background: #1e293b;
    color: var(--primary);
}

body.theme-dark input[type="text"],
body.theme-dark input[type="number"],
body.theme-dark select {
    background: #0b1220;
    color: var(--text-main);
    border-color: var(--border);
}

body.theme-dark .page-body-dummy,
body.theme-dark .dummy-line {
    background: #111827;
    border-color: #1f2937;
}
