/* styles.css - Sistema de diseño corporativo y moderno para Cotizador Empresas RAYS */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;700&display=swap');

:root {
	/* Paleta Corporativa Rays Empresas */
	--primary: #0028A0;        /* Azul Rey Profundo corporativo */
	--primary-light: #0080FF;  /* Azul Cielo Vibrante / Cyan */
	--primary-dark: #001860;   /* Azul oscuro para bordes/contrastes */
	--accent: #0050C8;         /* Azul intermedio de acento */

	/* Colores Neutrales y de Estado */
	--bg-app: #F0F4F8;
	--bg-card: #FFFFFF;
	--bg-sidebar: #FFFFFF;
	--bg-hover: #F8FAFC;
	--text-main: #1E293B;
	--text-muted: #64748B;
	--text-light: #94A3B8;
	--border: #E2E8F0;
	--border-focus: #0080FF;

	--success: #10B981;
	--success-light: #D1FAE5;
	--warning: #F59E0B;
	--warning-light: #FEF3C7;
	--danger: #EF4444;
	--danger-light: #FEE2E2;

	/* Sombras y Radios */
	--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
	--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
	--shadow-xl: 0 20px 25px -5px rgba(0, 40, 160, 0.1), 0 10px 10px -5px rgba(0, 40, 160, 0.04);
	--radius-sm: 6px;
	--radius-md: 10px;
	--radius-lg: 16px;
	--radius-full: 9999px;

	--font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	--font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
	font-family: var(--font-main);
	background-color: var(--bg-app);
	color: var(--text-main);
	line-height: 1.5;
	font-size: 14px;
	overflow-x: hidden;
}

/* ==========================================
	ESTRUCTURA Y LAYOUT PRINCIPAL
========================================== */
.app-container {
	display: flex;
	min-height: 100vh;
	width: 100vw;
}

.sidebar-controls {
	width: 650px;
	min-width: 650px;
	background: var(--bg-sidebar);
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	height: 100vh;
	position: sticky;
	top: 0;
	box-shadow: var(--shadow-md);
	z-index: 10;
}

.preview-pane {
	flex: 1;
	background: var(--bg-app);
	padding: 40px;
	overflow-y: auto;
	height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* ==========================================
	PANEL IZQUIERDO: CABECERA Y NAVEGACIÓN
========================================== */
.sidebar-header {
	padding: 20px 24px;
	background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
	color: white;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 3px solid var(--primary-light);
}

.brand-info {
	display: flex;
	align-items: center;
	gap: 14px;
}

.brand-logo-img {
	height: 38px;
	width: auto;
	filter: brightness(0) invert(1); /* Logo en color blanco sobre fondo azul rey */
}

.brand-title h1 {
	font-family: var(--font-heading);
	font-size: 18px;
	font-weight: 700;
	letter-spacing: 0.5px;
	margin-bottom: 2px;
}

.brand-title p {
	font-size: 11px;
	color: rgba(255, 255, 255, 0.8);
	text-transform: uppercase;
	letter-spacing: 1px;
	font-weight: 500;
}

/* Tabs de Navegación */
.nav-tabs {
	display: flex;
	flex-wrap: nowrap;
	background: #F1F5F9;
	padding: 6px 4px;
	gap: 3px;
	border-bottom: 1px solid var(--border);
}

.tab-btn {
	flex: 1 1 auto;
	padding: 8px 6px;
	border: none;
	background: transparent;
	color: var(--text-muted);
	font-family: var(--font-main);
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: -0.2px;
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	white-space: nowrap;
}

.tab-btn:hover {
	color: var(--primary);
	background: rgba(255, 255, 255, 0.6);
}

.tab-btn.active {
	background: white;
	color: var(--primary);
	box-shadow: var(--shadow-sm);
}

/* Pestaña de un servicio no incluido en la cotización */
.tab-btn:disabled,
.tab-btn:disabled:hover {
	opacity: 0.4;
	cursor: not-allowed;
	color: var(--text-muted);
	background: transparent;
}

/* Contenido Scroll de Sidebar */
.sidebar-content {
	flex: 1;
	overflow-y: auto;
	padding: 24px;
}

.tab-pane {
	display: none;
	animation: fadeIn 0.25s ease-in-out;
}

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

@keyframes fadeIn {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
	FORMULARIOS Y CONTROLES UI
========================================== */
.section-title {
	font-family: var(--font-heading);
	font-size: 15px;
	font-weight: 700;
	color: var(--primary);
	margin-bottom: 16px;
	display: flex;
	align-items: center;
	gap: 8px;
	padding-bottom: 8px;
	border-bottom: 2px solid #E2E8F0;
}

.form-group {
	margin-bottom: 16px;
}

.form-group label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--text-main);
	margin-bottom: 6px;
}

