@import url('https://fonts.cdnfonts.com/css/sansation');

/* Variables CSS para temas */
:root {
    /* Modo claro (por defecto) */
    --bg-primary: #ffffff;
    --bg-secondary: rgba(255, 255, 255, 0.95);
    --bg-tertiary: rgba(248, 249, 250, 0.8);
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-input: rgba(255, 255, 255, 0.85);
    --bg-button: rgba(249, 250, 251, 0.8);
    --bg-button-hover: rgba(243, 244, 246, 0.9);
    --bg-dropdown: rgba(255, 255, 255, 0.98);
    --bg-table-header: rgba(248, 250, 252, 0.9);
    --bg-table-row-hover: rgba(248, 250, 255, 0.8);

    --text-primary: #1a1a1a;
    --text-secondary: #374151;
    --text-tertiary: #6b7280;
    --text-muted: #9ca3af;
    --text-label: #495057;
    --text-error: #991b1b;

    --border-primary: rgba(229, 231, 235, 0.6);
    --border-secondary: rgba(209, 213, 219, 0.6);
    --border-hover: rgba(59, 130, 246, 0.8);
    --border-focus: #3b82f6;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-dropdown: 0 8px 32px rgba(0, 0, 0, 0.2);

    --accent-primary: #667eea;
    --accent-secondary: #3b82f6;
    --accent-success: #28a745;
    --accent-error: #ef4444;
    --accent-warning: #f59e0b;

    --bg-body-image: url('https://images.unsplash.com/photo-1565210579809-6b057c557420?q=80&w=1742&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D');
}

/* Modo oscuro */
[data-theme="dark"] {
    --bg-primary: #1f2937;
    --bg-secondary: rgba(31, 41, 55, 0.95);
    --bg-tertiary: rgba(17, 24, 39, 0.8);
    --bg-card: rgba(31, 41, 55, 0.95);
    --bg-input: rgba(17, 24, 39, 0.85);
    --bg-button: rgba(55, 65, 81, 0.8);
    --bg-button-hover: rgba(75, 85, 99, 0.9);
    --bg-dropdown: rgba(31, 41, 55, 0.98);
    --bg-table-header: rgba(17, 24, 39, 0.9);
    --bg-table-row-hover: rgba(59, 130, 246, 0.1);

    --text-primary: #f9fafb;
    --text-secondary: #e5e7eb;
    --text-tertiary: #d1d5db;
    --text-muted: #9ca3af;
    --text-label: #d1d5db;
    --text-error: #fca5a5;

    --border-primary: rgba(75, 85, 99, 0.6);
    --border-secondary: rgba(55, 65, 81, 0.6);
    --border-hover: rgba(59, 130, 246, 0.8);
    --border-focus: #60a5fa;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-dropdown: 0 8px 32px rgba(0, 0, 0, 0.5);

    --accent-primary: #818cf8;
    --accent-secondary: #60a5fa;
    --accent-success: #34d399;
    --accent-error: #f87171;
    --accent-warning: #fbbf24;

    --bg-body-image: url('https://images.unsplash.com/photo-1565210579809-6b057c557420?q=80&w=1742&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D');
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', 'Arial', sans-serif;
    background: var(--bg-body-image) center/cover no-repeat fixed;
    line-height: 1.5;
    color: var(--text-primary);
    font-size: 16px;
    min-height: 100vh;
    transition: color 0.3s ease, background-image 0.3s ease, filter 0.3s ease;
}

/* Aplicar filtros de inversión de color al fondo en modo oscuro */
[data-theme="dark"] body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-body-image) center/cover no-repeat fixed;
    filter: invert(1) hue-rotate(180deg) brightness(0.8) contrast(1.2);
    z-index: -2;
    transition: filter 0.3s ease;
}

[data-theme="dark"] body {
    background: transparent;
}

html {
    overflow: visible;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 15px;
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-primary);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    position: relative;
}

.header h1 {
    font-size: 2.25rem;
    margin-bottom: 0;
    color: var(--text-primary);
    font-weight: 300;
    letter-spacing: 12px;
    /* Aumentado considerablemente para ocupar ancho */
    text-transform: uppercase;
    font-family: 'Sansation', sans-serif;
    text-align: center;
    width: 100%;
    display: block;
    line-height: 1.2;
    transition: color 0.3s ease;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    font-weight: 400;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease-in-out 0s, opacity 0.4s ease-in-out 0s, transform 0.4s ease-in-out 0s, color 0.3s ease;
    transform: translateY(-10px);
}

