/* =============================================================================
   TVS Distribuidores — Frontend Styles
   Prefix: .tvs-
   ============================================================================= */

/* Custom properties */
.tvs-distribuidores {
	--tvs-red       : #CC0000;
	--tvs-red-dark  : #aa0000;
	--tvs-gray-100  : #f8f9fa;
	--tvs-gray-200  : #e9ecef;
	--tvs-gray-400  : #ced4da;
	--tvs-gray-600  : #6c757d;
	--tvs-gray-800  : #343a40;
	--tvs-blue      : #4285F4;
	--tvs-green     : #198754;
	--tvs-radius    : 6px;
	--tvs-shadow    : 0 2px 8px rgba(0,0,0,.10);
	--tvs-font      : system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Reset scope */
.tvs-distribuidores *,
.tvs-distribuidores *::before,
.tvs-distribuidores *::after {
	box-sizing: border-box;
}

/* Inline SVG icons: always vertically centered */
.tvs-distribuidores svg {
	display       : inline-block;
	vertical-align: middle;
	flex-shrink   : 0;
}

.tvs-distribuidores {
	font-family   : var(--tvs-font);
	font-size     : 15px;
	color         : var(--tvs-gray-800);
	line-height   : 1.5;
}

/* Utilities */
.tvs-hidden { display: none !important; }

/* =============================================================================
   Loading
   ============================================================================= */

.tvs-loading {
	display        : flex;
	align-items    : center;
	justify-content: center;
	gap            : 10px;
	padding        : 40px;
	color          : var(--tvs-gray-600);
}

.tvs-loading-spinner {
	display      : inline-block;
	width        : 20px;
	height       : 20px;
	border       : 3px solid var(--tvs-gray-200);
	border-top   : 3px solid var(--tvs-red);
	border-radius: 50%;
	animation    : tvs-spin .7s linear infinite;
}

@keyframes tvs-spin { to { transform: rotate(360deg); } }

/* =============================================================================
   Notices
   ============================================================================= */

.tvs-notice-no-api {
	padding      : 14px 18px;
	background   : #fff3cd;
	border-left  : 4px solid #ffc107;
	border-radius: var(--tvs-radius);
	margin-bottom: 16px;
	font-size    : 14px;
}

.tvs-error {
	padding      : 20px;
	background   : #f8d7da;
	border-left  : 4px solid #dc3545;
	border-radius: var(--tvs-radius);
	color        : #721c24;
}

.tvs-empty {
	padding      : 30px;
	text-align   : center;
	color        : var(--tvs-gray-600);
	font-style   : italic;
}

/* =============================================================================
   Wrapper & Controls
   ============================================================================= */

.tvs-wrapper {
	display       : flex;
	flex-direction: column;
	gap           : 0;
}

.tvs-controls {
	background    : var(--tvs-gray-100);
	border        : 1px solid var(--tvs-gray-200);
	border-radius : var(--tvs-radius) var(--tvs-radius) 0 0;
	padding       : 14px 16px;
	display       : flex;
	flex-direction: column;
	gap           : 10px;
}

.tvs-row {
	display    : flex;
	flex-wrap  : wrap;
	align-items: center;
	gap        : 10px;
}

.tvs-search-wrap {
	flex     : 1;
	min-width: 200px;
}

/* Search input */
.tvs-search-input {
	width        : 100%;
	padding      : 8px 12px;
	border       : 1px solid var(--tvs-gray-400);
	border-radius: var(--tvs-radius);
	font-size    : 14px;
	outline      : none;
	background   : #fff;
	transition   : border-color .15s;
}
.tvs-search-input:focus { border-color: var(--tvs-red); }

/* Select */
.tvs-select {
	padding      : 8px 10px;
	border       : 1px solid var(--tvs-gray-400);
	border-radius: var(--tvs-radius);
	font-size    : 14px;
	background   : #fff;
	cursor       : pointer;
	max-width    : 240px;
}
.tvs-select:focus { outline: 2px solid var(--tvs-red); }

/* Type toggle */
.tvs-type-toggle {
	display   : flex;
	gap       : 4px;
	flex-wrap : wrap;
}

.tvs-btn-type {
	padding      : 6px 12px;
	border       : 1px solid var(--tvs-gray-400);
	border-radius: 20px;
	font-size    : 13px;
	background   : #fff;
	cursor       : pointer;
	transition   : all .15s;
	color        : var(--tvs-gray-800);
}
.tvs-btn-type:hover { border-color: var(--tvs-red); color: var(--tvs-red); }
.tvs-btn-type.tvs-active {
	background  : var(--tvs-red);
	border-color: var(--tvs-red);
	color       : #fff;
}

/* Geo button */
.tvs-btn-geo {
	padding      : 8px 14px;
	background   : #fff;
	border       : 1px solid var(--tvs-gray-400);
	border-radius: var(--tvs-radius);
	font-size    : 13px;
	cursor       : pointer;
	white-space  : nowrap;
	transition   : all .15s;
}
.tvs-btn-geo:hover:not(:disabled) { border-color: var(--tvs-blue); color: var(--tvs-blue); }
.tvs-btn-geo:disabled { opacity: .5; cursor: wait; }

/* Counter */
.tvs-counter {
	font-size  : 13px;
	color      : var(--tvs-gray-600);
	margin-left: auto;
}

/* View toggle */
.tvs-view-toggle {
	display : flex;
	gap     : 4px;
}

.tvs-btn-view {
	padding      : 7px 14px;
	border       : 1px solid var(--tvs-gray-400);
	border-radius: var(--tvs-radius);
	font-size    : 13px;
	background   : #fff;
	cursor       : pointer;
	transition   : all .15s;
}
.tvs-btn-view:first-child { border-radius: var(--tvs-radius) 0 0 var(--tvs-radius); }
.tvs-btn-view:last-child  { border-radius: 0 var(--tvs-radius) var(--tvs-radius) 0; border-left: none; }
.tvs-btn-view.tvs-active  { background: var(--tvs-red); border-color: var(--tvs-red); color: #fff; }

/* =============================================================================
   Map
   ============================================================================= */

#tvs-map-wrap {
	border       : 1px solid var(--tvs-gray-200);
	border-top   : none;
	border-radius: 0 0 var(--tvs-radius) var(--tvs-radius);
}

.tvs-map {
	width : 100%;
	height: 500px;
}

.tvs-map-error {
	padding   : 60px 20px;
	text-align: center;
	color     : var(--tvs-gray-600);
}

/* =============================================================================
   List / Cards
   ============================================================================= */

.tvs-list-wrap {
	border       : 1px solid var(--tvs-gray-200);
	border-top   : none;
	border-radius: 0 0 var(--tvs-radius) var(--tvs-radius);
	padding      : 16px;
}

.tvs-list {
	display              : grid;
	grid-template-columns: repeat(3, 1fr);
	gap                  : 16px;
}

.tvs-card {
	background   : #fff;
	border       : 1px solid var(--tvs-gray-200);
	border-radius: var(--tvs-radius);
	padding      : 16px;
	box-shadow   : var(--tvs-shadow);
	display      : flex;
	flex-direction: column;
	gap          : 6px;
	transition   : box-shadow .15s;
}
.tvs-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.14); }