.form-control {
	width: 100%;
	padding: 10px 12px;
	font-family: var(--font-main);
	font-size: 13px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--bg-card);
	color: var(--text-main);
	transition: all 0.2s ease;
}

.form-control:focus {
	outline: none;
	border-color: var(--border-focus);
	box-shadow: 0 0 0 3px rgba(0, 128, 255, 0.15);
}

textarea.form-control {
	resize: vertical;
	min-height: 80px;
}

.form-row {
	display: flex;
	gap: 12px;
}

.form-row .form-group {
	flex: 1;
}

/* Tarjeta / Área de Pegado Amadeus/Sabre */
.paste-box {
	background: linear-gradient(to bottom right, #F8FAFC, #EFF6FF);
	border: 2px dashed #93C5FD;
	border-radius: var(--radius-md);
	padding: 16px;
	margin-bottom: 20px;
	transition: all 0.3s ease;
}

.paste-box:hover, .paste-box:focus-within {
	border-color: var(--primary-light);
	background: #EFF6FF;
}

.paste-box textarea {
	width: 100%;
	min-height: 110px;
	border: 1px solid #BFDBFE;
	border-radius: var(--radius-sm);
	padding: 10px;
	font-family: monospace;
	font-size: 12px;
	background: white;
	margin-bottom: 12px;
}

/* Botones y Acciones */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 16px;
	font-family: var(--font-main);
	font-size: 13px;
	font-weight: 600;
	border-radius: var(--radius-sm);
	border: none;
	cursor: pointer;
	transition: all 0.2s ease;
	text-decoration: none;
}

.btn-primary {
	background: var(--primary);
	color: white;
	box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
	background: var(--accent);
	transform: translateY(-1px);
	box-shadow: var(--shadow-md);
}

.btn-accent {
	background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
	color: white;
	width: 100%;
	padding: 12px;
	font-size: 14px;
	box-shadow: 0 4px 10px rgba(0, 128, 255, 0.25);
}

.btn-accent:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 15px rgba(0, 128, 255, 0.35);
}

.btn-secondary {
	background: #E2E8F0;
	color: var(--text-main);
}

.btn-secondary:hover {
	background: #CBD5E1;
}

.btn-danger {
	background: var(--danger-light);
	color: var(--danger);
}

.btn-danger:hover {
	background: #FEE2E2;
	color: #DC2626;
}

.btn-sm {
	padding: 6px 10px;
	font-size: 12px;
}

/* Tarjetas de Ítems Agregados (Vuelos, Hoteles, Autos) */
.item-card {
	background: white;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	padding: 14px;
	margin-bottom: 12px;
	box-shadow: var(--shadow-sm);
	position: relative;
	border-left: 4px solid var(--primary);
	transition: all 0.2s ease;
}

.item-card:hover {
	box-shadow: var(--shadow-md);
	border-color: #CBD5E1;
}

.item-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 8px;
}

.item-title {
	font-weight: 700;
	color: var(--primary);
	font-size: 14px;
}

.item-badge {
	background: #EFF6FF;
	color: var(--primary);
	font-size: 11px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: var(--radius-full);
}

.item-details {
	font-size: 12px;
	color: var(--text-muted);
	line-height: 1.6;
}

.item-actions {
	display: flex;
	gap: 6px;
	margin-top: 10px;
	justify-content: flex-end;
}