/* Header Actions Container */
.header-actions {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Header Icon Button (shared style with theme toggle logic) */
.header-icon-btn,
.theme-toggle {
    background: var(--bg-button);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    backdrop-filter: blur(8px);
    color: var(--text-secondary);
    position: relative;
    /* Reset absolute positioning from previous theme-toggle */
    transform: none;
    /* Reset transform */
    right: auto;
}

.header-icon-btn:hover,
.theme-toggle:hover {
    background: var(--bg-button-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Theme Toggle styles adjustments inside shared block above */
.theme-toggle svg {
    color: var(--text-secondary);
    transition: all 0.3s ease;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Mostrar/ocultar iconos según el tema */
.theme-toggle .sun-icon {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg);
}

.theme-toggle .moon-icon {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(90deg);
}

[data-theme="dark"] .theme-toggle .sun-icon {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-90deg);
}

[data-theme="dark"] .theme-toggle .moon-icon {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0deg);
}

.header h1:hover+.subtitle,
.header:hover .subtitle {
    max-height: 200px;
    opacity: 1;
    transform: translateY(0);
    margin-bottom: 16px;
    transition: max-height 0.4s ease-in-out 1s, opacity 0.4s ease-in-out 1s, transform 0.4s ease-in-out 1s;
}

.warning-box {
    background: rgba(254, 242, 242, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(254, 202, 202, 0.6);
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 12px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
}

.warning-text {
    color: #991b1b;
    font-size: 0.875rem;
    line-height: 1.4;
    margin: 0;
    font-weight: 500;
}

/* Main Content */
.main-content {
    margin-bottom: 16px;
}

/* Two Column Layout */
.two-column-layout {
    display: flex;
    gap: 15px;
    align-items: stretch;
}

.left-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
}

.left-column .step-card:last-child {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.left-column .step-card:last-child .input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.left-column .step-card:last-child #copyPasteText {
    flex: 1;
    resize: both;
    height: auto;
}

.right-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.right-column .step-card {
    display: flex;
    flex-direction: column;
    min-height: 445px;
}

.step-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-primary);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 1;
}

.step-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.step-card h2 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: color 0.3s ease;
}

/* Header with fecha toggle */
.header-with-fecha {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    min-height: 36px;
    width: 100%;
}

.header-with-fecha h2 {
    margin-bottom: 0;
    flex: 1;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Icono SVG de parámetros */
.params-icon {
    width: 24px;
    height: 24px;
    stroke: #4E80EE;
    filter: drop-shadow(0 0 8px rgba(78, 128, 238, 0.4));
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.params-icon:hover {
    stroke: #3B6FE5;
    filter: drop-shadow(0 0 12px rgba(78, 128, 238, 0.6));
    transform: scale(1.05);
}

/* Animación sutil para el icono */
@keyframes gentle-glow {

    0%,
    100% {
        filter: drop-shadow(0 0 8px rgba(78, 128, 238, 0.4));
    }

    50% {
        filter: drop-shadow(0 0 12px rgba(78, 128, 238, 0.6));
    }
}

.params-icon {
    animation: gentle-glow 3s ease-in-out infinite;
}

/* Icono SVG de texto del examen */
.text-icon {
    width: 24px;
    height: 24px;
    stroke: #4E80EE;
    filter: drop-shadow(0 0 8px rgba(78, 128, 238, 0.4));
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-right: 8px;
}

.text-icon:hover {
    stroke: #3B6FE5;
    filter: drop-shadow(0 0 12px rgba(78, 128, 238, 0.6));
    transform: scale(1.05);
}

/* Asegurar que los h2 con iconos tengan flexbox */
.step-card h2 {
    display: flex;
    align-items: center;
}

/* Animación para el icono de texto */
.text-icon {
    animation: gentle-glow 3s ease-in-out infinite;
}

/* Icono SVG de resultado extraído */
.result-icon {
    width: 24px;
    height: 24px;
    stroke: #4E80EE;
    filter: drop-shadow(0 0 8px rgba(78, 128, 238, 0.4));
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-right: 8px;
}

.result-icon:hover {
    stroke: #3B6FE5;
    filter: drop-shadow(0 0 12px rgba(78, 128, 238, 0.6));
    transform: scale(1.05);
}

/* Animación para el icono de resultado */
.result-icon {
    animation: gentle-glow 3s ease-in-out infinite;
}

.fecha-toggle {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-button);
    backdrop-filter: blur(8px);
    font-size: 0.875rem;
    margin-left: auto;
    color: var(--text-secondary);
}

.fecha-toggle:hover {
    border-color: var(--border-hover);
    background: var(--bg-button-hover);
    backdrop-filter: blur(10px);
}

.fecha-toggle .checkmark-compact {
    margin-right: 8px;
}

/* Header controls layout */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Utility buttons inline */
.utility-buttons-inline {
    display: flex;
    gap: 4px;
}

.utility-button-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 5px;
    background: var(--bg-button);
    backdrop-filter: blur(8px);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: auto;
    white-space: nowrap;
}