.tvs-card-header {
	display    : flex;
	align-items: flex-start;
	gap        : 8px;
}

.tvs-card-name {
	margin    : 0;
	font-size : 15px;
	font-weight: 700;
	flex      : 1;
	line-height: 1.3;
}

.tvs-card-badges {
	display: flex;
	gap    : 6px;
	flex-wrap: wrap;
}

/* Badges */
.tvs-badge {
	display      : inline-block;
	font-size    : 11px;
	font-weight  : 600;
	padding      : 2px 8px;
	border-radius: 20px;
	white-space  : nowrap;
}
.tvs-badge-dist-tipo { background: #fff0f0; color: var(--tvs-red); }
.tvs-badge-taller    { background: #e8f4fd; color: #0056b3; }
.tvs-badge-dist      { background: #e8f8e8; color: var(--tvs-green); }

.tvs-card-location {
	margin    : 0;
	font-size : 13px;
	color     : var(--tvs-gray-600);
}

.tvs-card-address {
	margin    : 0;
	font-size : 13px;
	color     : var(--tvs-gray-600);
}

.tvs-card-actions {
	display  : flex;
	flex-wrap: wrap;
	gap      : 6px;
	margin-top: auto;
	padding-top: 8px;
}

.tvs-card-btn {
	display      : inline-flex;
	align-items  : center;
	gap          : 4px;
	padding      : 5px 10px;
	border-radius: var(--tvs-radius);
	font-size    : 12px;
	font-weight  : 600;
	text-decoration: none;
	transition   : opacity .15s;
	border       : 1px solid transparent;
}
.tvs-card-btn:hover { opacity: .85; }

.tvs-btn-wa    { background: #25D366; color: #fff; }
.tvs-btn-tel   { background: #fff; color: var(--tvs-gray-800); border-color: var(--tvs-gray-400); }
.tvs-btn-email { background: #fff; color: var(--tvs-gray-800); border-color: var(--tvs-gray-400); }
.tvs-btn-maps  { background: var(--tvs-red); color: #fff; }

/* =============================================================================
   Responsive
   ============================================================================= */

@media ( max-width: 1024px ) {
	.tvs-list {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media ( max-width: 768px ) {
	.tvs-map { height: 350px; }

	.tvs-list {
		grid-template-columns: 1fr;
	}

	.tvs-row--search {
		flex-direction: column;
		align-items   : stretch;
	}

	.tvs-select { max-width: 100%; }

	.tvs-counter { margin-left: 0; }

	.tvs-row--actions {
		justify-content: space-between;
	}

	.tvs-type-toggle { order: 3; width: 100%; }
}

@media ( max-width: 480px ) {
	.tvs-btn-type { font-size: 12px; padding: 5px 9px; }
}