/* ==========================================
	BARRA DE ACCIONES INFERIOR (FOOTER SIDEBAR)
========================================== */
.sidebar-footer {
	padding: 16px 24px;
	background: #F8FAFC;
	border-top: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.btn-copy-email {
	background: linear-gradient(135deg, #0028A0 0%, #0080FF 100%);
	color: white;
	font-size: 15px;
	font-weight: 700;
	padding: 14px;
	border-radius: var(--radius-md);
	box-shadow: 0 4px 14px rgba(0, 40, 160, 0.3);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-copy-email:hover {
	transform: translateY(-2px) scale(1.01);
	box-shadow: 0 8px 20px rgba(0, 40, 160, 0.4);
}

.btn-copy-email:active {
	transform: translateY(0);
}

.action-row {
	display: flex;
	gap: 8px;
}

.action-row .btn {
	flex: 1;
}

/* ==========================================
	PANEL DERECHO: VISTA PREVIA (DOCUMENTO FORMAL)
========================================== */
.preview-header-bar {
	width: 100%;
	max-width: 820px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
	flex: 0 0 auto;
}

.preview-status {
	font-size: 13px;
	font-weight: 600;
	color: var(--text-muted);
	display: flex;
	align-items: center;
	gap: 6px;
}

.status-dot {
	width: 8px;
	height: 8px;
	background: var(--success);
	border-radius: 50%;
	display: inline-block;
}

/* EL PAPEL / DOCUMENTO DE COTIZACIÓN (HOJA INFINITA) */
.document-paper {
	background: white;
	width: 100%;
	max-width: 820px;
	min-height: 1050px;
	height: fit-content;
	flex: 0 0 auto;
	overflow: visible;
	padding: 50px 60px;
	box-shadow: var(--shadow-xl);
	border-radius: var(--radius-md);
	border: 1px solid rgba(0, 0, 0, 0.05);
	position: relative;
	margin-bottom: 60px;
}

/* ESTILOS INTERNOS DEL DOCUMENTO (COMPATIBLES CON CORREO HTML) */
.doc-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-bottom: 20px;
	border-bottom: 3px solid #0028A0;
	margin-bottom: 24px;
}

.doc-logo-img {
	height: 55px !important;
	width: 150px !important;
	max-width: 150px !important;
	object-fit: contain !important;
}

#quote-document img.doc-logo-img,
#doc-header-wrapper img {
	height: 55px !important;
	width: 150px !important;
	max-width: 150px !important;
	object-fit: contain !important;
}

.doc-meta {
	text-align: right;
	font-family: var(--font-main);
	color: #333333;
	font-size: 13px;
}

.doc-title {
	font-family: var(--font-heading);
	font-size: 22px;
	font-weight: 700;
	color: #0028A0;
	margin-bottom: 4px;
	letter-spacing: -0.5px;
}

.doc-greeting {
	font-family: var(--font-main);
	font-size: 14px;
	color: #333333;
	line-height: 1.6;
	margin-bottom: 24px;
	background: #F8FAFC;
	padding: 16px 20px;
	border-left: 4px solid #0080FF;
	border-radius: 4px;
}

.doc-section {
	margin-bottom: 30px;
}

.doc-section-heading {
	font-family: var(--font-heading);
	font-size: 16px;
	font-weight: 700;
	color: #0028A0;
	margin-bottom: 12px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	display: flex;
	align-items: center;
	gap: 8px;
	border-bottom: 1px solid #E2E8F0;
	padding-bottom: 6px;
}

/* Tablas con formato limpio para Outlook / Gmail */
.doc-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 16px;
	font-family: var(--font-main);
	font-size: 13px;
}

.doc-table th {
	background-color: #0028A0;
	color: #FFFFFF;
	font-weight: 600;
	text-align: left;
	padding: 10px 12px;
	border: 1px solid #0028A0;
	font-size: 12px;
	text-transform: uppercase;
}

.doc-table td {
	padding: 10px 12px;
	border: 1px solid #CBD5E1;
	color: #1E293B;
	vertical-align: middle;
}

.doc-table tr:nth-child(even) {
	background-color: #F8FAFC;
}

.doc-table tr:hover {
	background-color: #EFF6FF;
}

/* Tarjeta de Hotel en Documento */
.doc-hotel-card {
	border: 1px solid #CBD5E1;
	border-radius: 6px;
	overflow: hidden;
	margin-bottom: 16px;
}

.doc-hotel-header {
	background: #EFF6FF;
	padding: 10px 16px;
	border-bottom: 1px solid #CBD5E1;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.doc-hotel-name {
	font-weight: 700;
	color: #0028A0;
	font-size: 15px;
}

.doc-hotel-dates {
	font-size: 12px;
	color: #475569;
	font-weight: 600;
}

.doc-hotel-body {
	padding: 14px 16px;
	font-size: 13px;
	color: #333333;
	line-height: 1.6;
}

.doc-price-tag {
	display: inline-block;
	background: #0028A0;
	color: white;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 4px;
	font-size: 13px;
	margin-top: 8px;
}

/* Desglose y Totales */
.doc-total-box {
	background: #F1F5F9;
	border: 1px solid #CBD5E1;
	border-radius: 6px;
	padding: 16px 20px;
	margin-top: 20px;
}

.doc-total-row {
	display: flex;
	justify-content: space-between;
	padding: 4px 0;
	font-size: 14px;
}

.doc-total-final {
	font-weight: 700;
	font-size: 16px;
	color: #0028A0;
	border-top: 1px solid #94A3B8;
	margin-top: 8px;
	padding-top: 8px;
}

/* Firma Corporativa */
.doc-signature {
	margin-top: 40px;
	padding-top: 24px;
	border-top: 2px solid #E2E8F0;
	display: flex;
	align-items: center;
	gap: 20px;
}

.doc-sig-logo {
	height: 45px;
	width: auto;
}

.doc-sig-text {
	font-size: 13px;
	color: #333333;
	line-height: 1.5;
}