.utility-button-inline:hover {
    background: var(--bg-button-hover);
    border-color: var(--border-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.version-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 24px 6px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 5px;
    background-color: var(--bg-button);
    backdrop-filter: blur(8px);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    /* Custom arrow */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 8px auto;
}

.version-select:hover {
    background-color: var(--bg-button-hover);
    border-color: var(--border-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.version-select:focus {
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.utility-button-inline:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Selection Grid */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.selection-item {
    display: flex;
    align-items: left;
    padding: 15px;
    border: 2px solid var(--border-secondary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-tertiary);
    backdrop-filter: blur(8px);
    position: relative;
}

.selection-item:hover {
    border-color: var(--border-hover);
    background: var(--bg-button-hover);
    backdrop-filter: blur(10px);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.selection-checkbox {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-right: 12px;
    position: relative;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.selection-checkbox:checked+.checkmark {
    background: #667eea;
    border-color: #667eea;
}

.selection-checkbox:checked+.checkmark::after {
    content: '✓';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.selection-checkbox:checked~.selection-label {
    color: #667eea;
    font-weight: 600;
}

.selection-label {
    font-size: 1rem;
    color: #495057;
    transition: all 0.3s ease;
}

/* Compact Selection Grid */
.selection-grid-compact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 6px;
    margin-bottom: 12px;
    overflow: visible;
    position: relative;
}

.selection-item-compact {
    display: flex;
    align-items: left;
    padding: 6px 10px;
    border: 1px solid var(--border-primary);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-input);
    backdrop-filter: blur(8px);
    font-size: 0.8rem;
    min-height: 32px;
    position: relative;
}





.selection-item-compact:hover {
    border-color: var(--border-hover);
    background: var(--bg-button-hover);
    backdrop-filter: blur(10px);
}

.checkmark-compact {
    width: 16px;
    height: 16px;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    margin-right: 8px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.selection-checkbox:checked+.checkmark-compact {
    background: #3b82f6;
    border-color: #3b82f6;
}

.selection-checkbox:checked+.checkmark-compact::after {
    content: '✓';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 11px;
}

.selection-checkbox:checked~.selection-label-compact {
    color: #3b82f6;
    font-weight: 500;
}

.selection-label-compact {
    font-size: 0.8rem;
    color: #374151;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Utility Buttons */
.utility-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.utility-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-button);
    backdrop-filter: blur(8px);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: auto;
}

.utility-button:hover {
    background: var(--bg-button-hover);
    border-color: var(--border-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.utility-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-compact {
    padding: 8px 16px;
    font-size: 0.875rem;
    min-width: auto;
    flex: 1;
}

/* Results Status */
.results-status {
    margin-bottom: 10px;
    padding: 10px 12px;
    background: var(--bg-button);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    border: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.status-text {
    color: var(--text-tertiary);
    font-size: 0.875rem;
    text-align: center;
    margin: 0;
}

.results-content {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 12px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid rgba(229, 231, 235, 0.6);
    min-height: 400px;
    color: #1a1a1a;
    flex: 1;
}


.results-content:empty {
    display: none;
}

/* Copy Area */
.copy-area {
    margin-top: 12px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.copy-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-button);
    backdrop-filter: blur(8px);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-button:hover {
    background: var(--bg-button-hover);
    border-color: var(--border-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.copy-icon {
    font-size: 1rem;
}

.copy-text {
    font-weight: 500;
}

/* Input Group */
.input-group {
    margin-bottom: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-label);
}

#copyPasteText {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: both;
    background: var(--bg-input);
    backdrop-filter: blur(8px);
    transition: border-color 0.2s ease;
    color: var(--text-primary);
}

#copyPasteText:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 160px;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
}

.btn-tertiary {
    background: #17a2b8;
    color: white;
}

.btn-tertiary:hover {
    background: #138496;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(23, 162, 184, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Results */
.results-card {
    border-left: 4px solid #28a745;
}

#results {
    background: rgba(248, 249, 250, 0.8);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid rgba(233, 236, 239, 0.6);
    min-height: 100px;
}

.results-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    margin-top: 40px;
}

.footer p {
    margin-bottom: 10px;
    color: #495057;
}

.disclaimer {
    color: #e74c3c !important;
    font-size: 0.95rem;
}

.privacy-note {
    color: #28a745 !important;
    font-size: 0.9rem;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 300px;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.success {
    background: #28a745;
}

.notification.error {
    background: #dc3545;
}

.notification.info {
    background: #17a2b8;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .two-column-layout {
        flex-direction: column;
    }

    /* Reordenar columnas en móvil: Resultado (derecha) antes que Texto (izquierda) */
    .two-column-layout .right-column {
        order: 1;
    }

    .two-column-layout .left-column {
        order: 2;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .parametros {
        padding: 15px;
    }

    .selection-grid-compact {
        grid-template-columns: 1fr;
    }

    .utility-buttons {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .btn-compact {
        flex: none;
        width: 100%;
    }

    .action-buttons,
    .results-actions {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .btn {
        width: 100%;
        max-width: 100%;
    }

    .features {
        flex-direction: column;
        align-items: center;
    }

    .selection-item {
        text-align: center;
    }

    .step-card {
        padding: 15px;
    }

    .header {
        padding: 20px 15px;
    }

    #copyPasteText {
        font-size: 0.85rem;
        min-height: 200px;
    }
}

@media (min-width: 769px) {
    .parametros {
        display: block;
    }

    .two-column-layout {
        display: flex;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .step-card {
        padding: 20px;
    }

    .header {
        padding: 25px 15px;
    }

    .selection-grid-compact {
        grid-template-columns: 1fr;
    }

    #copyPasteText {
        font-size: 0.85rem;
        min-height: 250px;
    }
}


/* Footer específico */
footer {
    position: relative;
    z-index: 10;
    background: transparent;
    clear: both;
}

/* Estilos para valores alterados */
.altered-value {
    text-decoration: underline;
    text-decoration-color: #ef4444;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
    position: relative;
    cursor: help;
}

/* Estilos para valores fuera de rango */
.out-of-range {
    position: relative;
    text-decoration: underline;
    text-decoration-color: #dc3545;
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
    cursor: help;
}

.out-of-range:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: tooltipFadeIn 0.2s ease-out;
    max-width: 300px;
    min-width: max-content;
}

/* Flecha del tooltip para valores fuera de rango */
.out-of-range:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(1px);
    border: 5px solid transparent;
    border-top-color: #1f2937;
    z-index: 1000;
    animation: tooltipFadeIn 0.2s ease-out;
}

/* Tooltip para valores alterados */
.altered-value[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: tooltipFadeIn 0.2s ease-out;
    max-width: 300px;
    min-width: max-content;
}

/* Flecha del tooltip */
.altered-value[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(1px);
    border: 5px solid transparent;
    border-top-color: #1f2937;
    z-index: 1000;
    animation: tooltipFadeIn 0.2s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Ajustes para que el tooltip no se vea cortado en el borde */
.results-content {
    position: relative;
    overflow: visible;
}

/* En responsive, ajustar el tooltip */
@media (max-width: 768px) {
    .altered-value[data-tooltip]:hover::after {
        font-size: 11px;
        padding: 6px 10px;
        max-width: 200px;
        white-space: normal;
        text-align: center;
    }
}


.hemograma-with-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.dropdown-toggle-inline {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    color: #6b7280;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    min-width: 20px;
    height: 20px;
    margin-left: auto;
    flex-shrink: 0;
}

.dropdown-toggle-inline:hover {
    background: rgba(0, 0, 0, 0.08);
    opacity: 1;
}

.dropdown-toggle-inline svg {
    transition: transform 0.2s;
}

.dropdown-toggle-inline.active svg {
    transform: rotate(180deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    background: var(--bg-dropdown);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-dropdown);
    z-index: 99999 !important;
    padding: 8px;
    animation: slideDown 0.2s ease-out;
    /* Ahora el tamaño es dinámico para ajustarse al contenido */
    width: max-content;
    min-width: 220px;
    max-width: 400px;
    height: auto;
    min-height: 220px;
    max-height: 60vh;
    overflow-y: auto;
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* Asegurar que los contenedores de dropdown tengan position relative */
.selection-item-with-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    grid-column: span 1;
    overflow: visible;
    justify-content: space-between;
}

/* Alinear texto a la izquierda y el toggle a la derecha sin romper el ellipsis */
.selection-item-with-dropdown .selection-label-compact {
    flex: 1;
    min-width: 0;
    /* necesario para que text-overflow: ellipsis funcione en flex */
    text-align: left;
}

/* Forzar ancho uniforme de botones en el grid compacto */
.selection-grid-compact .selection-item-with-dropdown,
.selection-grid-compact .selection-item-compact {
    width: 100%;
}

/* Asegurar que el grid no corte los dropdowns */
.selection-grid-compact {
    overflow: visible;
}

/* Asegurar que el step-card no corte los dropdowns */
.step-card {
    overflow: visible;
}

/* Aumentar z-index del step-card que contiene dropdowns abiertos */
.step-card.dropdown-parent-active {
    z-index: 1000;
}

/* Estilos específicos para el dropdown de hemograma */
#hemograma-dropdown {
    top: 100%;
    left: 0;
}

/* Estilos específicos para el dropdown de renal */
#renal-dropdown {
    top: 100%;
    left: 0;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 4px 10px 4px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 8px;
}

.dropdown-title {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-buttons {
    display: flex;
    gap: 6px;
}

.dropdown-utility-button {
    background: rgba(248, 250, 252, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(226, 232, 240, 0.6);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropdown-utility-button:hover {
    background: rgba(226, 232, 240, 0.9);
    border-color: rgba(203, 213, 225, 0.8);
    transform: translateY(-1px);
}

.dropdown-utility-button:active {
    transform: translateY(0);
}

.dropdown-content.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    background: rgba(255, 255, 255, 0.98);
    animation: slideDown 0.2s ease-out;
    z-index: 9999 !important;
    position: absolute;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 13px;
}

.dropdown-item:hover {
    background: rgba(0, 0, 0, 0.03);
}

.dropdown-item .selection-label-compact {
    font-size: 13px;
    color: #374151;
    z-index: 2 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dropdown-grid {
        grid-template-columns: 1fr;
    }

    .dropdown-content {
        position: fixed;
        left: 10px;
        right: 10px;
        top: auto;
        bottom: 10px;
        max-height: 50vh;
        overflow-y: auto;
    }

    .selection-item-with-dropdown {
        grid-column: span 1;
    }

    .selection-grid-compact {
        grid-template-columns: 1fr 1fr;
    }
}

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

/* Estilos para múltiples exámenes */
.add-exam-btn {
    background: #10b981 !important;
    color: white !important;
    display: flex;
    align-items: center;
    gap: 4px;
}

.add-exam-btn:hover {
    background: #059669 !important;
    color: white !important;
}

.exams-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    padding: 4px;
}

.exam-item {
    border: 1px solid rgba(229, 231, 235, 0.8);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.exam-item:hover {
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(248, 249, 250, 0.8);
    border-bottom: 1px solid rgba(229, 231, 235, 0.6);
    backdrop-filter: blur(4px);
}

.exam-title {
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    letter-spacing: 0.5px;
}

.exam-controls {
    display: flex;
    gap: 4px;
    align-items: center;
}

.exam-model-select {
    min-height: 26px;
    padding-top: 4px;
    padding-bottom: 4px;
}

.exam-paste-btn,
.exam-clear-btn,
.exam-remove-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(209, 213, 219, 0.6);
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    backdrop-filter: blur(4px);
}

.exam-paste-btn:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    transform: translateY(-1px);
}

.exam-clear-btn:hover {
    background: #f59e0b;
    border-color: #f59e0b;
    color: white;
    transform: translateY(-1px);
}

.exam-remove-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    transform: translateY(-1px);
}

.exam-input {
    padding: 10px;
}

.exam-textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px;
    border: 1px solid rgba(209, 213, 219, 0.6);
    border-radius: 6px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.4;
    background: var(--bg-input);
    color: var(--text-primary);
    resize: vertical;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.exam-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.exam-textarea::placeholder {
    color: #9ca3af;
    opacity: 0.8;
}

/* Scrollbar personalizada para el contenedor de exámenes */
.exams-container::-webkit-scrollbar {
    width: 4px;
}

.exams-container::-webkit-scrollbar-track {
    background: rgba(243, 244, 246, 0.5);
    border-radius: 2px;
}

.exams-container::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.6);
    border-radius: 2px;
    transition: all 0.2s ease;
}

.exams-container::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 114, 128, 0.8);
}

