/* ==========================================================================
   MYKORANK BACK OFFICE - STYLES TABLEAUX & MODALES
   Styles pour bo-positions.php et bo-motscles.php
   ========================================================================== */

/* ==========================================================================
   1. CARD HEADER & BOUTONS PRINCIPAUX
   ========================================================================== */

.card-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-bottom: 20px;
	margin-bottom: 24px;
}

/* Bouton Ajouter (pour bo-motscles.php) */
.btn-add {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 24px;
	font-family: 'Quicksand', sans-serif;
	font-size: 14px;
	font-weight: 700;
	background: var(--secondary);
	color: var(--primary);
	border: none;
	border-radius: 12px;
	cursor: pointer;
	transition: all 0.3s ease;
}

.btn-add:hover {
	background: #ffd93d;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(248, 200, 0, 0.3);
}

.btn-add i {
	font-size: 14px;
}

/* Bouton Export (pour bo-positions.php) */
.btn-export {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 12px 24px;
	font-family: 'Quicksand', sans-serif;
	font-size: 14px;
	font-weight: 700;
	background: linear-gradient(135deg, var(--secondary) 0%, #ffd93d 100%);
	color: var(--primary);
	border: none;
	border-radius: 12px;
	cursor: pointer;
	transition: all 0.3s ease;
	box-shadow: 0 4px 12px rgba(248, 200, 0, 0.3);
}

.btn-export:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(248, 200, 0, 0.4);
}

.btn-export i {
	font-size: 14px;
}

/* ==========================================================================
   2. FILTRES
   ========================================================================== */

.filters-container {
	display: grid;
	grid-template-columns: 2fr 1.5fr 1.5fr auto;
	gap: 16px;
	align-items: end;
	margin-bottom: 24px;
}

.filter-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.filter-label {
	font-size: 13px;
	font-weight: 600;
	color: var(--text-secondary);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.filter-input,
.filter-select {
	padding: 12px 16px;
	font-family: 'Quicksand', sans-serif;
	font-size: 14px;
	font-weight: 500;
	background: var(--bg-primary);
	color: var(--text-primary);
	border: 1px solid var(--border-color);
	border-radius: 8px;
	transition: all 0.3s ease;
}

.filter-select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center; /* ← Change "center" en "bottom 14px" ou un chiffre */
	background-size: 12px;
	padding-right: 40px;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
}

.filter-input:focus,
.filter-select:focus {
	outline: none;
	border-color: var(--secondary);
	box-shadow: 0 0 0 3px rgba(248, 200, 0, 0.1);
}

.filter-input::placeholder {
	color: var(--text-muted);
}

/* Bouton Filtrer */
.btn-filter {
	padding: 12px 24px;
	font-family: 'Quicksand', sans-serif;
	font-size: 14px;
	font-weight: 700;
	background: var(--primary);
	color: var(--text-inverse);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.3s ease;
	height: fit-content;
}

.btn-filter:hover {
	background: #2d3f6e;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(31, 42, 78, 0.3);
}

/* ==========================================================================
   3. TABLEAUX
   ========================================================================== */

.table-container {
	overflow-x: auto;
	border-radius: 12px;
	border: 1px solid var(--border-color);
	margin-top: 24px;
}

/* Tables génériques */
.positions-table,
.keywords-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--bg-card);
	font-size: 14px;
}

/* En-têtes */
.positions-table thead,
.keywords-table thead {
	background: var(--bg-tertiary);
}

.positions-table th,
.keywords-table th {
	padding: 16px 12px;
	text-align: center;
	font-family: 'Baloo 2', cursive;
	font-size: 13px;
	font-weight: 700;
	color: var(--primary);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	white-space: nowrap;
	border-bottom: 2px solid var(--border-color);
}

/* Cellules */
.positions-table td,
.keywords-table td {
	padding: 16px 12px;
	text-align: center;
	font-size: 14px;
	color: var(--text-primary);
	font-weight: 500;
	border-bottom: 1px solid var(--border-color);
}

/* Hover des lignes */
.positions-table tbody tr,
.keywords-table tbody tr {
	transition: background-color 0.2s ease;
}