.doc-sig-name {
	font-weight: 700;
	color: #0028A0;
	font-size: 15px;
}

.doc-sig-title {
	color: #64748B;
	font-size: 12px;
	font-weight: 600;
	margin-bottom: 4px;
}

/* ==========================================
	TOAST / NOTIFICACIONES FLOTANTES
========================================== */
.toast-container {
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 9999;
}

.toast {
	background: #1E293B;
	color: white;
	padding: 14px 24px;
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	display: flex;
	align-items: center;
	gap: 12px;
	font-weight: 600;
	font-size: 14px;
	border-left: 4px solid var(--success);
	animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideIn {
	from { transform: translateY(100%); opacity: 0; }
	to { transform: translateY(0); opacity: 1; }
}

/* ==========================================
	ESTILOS DE IMPRESIÓN Y RESPONSIVIDAD
========================================== */
@media (max-width: 1100px) {
	.app-container {
		flex-direction: column;
	}

	.sidebar-controls {
		width: 100%;
		min-width: 100%;
		height: auto;
		position: relative;
	}

	.preview-pane {
		height: auto;
		padding: 20px;
	}
}

@media print {
	.sidebar-controls, .preview-header-bar, .toast-container {
		display: none !important;
	}

	body, .app-container, .preview-pane {
		background: white !important;
		padding: 0 !important;
		margin: 0 !important;
		height: auto !important;
		overflow: visible !important;
	}

	.document-paper {
		box-shadow: none !important;
		border: none !important;
		padding: 0 !important;
		max-width: 100% !important;
		width: 100% !important;
	}
}

/* Tabla de vuelos de la vista previa: con 8 columnas no cabía en el papel y se cortaban Llegada y Clase.
   Solo afecta la vista previa: el correo copia los estilos inline de la tabla */
#doc-flights-container table th,
#doc-flights-container table td {
	padding: 8px 5px !important;
}

/* Si aun así no cabe (nombres de ciudad largos), se desplaza en vez de cortarse */
#doc-flights-container div:has(> table) {
	overflow-x: auto !important;
}

@media (max-width: 1600px) {
	.document-paper {
		padding: 40px 24px;
	}

	#doc-flights-container table {
		font-size: 12px !important;
	}
}

/* Document Preview Tables - Neutralize copied tables */
#quote-document .rich-text-preview table {
	width: 100% !important;
	border-collapse: collapse !important;
	margin: -1px 0 0 0 !important;
	font-size: 11px !important;
	background: white !important;
	color: #333 !important;
}

#quote-document .rich-text-preview table td, #quote-document .rich-text-preview table th {
	border: 1px solid #CBD5E1 !important;
	padding: 4px 8px !important; vertical-align: middle !important;
	background: transparent !important;
	color: #333 !important;
}

#quote-document .rich-text-preview table th {
	background: #F8FAFC !important;
	font-weight: bold !important;
	color: #0028A0 !important;
}

/* Remove image sizes from copied HTML to prevent breaking layout */
#quote-document .rich-text-preview img {
	max-width: 100% !important;
	height: auto !important;
}

#quote-document .rich-text-preview p,
#quote-document .rich-text-preview div {
	margin: 0 !important;
	padding: 0 !important;
}



#quote-document .rich-text-preview table table {
	margin: 0 !important;
	width: 100% !important;
}

#quote-document .rich-text-preview table table td,
#quote-document .rich-text-preview table table th {
	border: none !important;
	padding: 0 !important;
}

#quote-document .rich-text-preview input,
#quote-document .rich-text-preview select,
#quote-document .rich-text-preview textarea,
#quote-document .rich-text-preview button {
	border: none !important;
	background: transparent !important;
	padding: 0 !important;
	margin: 0 !important;
	font-family: inherit !important;
	font-size: inherit !important;
	color: inherit !important;
	width: auto !important;
	pointer-events: none !important;
	appearance: none !important;
	-webkit-appearance: none !important;
}



/* Force normal font weight for table data cells to prevent messy bolding */
#quote-document .rich-text-preview table td,
#quote-document .rich-text-preview table td *,
.form-control[contenteditable="true"] table td,
.form-control[contenteditable="true"] table td * {
	font-weight: normal !important;
}

/* Ensure table headers and the first row are bold to act as titles */
#quote-document .rich-text-preview table th,
#quote-document .rich-text-preview table th *,
#quote-document .rich-text-preview table tr:first-child td,
#quote-document .rich-text-preview table tr:first-child td *,
.form-control[contenteditable="true"] table th,
.form-control[contenteditable="true"] table th *,
.form-control[contenteditable="true"] table tr:first-child td,
.form-control[contenteditable="true"] table tr:first-child td * {
	font-weight: bold !important;
}