/* Ajustes responsivos para múltiples exámenes */
@media (max-width: 768px) {
    .exams-container {
        max-height: 300px;
    }

    .exam-textarea {
        min-height: 100px;
        font-size: 12px;
    }

    .exam-header {
        padding: 8px 10px;
    }

    .exam-title {
        font-size: 13px;
    }
}

/* =========================================
   ESTILOS DRAG & DROP
   ========================================= */

/* Estilo unificado para el contenedor (Wrapper simple y con Dropdown) */
.selection-wrapper,
.selection-item-with-dropdown {
    display: flex;
    align-items: stretch;
    /* Asegura que hijos llenen altura, incluyendo handle */
    background-color: var(--bg-secondary);
    /* o bg-input */
    border: 1px solid var(--border-primary);
    border-radius: 5px;
    padding: 0;
    transition: box-shadow 0.2s, transform 0.2s;
    position: relative;
    /* Importante para el dropdown absolute */
    min-height: 38px;
    /* Altura mínima consistente */
    box-sizing: border-box;
    /* Asegurar modelo de caja */
}

.selection-wrapper:hover,
.selection-item-with-dropdown:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: var(--border-hover);
}

/* El drag handle */
.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    /* Un poco más ancho para click fácil */
    min-width: 28px;
    padding: 0;
    cursor: grab;
    color: var(--text-tertiary);
    opacity: 0.6;
    transition: all 0.2s;
    border-right: 1px solid transparent;
    border-radius: 5px 0 0 5px;
    background-color: rgba(0, 0, 0, 0.02);
    /* Sutil fondo */
}

