/* SF Reportes Sucursales v1.2.0 - Smart Future */

/* ============================================
   BASE
   ============================================ */
.sfsuc-wrap { max-width: 100%; margin: 0 auto; font-family: inherit; }
.sfsuc-card { max-width: 520px; margin: 20px auto; padding: 24px; border: 1px solid #e6e6e6; border-radius: 14px; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.sfsuc-muted { opacity: .6; font-size: 0.85em; }

/* ============================================
   HEADER
   ============================================ */
.sfsuc-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.sfsuc-top-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sfsuc-top-left h2 { margin: 0; }
.sfsuc-right { text-align: right; }

/* Badge sucursal fija */
.sfsuc-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; background: #eee; font-size: 12px; font-weight: 700; color: #555; }

/* ===== BADGE "PROCESANDO" en header ===== */
.sfsuc-processing-badge {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 6px 14px;
	border-radius: 20px;
	background: #fff7e6;
	border: 1.5px solid #f0a500;
	color: #a06000;
	font-size: 13px;
	font-weight: 700;
	animation: sfsuc-pulse-border 2s ease-in-out infinite;
}
.sfsuc-processing-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #f0a500;
	display: inline-block;
	animation: sfsuc-blink 1.2s ease-in-out infinite;
	flex-shrink: 0;
}
@keyframes sfsuc-blink {
	0%, 100% { opacity: 1; }
	50%       { opacity: 0.3; }
}
@keyframes sfsuc-pulse-border {
	0%, 100% { box-shadow: 0 0 0 0 rgba(240,165,0,0.3); }
	50%       { box-shadow: 0 0 0 4px rgba(240,165,0,0.12); }
}

/* ============================================
   FILTROS
   ============================================ */