.positions-table tbody tr:hover,
.keywords-table tbody tr:hover {
	background: var(--bg-hover);
}

/* Dernière ligne */
.positions-table tbody tr:last-child td,
.keywords-table tbody tr:last-child td {
	border-bottom: none;
}

/* ==========================================================================
   4. CELLULES SPÉCIFIQUES
   ========================================================================== */

/* Keyword */
#positions .keyword-cell {
	font-weight: 600;
	color: var(--primary);
	cursor: pointer;
	transition: all 0.2s ease;
	text-align: center;
}

body.dark-mode #positions .keyword-cell {color: white}

#positions .keyword-cell:hover {
	color: var(--secondary);
	text-decoration: underline;
}

/* URL */
.url-cell {
	max-width: 300px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: var(--tertiary);
	font-size: 13px;
	text-align: left;
}

.url-cell:hover {
	color: var(--primary);
}

/* Position */
.position-cell {
	font-family: 'Baloo 2', cursive;
	font-size: 24px;
	font-weight: 700;
	color: var(--primary);
}

/* Évolution (pour bo-positions.php) */
.evolution-cell {
	font-weight: 700;
	font-size: 15px;
}

.evolution-positive {
	color: #27ae60;
	background-color: rgba(16, 185, 129, 0.2);
	padding: 0.25rem 0.5rem;
	border-radius: 0.5rem;
	text-align: center;
}

.evolution-negative {
	color: #e74c3c;
	background-color: rgba(239, 68, 68, 0.2);
	padding: 0.25rem 0.5rem;
	border-radius: 0.5rem;
	text-align: center;
}

.evolution-neutral {
	color: var(--text-secondary);
	background-color: rgba(136, 136, 136, 0.15);
	padding: 0.25rem 0.5rem;
	border-radius: 0.5rem;
	text-align: center;
}

/* ==========================================================================
   5. ACTIONS CELL (Boutons Modifier/Supprimer)
   ========================================================================== */

.actions-cell {
	display: flex;
	gap: 8px;
	align-items: center;
	justify-content: center;
}

.btn-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: transparent;
	border: 1px solid var(--border-color);
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.3s ease;
}

.btn-action i {
	font-size: 14px;
}

/* Bouton Modifier */
.btn-edit {
	color: var(--tertiary);
}

.btn-edit:hover {
	background: var(--tertiary);
	color: var(--text-inverse);
	border-color: var(--tertiary);
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(64, 180, 176, 0.3);
}

/* Bouton Supprimer */
.btn-delete {
	color: var(--error);
}

.btn-delete:hover {
	background: var(--error);
	color: var(--text-inverse);
	border-color: var(--error);
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   6. MODAL PARADISE - SERP RESULTS (pour bo-positions.php)
   ========================================================================== */

/* Overlay */
.modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.6);
	z-index: 9998;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
}

.modal-overlay.active {
	opacity: 1;
	visibility: visible;
}

/* Modal Paradise */
.modal-paradise {
	position: fixed;
	bottom: 0;
	left: 50%;
	margin-left: calc(var(--sidebar-width) / 2);
	transform: translateX(-50%) translateY(100%);
	width: calc(100vw - var(--sidebar-width) - 64px);
	max-width: calc(100vw - var(--sidebar-width) - 64px);
	background: var(--bg-card);
	border-radius: 16px 16px 0 0;
	box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
	z-index: 9999;
	transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
	height: 700px;
	display: flex;
	flex-direction: column;
}

.modal-paradise.active {
	transform: translateX(-50%) translateY(0);
}

/* Modal Header */
.modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 24px 32px;
	border-bottom: 2px solid var(--border-color);
}

.modal-title {
	font-family: 'Baloo 2', cursive;
	font-size: 22px;
	font-weight: 600;
	color: var(--text-primary);
	margin: 0;
	flex: 1;
	text-align: center;
	padding-right: 40px;
}

.modal-title strong {
	color: var(--tertiary);
}

.modal-title .keyword-highlight {
	color: var(--secondary);
}

.modal-close {
	width: 40px;
	height: 40px;
	border: none;
	background: var(--bg-hover);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s ease;
	flex-shrink: 0;
}