.drag-handle:hover {
    opacity: 1;
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.05);
}

.drag-handle:active {
    cursor: grabbing;
}

/* Resetear estilos del hijo (.selection-item-compact) cuando está dentro de un wrapper/dropdown */
.selection-wrapper .selection-item-compact,
.selection-item-with-dropdown .selection-item-compact {
    flex: 1;
    border: none !important;
    /* Forzar override */
    background: transparent !important;
    border-radius: 0 5px 5px 0;
    margin: 0;
    min-height: auto;
    /* Dejar que el flex container decida */
    display: flex;
    align-items: center;
}

/* Ajuste específico para cuando hay dropdown items: asegurar alineación */
.hemograma-with-dropdown,
.renal-with-dropdown,
.nutricional-with-dropdown,
.gases-with-dropdown {
    width: 100%;
    justify-content: space-between;
}

/* Estilos de draggable genérico */
.draggable-item {
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.draggable-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

/* SVG del handle */
.drag-handle svg {
    pointer-events: none;
    /* Que el click pase al span */
}

.selection-grid-compact {
    display: grid;
    /* El resto de propiedades grid se heredan */
}


/* =========================================
   ESTILOS NUEVA SECCIÓN DE FORMATO
   ========================================= */
.format-options-section {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}

.format-options-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.format-options-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.format-options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

/* Estilos para toggles de formato */
.format-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.85rem;
    user-select: none;
}