.sfsuc-filters { margin: 20px 0; background: #f9f9f9; padding: 20px; border-radius: 14px; border: 1px solid #eee; }
.sfsuc-grid { display: flex; flex-wrap: wrap; gap: 15px; align-items: flex-end; }
.sfsuc-field { min-width: 140px; flex: 1; }
.sfsuc-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #444; }
.sfsuc-field input, .sfsuc-field select { width: 100%; padding: 10px 12px; border: 1px solid #ccc; border-radius: 8px; background: #fff; height: 42px; font-size: 14px; box-sizing: border-box; }
.sfsuc-grow { flex: 2; min-width: 250px; }
.sfsuc-btn-group { flex: 0 0 auto; min-width: auto; }

/* ============================================
   BUTTONS
   ============================================ */
.sfsuc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 20px; height: 42px; border-radius: 8px; border: 1px solid #ddd; text-decoration: none !important; cursor: pointer; background: #fff; transition: all 0.2s; font-size: 14px; font-weight: 500; color: #333; box-sizing: border-box; }
.sfsuc-btn-primary { border-color: #111; background: #111; color: #fff !important; }
.sfsuc-btn-primary:hover { background: #333; border-color: #333; }
.sfsuc-btn-ghost { background: #fff; color: #333 !important; border-color: #ddd; }
.sfsuc-btn-ghost:hover { background: #f5f5f5; border-color: #ccc; }
.sfsuc-btn.is-disabled { pointer-events: none; opacity: .45; }

/* ============================================
   ACCIONES / BARRA
   ============================================ */
.sfsuc-actions { display: flex; justify-content: space-between; align-items: center; margin: 15px 0; }

/* ============================================
   TABLA
   ============================================ */
.sfsuc-table-card { border: 1px solid #e6e6e6; border-radius: 14px; background: #fff; overflow-x: auto; box-shadow: 0 2px 8px rgba(0,0,0,0.02); }
.sfsuc-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 960px; }
.sfsuc-table th { background: #f4f4f4; padding: 12px 14px; text-align: left; font-weight: 700; color: #333; border-bottom: 2px solid #eee; white-space: nowrap; }
.sfsuc-table td { padding: 11px 14px; border-bottom: 1px solid #eee; vertical-align: middle; }
.sfsuc-table tbody tr:last-child td { border-bottom: none; }

/* ===== FILA PROCESANDO: aviso visual fuerte ===== */
.sfsuc-row-processing td {
	background-color: #fffbf0 !important;
}
.sfsuc-row-processing {
	border-left: 4px solid #f0a500 !important;
	position: relative;
}
.sfsuc-row-processing:hover td {
	background-color: #fff4d6 !important;
}

/* Filas según estado de entrega (cuando NO es processing) */
.sfsuc-row-no_entregado:not(.sfsuc-row-processing) td { background-color: #fffdf2 !important; }
.sfsuc-row-entregado:not(.sfsuc-row-processing) td   { background-color: #f1fbf4 !important; }
.sfsuc-row-rechazado:not(.sfsuc-row-processing) td   { background-color: #fff2f2 !important; }

/* ===== BADGE DE ESTADO EN CELDA ===== */
.sfsuc-status-badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 10px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 700;
	white-space: nowrap;
}
.sfsuc-status-processing {
	background: #fff3cd;
	color: #856404;
	border: 1px solid #f0a500;
}
.sfsuc-status-completed {
	background: #d4edda;
	color: #155724;
	border: 1px solid #28a745;
}
.sfsuc-status-cancelled {
	background: #f8d7da;
	color: #721c24;
	border: 1px solid #dc3545;
}
.sfsuc-status-on-hold {
	background: #e2e3e5;
	color: #383d41;
	border: 1px solid #aaa;
}

/* ===== COMPRADOR ===== */
.sfsuc-buyer-name { font-weight: 600; color: #222; }
.sfsuc-buyer-sub { font-size: 11px; color: #888; margin-top: 1px; }

/* ===== DÍA DE RETIRO ===== */
.sfsuc-pickup-day {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 6px;
	background: #e8f4fd;
	color: #0c5460;
	border: 1px solid #b8d9ec;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}

/* ===== NOTAS DEL PEDIDO ===== */
.sfsuc-note {
	font-size: 12px;
	color: #555;
	cursor: help;
	border-bottom: 1px dashed #bbb;
	max-width: 160px;
	display: inline-block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	vertical-align: bottom;
}

/* ============================================
   ENTREGA: pills
   ============================================ */
.sfsuc-center { text-align: center; }
.sfsuc-delivery-icons { display: flex; gap: 6px; justify-content: center; align-items: center; }
.sfsuc-pill { width: 32px; height: 32px; border-radius: 8px; border: 1px solid #ddd; background: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; padding: 0; transition: all 0.2s; color: #aaa; }
.sfsuc-pill:hover { border-color: #999; color: #555; }
.sfsuc-pill.is-active { color: #fff; }
.sfsuc-pill.is-noentregado.is-active { background: #e7c24b; border-color: #e7c24b; }
.sfsuc-pill.is-entregado.is-active   { background: #2e8b57; border-color: #2e8b57; }
.sfsuc-pill.is-rechazado.is-active   { background: #d33;    border-color: #d33;    }

/* ============================================
   BOTÓN CANCELAR
   ============================================ */
.sfsuc-x { border: 1px solid #ddd; background: #fff; border-radius: 8px; width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: #666; transition: all 0.2s; padding: 0; }
.sfsuc-x:hover { border-color: #d33; background: #fff2f2; color: #d33; }
.sfsuc-btn-delete svg { display: block; }

/* ============================================
   NOTICES
   ============================================ */
.sfsuc-notice { margin: 15px 0; padding: 12px 16px; border-radius: 8px; border: 1px solid #ddd; background: #fcfcfc; font-size: 14px; }
.sfsuc-notice-success { border-color: #2e8b57; background: #f1fbf4; color: #1d5f3b; }
.sfsuc-notice-error   { border-color: #d33;    background: #fff2f2; color: #8a0f0f; }

/* ============================================
   PAGINACIÓN
   ============================================ */
.sfsuc-pager { display: flex; justify-content: space-between; align-items: center; margin: 20px 0; }

/* ============================================
   RESPONSIVE – mobile cards
   ============================================ */
@media (max-width: 820px) {
	.sfsuc-table-card { border: none; background: transparent; box-shadow: none; }
	.sfsuc-table, .sfsuc-table tbody, .sfsuc-table tr, .sfsuc-table td { display: block; width: 100%; min-width: 0; }
	.sfsuc-table thead { display: none; }
	.sfsuc-table tr {
		margin-bottom: 20px;
		border: 1px solid #eee;
		border-radius: 14px;
		background: #fff;
		overflow: hidden;
		box-shadow: 0 2px 8px rgba(0,0,0,0.05);
	}
	.sfsuc-table td { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; border-bottom: 1px solid #f5f5f5; text-align: right; }
	.sfsuc-table td::before { content: attr(data-label); font-weight: 700; text-align: left; font-size: 12px; color: #777; margin-right: 15px; flex-shrink: 0; }
	.sfsuc-table td:last-child { border-bottom: none; }

	/* Color de borde izquierdo en mobile */
	.sfsuc-row-processing   { border-left: 5px solid #f0a500 !important; background: #fffbf0 !important; }
	.sfsuc-row-no_entregado { border-left: 5px solid #e7c24b; }
	.sfsuc-row-entregado    { border-left: 5px solid #2e8b57; }
	.sfsuc-row-rechazado    { border-left: 5px solid #d33;    }

	.sfsuc-delivery-icons { justify-content: flex-end; }
	.sfsuc-note { max-width: 160px; }

	/* Comprador en mobile: label arriba, datos abajo en columna */
	.sfsuc-table td[data-label="Comprador"] {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}
	.sfsuc-table td[data-label="Comprador"]::before {
		margin-right: 0;
		margin-bottom: 2px;
	}
	.sfsuc-buyer-name { font-size: 14px; }
	.sfsuc-buyer-sub  { text-align: left; font-size: 12px; word-break: break-all; }
}


/* Productos list */
.sfsuc-items-list {
	margin: 0;
	padding: 0;
	list-style: none;
}
.sfsuc-items-list li {
	font-size: 0.82em;
	line-height: 1.5;
	color: var(--sfsuc-text, #1a1a2e);
	white-space: nowrap;
}
.sfsuc-items-list li + li {
	border-top: 1px solid rgba(0,0,0,0.06);
	margin-top: 2px;
	padding-top: 2px;
}

/* ── Polling: banner de pedidos nuevos ── */
#sfsuc-new-orders-banner {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #1a1a2e;
	color: #fff;
	border-left: 4px solid #f0a500;
	border-radius: 8px;
	padding: 12px 16px;
	margin-bottom: 16px;
	font-size: 0.95em;
	animation: sfsuc-banner-in 0.3s ease;
}
@keyframes sfsuc-banner-in {
	from { opacity: 0; transform: translateY(-8px); }
	to   { opacity: 1; transform: translateY(0); }
}
.sfsuc-banner-icon {
	font-size: 1.2em;
	flex-shrink: 0;
}
.sfsuc-banner-btn {
	background: #f0a500;
	color: #1a1a2e;
	border: none;
	border-radius: 6px;
	padding: 5px 14px;
	font-weight: 700;
	cursor: pointer;
	font-size: 0.9em;
	margin-left: 6px;
	transition: background 0.2s;
}
.sfsuc-banner-btn:hover { background: #ffc333; }
.sfsuc-banner-close {
	background: transparent;
	border: none;
	color: rgba(255,255,255,0.5);
	font-size: 1.2em;
	cursor: pointer;
	margin-left: auto;
	line-height: 1;
	padding: 0 4px;
	transition: color 0.2s;
}
.sfsuc-banner-close:hover { color: #fff; }
