/**
 * ============================================================================
 * ESTILOS GLOBAIS - INDOORTEC CONTRATOS
 * ============================================================================
 */

/* Reset & Base */
*,
*::before,
*::after {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

:root {
	/* Cores Primárias */
	--primary: #010246;
	--primary-hover: #07155a;
	--primary-light: #e6e9ff;
	--primary-dark: #00022f;

	/* Cores de Estado */
	--success: #10b981;
	--success-light: #d1fae5;
	--error: #ef4444;
	--error-light: #fee2e2;
	--warning: #f59e0b;
	--warning-light: #fef3c7;

	/* Neutros */
	--white: #ffffff;
	--gray-50: #f9fafb;
	--gray-100: #f3f4f6;
	--gray-200: #e5e7eb;
	--gray-300: #d1d5db;
	--gray-400: #9ca3af;
	--gray-500: #6b7280;
	--gray-600: #4b5563;
	--gray-700: #374151;
	--gray-800: #1f2937;
	--gray-900: #111827;

	/* Sombras */
	--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
	--shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
	--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
	--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
	--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

	/* Bordas */
	--radius-sm: 0.375rem;
	--radius: 0.5rem;
	--radius-md: 0.625rem;
	--radius-lg: 0.75rem;
	--radius-xl: 1rem;

	/* Transições */
	--transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
	--transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

html {
	font-size: 16px;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

body {
	font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	background-color: var(--gray-50);
	color: var(--gray-900);
	line-height: 1.5;
	min-height: 100vh;
}

/* ============================================================================
   TIPOGRAFIA
   ============================================================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
	font-weight: 600;
	line-height: 1.25;
	color: var(--gray-900);
}

h1 {
	font-size: 1.875rem;
}
h2 {
	font-size: 1.25rem;
}
h3 {
	font-size: 1.125rem;
}

p {
	color: var(--gray-600);
}

a {
	color: var(--primary);
	text-decoration: none;
	transition: color var(--transition);
}

a:hover {
	color: var(--primary-hover);
}

/* ============================================================================
   LOGO
   ============================================================================ */

.logo {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.logo-icon {
	width: 32px;
	height: 32px;
	color: var(--primary);
}

.logo-img {
	width: 40px;
	height: 40px;
	object-fit: contain;
	display: block;
	border-radius: 6px;
}

.logo-text {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--gray-900);
}

/* ============================================================================
   HEADER
   ============================================================================ */

.header {
	background: var(--white);
	border-bottom: 1px solid var(--gray-200);
	position: sticky;
	top: 0;
	z-index: 100;
}

.header-content {
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 1.5rem;
	height: 64px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.header-left {
	display: flex;
	align-items: center;
	gap: 2rem;
}

.header-right {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.nav {
	display: flex;
	gap: 0.5rem;
}

.nav-link {
	padding: 0.5rem 1rem;
	border-radius: var(--radius);
	color: var(--gray-600);
	font-weight: 500;
	font-size: 0.875rem;
	transition: all var(--transition);
}

.nav-link:hover {
	background: var(--gray-100);
	color: var(--gray-900);
}

.nav-link.active {
	background: var(--primary-light);
	color: var(--primary);
}

.user-menu {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.user-name {
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--gray-700);
}

/* ============================================================================
   BOTÕES
   ============================================================================ */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.625rem 1.25rem;
	font-size: 0.875rem;
	font-weight: 500;
	border-radius: var(--radius);
	border: none;
	cursor: pointer;
	transition: all var(--transition);
	white-space: nowrap;
}

.btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
	background: var(--primary-hover);
}

.btn-outline {
	background: transparent;
	color: var(--gray-700);
	border: 1px solid var(--gray-300);
}

.btn-outline:hover:not(:disabled) {
	background: var(--gray-100);
	border-color: var(--gray-400);
}

.btn-ghost {
	background: transparent;
	color: var(--gray-600);
}

.btn-ghost:hover:not(:disabled) {
	background: var(--gray-100);
	color: var(--gray-900);
}

.btn-danger-outline {
	background: transparent;
	color: #dc2626;
	border: 2px solid #dc2626;
}

.btn-danger-outline:hover:not(:disabled) {
	background: #fef2f2;
	border-color: #b91c1c;
	color: #b91c1c;
}

.btn-danger-outline svg {
	flex-shrink: 0;
}

.btn-sm {
	padding: 0.375rem 0.75rem;
	font-size: 0.8125rem;
}

.btn-lg {
	padding: 0.875rem 1.75rem;
	font-size: 1rem;
}

.btn-full {
	width: 100%;
}

.btn-loading {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.spinner {
	animation: spin 1s linear infinite;
}

@keyframes spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

/* ============================================================================
   FORMULÁRIOS
   ============================================================================ */

.form-group {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
}

.form-group label {
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
	padding: 0.625rem 0.875rem;
	font-size: 0.9375rem;
	border: 1px solid var(--gray-300);
	border-radius: var(--radius);
	background: var(--white);
	color: var(--gray-900);
	transition: all var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
	color: var(--gray-400);
}

.form-group input.error,
.form-group select.error {
	border-color: var(--error);
}

.form-group input.error:focus,
.form-group select.error:focus {
	box-shadow: 0 0 0 3px var(--error-light);
}

.input-hint {
	font-size: 0.75rem;
	color: var(--gray-500);
	margin-top: 0.25rem;
}

.error-message {
	font-size: 0.8125rem;
	color: var(--error);
	margin-top: 0.25rem;
}

/* Botões do formulário */
.form-actions {
	display: flex;
	gap: 1rem;
	margin-top: 2rem;
	padding-top: 2rem;
	border-top: 1px solid var(--gray-200);
}

.form-actions-spread {
	justify-content: space-between;
}

.form-actions .btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

/* ============================================================================
   ALERTAS
   ============================================================================ */

.alert {
	padding: 1rem 1.25rem;
	border-radius: var(--radius);
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	margin-bottom: 1.5rem;
}

.alert-success {
	background: var(--success-light);
	border: 1px solid var(--success);
	color: #065f46;
}

.alert-error {
	background: var(--error-light);
	border: 1px solid var(--error);
	color: #991b1b;
}

.alert-warning {
	background: var(--warning-light);
	border: 1px solid var(--warning);
	color: #92400e;
}

.alert-icon {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
}

.alert-content {
	flex: 1;
}

.alert-title {
	font-weight: 600;
	margin-bottom: 0.25rem;
}

.alert-message {
	font-size: 0.875rem;
}

.alert-close {
	background: none;
	border: none;
	cursor: pointer;
	opacity: 0.6;
	transition: opacity var(--transition);
}

.alert-close:hover {
	opacity: 1;
}

/* ============================================================================
   MODAL
   ============================================================================ */

.modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	backdrop-filter: blur(4px);
}

.modal-content {
	position: relative;
	background: var(--white);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-xl);
	max-width: 500px;
	width: 100%;
	max-height: 90vh;
	overflow: auto;
}

.modal-header {
	padding: 1.5rem 1.5rem 1rem;
	border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
	font-size: 1.125rem;
}

.modal-body {
	padding: 1.5rem;
}

.modal-footer {
	padding: 1rem 1.5rem 1.5rem;
	display: flex;
	gap: 0.75rem;
	justify-content: flex-end;
}

/* ============================================================================
   CONTAINER & LAYOUT
   ============================================================================ */

.container {
	max-width: 1000px;
	margin: 0 auto;
	padding: 0 1.5rem;
}

.main {
	padding: 2rem 0 4rem;
}

.page-header {
	margin-bottom: 2rem;
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 1rem;
}

.page-header-content {
	flex: 1;
}

.page-header h1 {
	margin-bottom: 0.5rem;
}

.page-header p {
	font-size: 1rem;
}

/* Botão de IA */
.btn-ai {
	background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
	color: white;
	border: none;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1.25rem;
	font-weight: 500;
	transition: all 0.2s ease;
	box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.btn-ai:hover:not(:disabled) {
	background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-ai svg {
	flex-shrink: 0;
}

/* Modal grande */
.modal-lg .modal-content,
.modal-content.modal-lg {
	max-width: 1200px;
	width: 95%;
	min-width: 900px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
}

.modal-lg .modal-body {
	overflow-y: auto;
	flex: 1;
}

/* Grid de 3 colunas */
.form-grid-3 {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1rem;
}

.form-grid-3 .col-span-2 {
	grid-column: span 2;
}

/* Wrapper da lista de usuários com scroll */
.users-list-wrapper {
	max-height: 206px;
	overflow-y: auto;
	border: 1px solid var(--gray-200);
	border-radius: var(--radius);
	background: var(--white);
}

.modal-close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	background: none;
	border: none;
	font-size: 1.5rem;
	color: var(--gray-500);
	cursor: pointer;
	line-height: 1;
	padding: 0.25rem;
}

.modal-close:hover {
	color: var(--gray-900);
}

.modal-header {
	position: relative;
}

.modal-description {
	margin-bottom: 1rem;
	color: var(--gray-600);
	line-height: 1.5;
}

/* ============================================================================
   TABELA DE USUÁRIOS
   ============================================================================ */

.users-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
}

.users-table thead {
	background: var(--gray-100);
}

.users-table th,
.users-table td {
	padding: 0.75rem 1rem;
	text-align: left;
	border-bottom: 1px solid var(--gray-200);
}

.users-table th {
	font-weight: 600;
	color: var(--gray-700);
}

.users-table tbody tr:hover {
	background: var(--gray-50);
}

.users-table tbody tr.user-inactive {
	opacity: 0.6;
	background: var(--gray-50);
}

.users-table code {
	background: var(--gray-100);
	padding: 0.125rem 0.375rem;
	border-radius: 4px;
	font-family: monospace;
	font-size: 0.8125rem;
}

.users-table .actions-cell {
	white-space: nowrap;
	display: flex;
	gap: 0.25rem;
}

/* Badges */
.badge {
	display: inline-flex;
	align-items: center;
	padding: 0.25rem 0.625rem;
	border-radius: 9999px;
	font-size: 0.75rem;
	font-weight: 500;
}

.badge-primary {
	background: var(--primary-light);
	color: var(--primary-dark);
}

.badge-secondary {
	background: var(--gray-100);
	color: var(--gray-600);
}

.badge-success {
	background: var(--success-light);
	color: #065f46;
}

.badge-danger {
	background: var(--error-light);
	color: #b91c1c;
}

.badge-warning {
	background: var(--warning-light);
	color: #92400e;
}

/* Botão danger text */
.btn-danger-text {
	color: var(--error);
}

.btn-danger-text:hover {
	background: var(--error-light);
}

/* Botão warning text */
.btn-warning-text {
	color: var(--warning);
}

.btn-warning-text:hover {
	background: var(--warning-light);
}

/* Botão success text */
.btn-success-text {
	color: var(--success);
}

.btn-success-text:hover {
	background: var(--success-light);
}

/* Botão danger outline */
.btn-danger-outline {
	background: transparent;
	border: 1px solid var(--error);
	color: var(--error);
}

.btn-danger-outline:hover {
	background: var(--error);
	color: var(--white);
}

/* Botão block */
.btn-block {
	width: 100%;
	justify-content: center;
}

/* Modal pequeno */
.modal-sm {
	max-width: 400px;
}

/* Alert */
.alert {
	padding: 0.75rem 1rem;
	border-radius: var(--radius);
	font-size: 0.875rem;
}

.alert-warning {
	background: var(--warning-light);
	color: #92400e;
	border: 1px solid #fcd34d;
}

/* Loading e error text */
.loading-text,
.error-text {
	padding: 1rem;
	text-align: center;
	color: var(--gray-500);
}

.error-text {
	color: var(--error);
}

/* ============================================================================
   RESPONSIVO
   ============================================================================ */

@media (max-width: 768px) {
	.header-content {
		height: 56px;
		padding: 0 1rem;
	}

	.header-left {
		gap: 1rem;
	}

	.nav {
		display: none;
	}

	.logo-text {
		font-size: 1.125rem;
	}

	.container {
		padding: 0 1rem;
	}

	.main {
		padding: 1.5rem 0 3rem;
	}

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

	.modal-content {
		margin: 0 1rem;
	}

	.modal-lg .modal-content,
	.modal-content.modal-lg {
		min-width: auto;
		width: calc(100% - 2rem);
	}
}