.format-toggle input {
    display: none;
}

.format-toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background-color: #cbd5e1;
    /* Gris claro inactivo */
    border-radius: 20px;
    margin-right: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.format-toggle-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.format-toggle input:checked+.format-toggle-slider {
    background-color: #2563eb;
    /* Azul intenso */
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    /* Glow sutil */
}

.format-toggle input:checked+.format-toggle-slider::before {
    transform: translateX(16px);
}

.format-toggle-label {
    color: var(--text-tertiary);
    transition: color 0.2s;
}

.format-toggle input:checked~.format-toggle-label {
    color: var(--text-primary);
    font-weight: 500;
}

/* Selector de Fecha Minimalista */
.fecha-control-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-format-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid transparent;
    background-color: transparent;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: right;
    font-weight: 500;
}

.date-format-select:hover {
    background-color: rgba(0, 0, 0, 0.05);
    /* Sutil hover */
    color: var(--text-primary);
}

.date-format-select:focus {
    outline: none;
    background-color: var(--bg-button);
    border-color: var(--border-primary);
}

/* Opción selected más oscura */
.date-format-select option {
    color: black;
}

.format-toggle input[type="checkbox"]:checked~.format-toggle-label {
    color: var(--text-secondary);
}

/* Hover effects */
.format-toggle:hover .format-toggle-slider {
    background: var(--border-primary);
}