.modal-close i {
	font-size: 20px;
	color: var(--text-primary);
}

.modal-close:hover {
	background: var(--error);
	transform: rotate(90deg);
}

.modal-close:hover i {
	color: var(--text-inverse);
}

/* Modal Content */
.modal-content {
	flex: 1;
	overflow-y: auto;
	padding: 24px 32px 32px;
}

/* SERP Table */
.serp-table {
	width: 100%;
	border-collapse: collapse;
}

.serp-row {
	border-bottom: 1px solid var(--border-color);
	transition: background-color 0.2s ease;
}

.serp-row:last-child {
	border-bottom: none;
}

.serp-row:hover {
	background: var(--bg-hover);
}

.serp-table td {
	padding: 16px 12px;
	vertical-align: middle;
}

/* Position (10%) */
.serp-position {
	width: 10%;
	font-family: 'Baloo 2', cursive;
	font-size: 24px;
	font-weight: 700;
	color: var(--primary);
	text-align: center;
}

/* Favicon (10%) */
.serp-favicon {
	width: 10%;
	text-align: center;
	vertical-align: middle;
}

.serp-favicon i {
	font-size: 24px;
	color: var(--text-secondary);
}

/* Info (80%) */
.serp-info {
	width: 80%;
}

.serp-url {
	display: block;
	font-size: 13px;
	color: var(--tertiary);
	text-decoration: none;
	margin-bottom: 4px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	transition: color 0.2s ease;
}

.serp-url:hover {
	color: var(--primary);
	text-decoration: underline;
}

.serp-title {
	font-size: 16px;
	font-weight: 700;
	color: var(--text-primary);
	line-height: 1.4;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* ==========================================================================
   7. RESPONSIVE
   ========================================================================== */

@media (max-width: 1024px) {
	.filters-container {
		grid-template-columns: 1fr 1fr;
		gap: 12px;
	}
	
	.btn-filter {
		grid-column: span 2;
	}
	
	.table-container {
		overflow-x: scroll;
	}
	
	.positions-table,
	.keywords-table {
		min-width: 800px;
	}
}

@media (max-width: 768px) {
	.filters-container {
		grid-template-columns: 1fr;
	}
	
	.btn-filter {
		grid-column: span 1;
	}
	
	.card-header {
		justify-content: center;
	}
	
	.positions-table th,
	.keywords-table th,
	.positions-table td,
	.keywords-table td {
		padding: 12px 8px;
		font-size: 12px;
	}
	
	.url-cell {
		max-width: 150px;
	}
	
	.actions-cell {
		flex-direction: column;
		gap: 4px;
	}
	
	/* Modal responsive */
	.modal-paradise {
		width: 100%;
		height: 80vh;
		border-radius: 16px 16px 0 0;
	}

	.modal-header {
		padding: 20px;
	}

	.modal-title {
		font-size: 18px;
	}

	.modal-content {
		padding: 20px;
	}

	.serp-position {
		font-size: 20px;
	}

	.serp-favicon i {
		font-size: 20px;
	}

	.serp-title {
		font-size: 14px;
	}

	.serp-url {
		font-size: 12px;
	}
}

/* ==========================================================================
   8. DARK MODE ADAPTATIONS
   ========================================================================== */

/* Inputs en dark mode */
body.dark-mode .filter-input,
body.dark-mode .filter-select {
	background: var(--bg-tertiary);
}

/* Boutons action en dark mode */
body.dark-mode .btn-action {
	border-color: var(--border-color);
}

/* Table header en dark mode */
body.dark-mode .positions-table thead,
body.dark-mode .keywords-table thead {
	background: var(--bg-tertiary);
}

/* Titres de colonnes en dark mode */
body.dark-mode .positions-table th,
body.dark-mode .keywords-table th {
	color: var(--secondary);
}

/* Modal en dark mode */
body.dark-mode .modal-paradise {
	background: var(--bg-card);
}

/* Elements modal en dark mode */
body.dark-mode .modal-title strong,
body.dark-mode .serp-position {
	color: var(--secondary);
}