.format-toggle:hover input[type="checkbox"]:checked+.format-toggle-slider {
    background: var(--accent-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .format-options-grid {
        flex-direction: column;
        gap: 10px;
    }
}

/* =========================================
   DISTRIBUCIÓN VERTICAL DE LA INTERFAZ
   ========================================= */
.container {
    max-width: 1500px;
}

.main-content {
    display: grid;
    grid-template-columns: 248px repeat(2, minmax(0, 1fr));
    gap: 15px;
    align-items: stretch;
}

.main-content > .parameters-card {
    grid-column: 1;
    min-width: 0;
    margin-bottom: 0;
}

.main-content > .two-column-layout {
    display: contents;
}

.main-content .left-column {
    grid-column: 2;
    min-width: 0;
}

.main-content .right-column {
    grid-column: 3;
    min-width: 0;
}

.main-content .left-column > .step-card,
.main-content .right-column > .step-card {
    height: 100%;
    margin-bottom: 0;
    box-sizing: border-box;
}

.parameters-card .header-with-fecha {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.parameters-card .header-with-fecha h2 {
    font-size: 1.05rem;
}

.parameters-card .header-controls {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.parameters-card .utility-buttons-inline,
.parameters-card .fecha-control-wrapper {
    width: 100%;
}

.parameters-card .utility-button-inline {
    flex: 1;
}

.parameters-card .fecha-control-wrapper {
    justify-content: space-between;
}

.parameters-card .fecha-toggle {
    margin-left: 0;
    flex: 1;
}

.parameters-card .selection-grid-compact {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 0;
}

.parameters-card .draggable-item {
    width: 100%;
    flex: none;
}

.parameters-card .selection-item-with-dropdown {
    gap: 0;
}

.gases-dropdown-content {
    min-height: auto;
}

.parameters-card .selection-item-compact {
    align-items: center;
    gap: 0;
    line-height: 16px;
}

.parameters-card .checkmark-compact {
    margin-top: 0;
    margin-bottom: 0;
}

.parameters-card .selection-label-compact {
    display: flex;
    align-items: center;
    min-height: 16px;
    line-height: 16px;
}

.version-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 5px 11px;
    border: 1px solid var(--border-primary);
    border-radius: 5px;
    background: var(--bg-button);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.results-output-shell {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.results-output-shell .results-content {
    margin-bottom: 0;
    padding-bottom: 48px;
}

.result-copy-area {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 5;
    margin: 0;
}

.result-copy-btn {
    display: flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-button);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.result-copy-btn:hover {
    border-color: var(--border-hover);
    background: var(--bg-button-hover);
    color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Los submenús se abren hacia el área central sin desplazar la lista. */
.parameters-card #hemograma-dropdown,
.parameters-card #renal-dropdown,
.parameters-card #nutricional-dropdown,
.parameters-card #gases-dropdown {
    top: 0;
    left: calc(100% + 6px);
}

.results-card > h2 {
    margin-bottom: 6px;
}

.format-options-section.format-options-compact {
    margin: 0 0 10px;
    padding: 7px 8px;
}

.format-options-compact .format-options-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 7px 12px;
}

.format-options-compact .format-toggle {
    font-size: 0.7rem;
    white-space: nowrap;
}

.format-options-compact .format-toggle-slider {
    width: 28px;
    height: 16px;
    margin-right: 5px;
}

.format-options-compact .format-toggle-slider::before {
    width: 12px;
    height: 12px;
}

.format-options-compact .format-toggle input:checked + .format-toggle-slider::before {
    transform: translateX(12px);
}

.format-options-compact .format-toggle-label {
    font-size: 0.68rem;
}

.date-format-control {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.format-options-compact .date-format-select {
    min-width: 77px;
    padding: 2px 18px 2px 5px;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background-color: var(--bg-button);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 5px center;
    background-size: 8px 5px;
    color: var(--text-secondary);
    font-size: 0.66rem;
    line-height: 1.2;
    text-align: left;
}

.format-options-compact .date-format-select:hover:not(:disabled) {
    border-color: var(--border-hover);
    background-color: var(--bg-button-hover);
}

.format-options-compact .date-format-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

@media (max-width: 1199px) {
    .main-content {
        grid-template-columns: minmax(205px, 0.48fr) minmax(0, 1.52fr);
    }

    .main-content .left-column {
        grid-column: 2;
        grid-row: 1;
    }

    .main-content .right-column {
        grid-column: 2;
        grid-row: 2;
    }
}

@media (max-width: 768px) {
    .main-content {
        display: flex;
        flex-direction: column;
    }

    .main-content > .parameters-card,
    .main-content .left-column,
    .main-content .right-column {
        width: 100%;
    }

    .parameters-card #hemograma-dropdown,
    .parameters-card #renal-dropdown,
    .parameters-card #nutricional-dropdown,
    .parameters-card #gases-dropdown {
        top: 100%;
        left: 0;
    }

    .format-options-compact .format-options-grid {
        flex-direction: row;
    }
}

/* =========================================
   MENSAJE Y CONTACTO DEL CREADOR
   ========================================= */
.creator-message {
    display: flex;
    width: fit-content;
    max-width: 100%;
    min-height: 52px;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 0;
    margin-top: 15px;
    margin-left: auto;
    padding: 8px 10px;
    box-sizing: border-box;
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    transition: width 0.3s ease, gap 0.3s ease;
}

.creator-message[hidden] {
    display: none;
}

.creator-message.is-open {
    width: 100%;
    gap: 10px;
}

.creator-message p {
    width: 0;
    max-width: 0;
    max-height: 0;
    flex: 0 1 auto;
    margin: 0;
    overflow: hidden;
    opacity: 0;
    line-height: 1.45;
    transition: max-width 0.3s ease, max-height 0.3s ease, opacity 0.2s ease;
}

.creator-message.is-open p {
    width: auto;
    max-width: 100%;
    max-height: 120px;
    flex: 1;
    opacity: 1;
}

.creator-message strong {
    color: var(--text-primary);
}

.creator-contact-actions {
    display: flex;
    align-items: center;
    align-self: flex-end;
    flex-shrink: 0;
    gap: 6px;
}

.creator-contact-toggle {
    order: 2;
}

.creator-contact-toggle,
.creator-contact-button {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border-primary);
    border-radius: 7px;
    background: var(--bg-button);
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.creator-contact-toggle:hover,
.creator-contact-button:hover {
    border-color: var(--border-hover);
    background: var(--bg-button-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.creator-contact-toggle svg {
    transform: rotate(180deg);
    transition: transform 0.25s ease;
}

.creator-contact-toggle[aria-expanded="true"] svg {
    transform: rotate(0deg);
}

.creator-contact-options {
    order: 1;
    display: flex;
    max-width: 0;
    gap: 6px;
    overflow: hidden;
    opacity: 0;
    transform: translateX(-6px);
    transition: max-width 0.3s ease, opacity 0.2s ease, transform 0.3s ease;
}

.creator-contact-options.show {
    max-width: 90px;
    opacity: 1;
    transform: translateX(0);
}

.creator-contact-button.whatsapp {
    color: #22c55e;
}

.creator-contact-button.email {
    color: #4e80ee;
}

@media (max-width: 768px) {
    .creator-message.is-open {
        align-items: flex-start;
        flex-direction: column;
    }

    .creator-contact-actions {
        align-self: flex-end;
    }
}
