/**
 * Admin styles
 *
 * @since 1.0.0
 * @package Top Bar Notification & Sticky Banners
 */

/************** ALL PLUGIN ADMIN PAGES ****************/

body.topbarnsb-any_admin .wrap h1:before {
	content: url(../icons/icon-topbarnsb.svg);
	display: inline-block;
	vertical-align: middle;
	margin-right: 2px;
}


/***************** BANNERS CPT LIST *******************/

body.post-type-topbarnsb .ui-sortable-helper {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.3s ease;
	background: aliceblue;
}
body.post-type-topbarnsb .ui-draggable-handle, 
body.post-type-topbarnsb .ui-sortable-handle {
	cursor: move;
}

/* Simplify MCE: */
body.topbarnsb-editing_cpt_banner .topbarnsb_banner_class,
body.topbarnsb-editing_cpt_banner #insert-media-button,
body.topbarnsb-editing_cpt_banner .topbarnsb_banner_pos { 
	display: none !important
}

/* Remove the default order by date arrow highlighting */
body.topbarnsb-admin_banner_my_order th.sorted.desc:hover .sorting-indicator.asc:before,
body.topbarnsb-admin_banner_my_order th.sorted.desc .sorting-indicator.desc:before {
	color: #a7aaad !important;
}

/*************** SETTINGS PAGE OPTIONS ****************/

.topbarnsb-settings-nav {
    position: sticky;
    top: 32px;
    background: #ddd;
    padding: 1px;
    z-index: 1000;
    border-radius: 5px;
	border-top: 10px #f0f0f1 solid;
	border-bottom: 10px #f0f0f1 solid;
}
.topbarnsb-settings-nav ul {
	display: flex;
}
.topbarnsb-settings-nav a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
	display: block;
}
.topbarnsb-settings-nav li {
	margin-left: 20px;
}
.topbarnsb-settings-nav li.topbarnsb-save {
	flex:1;
	text-align: right;
	padding-right: 20px;
}
.topbarnsb-settings-nav .topbarnsb-icon {
	background: #999;
}
.topbarnsb-settings-nav a:hover {
	color: #733867;
}
.topbarnsb-settings-nav a:hover .topbarnsb-icon {
	color: #fff;
	background: #a36597;
}
.topbarnsb-settings-anchor {
	position: absolute;
	margin-top: -90px;
}


.topbarnsb-pane table {
	border: 1px solid #c3c4c7;
	max-width: 800px;
	margin-bottom: 30px;
}
	.topbarnsb-pane table th {
		padding: 12px 10px 12px 20px;
	}
	.topbarnsb-pane table tr:first-child th {
		padding-top: 22px;
	}
	.topbarnsb-pane table tr:last-child th {
		padding-bottom: 22px;
	}
	.topbarnsb-pane table td {
		padding: 7px 20px 7px 40px;
	}
	.topbarnsb-pane table tr:first-child td {
		padding-top: 17px;
	}
	.topbarnsb-pane table tr:last-child td {
		padding-bottom: 17px;
	}
	.topbarnsb-pane textarea {
		width: 100%;
		height: 200px;
	}
	.topbarnsb-pane .topbarnsb_settings_extra_fonts____font_embed label,
	.topbarnsb-pane .topbarnsb_settings_site_fonts____font_embed label {
		display: block;
		width: 100%;
	}
	.topbarnsb-pane.custom table {
		max-width: 1200px;
	}

	.topbarnsb-pane input[readonly] {
		cursor: not-allowed;
		color: #888;
	}

.topbarnsb-icon {
    padding: 5px;
    background: #a36597;
    color: #fff;
    border-radius: 50%;
    vertical-align: sub;
    margin-right: 5px;
}

/* Repeater fonts */

.topbarnsb-pane.fonts tr:nth-child(2) {
	border-top: #999 1px solid;
}
.topbarnsb-pane.fonts td {
    padding-top: 20px;
    padding-bottom: 20px;
}
.topbarnsb-repeater-group fieldset.topbarnsb,
.topbarnsb-repeater-group fieldset.topbarnsb p {
	display: block;
}
.topbarnsb-repeater-group fieldset.topbarnsb p {
	min-height: auto;
	margin-bottom: 10px;
}
.topbarnsb-repeater-group fieldset.topbarnsb textarea {
	height: 50px;
}
.topbarnsb-repeater-group .repeater-item {
    border-bottom: #999 1px solid;
    padding-bottom: 20px;
    margin-bottom: 20px;
}
.repeater-item fieldset.topbarnsb .topbarnsb-help {
	margin-left: -30px;
}


/*************** SHARED CPT / SETTINGS  ****************/

.topbarnsb-nicecheck {
	display: inline-block;
	width:38px;
	height:20px;
	position: relative;
}
	.topbarnsb-nicecheck input {
		opacity: 0;
		width: 0;
		height: 0;
	}
	.topbarnsb-nicecheck .slider {
	  border-radius: 18px;
	  position: absolute;
	  cursor: pointer;
	  top: 0;
	  left: 0;
	  right: 0;
	  bottom: 0;
	  background-color: #ccc;
	  border: 2px solid #ccc;
	  -webkit-transition: .4s;
	  transition: .4s;
	}
	.topbarnsb-nicecheck .slider:before {
		border-radius: 50%;
		position: absolute;
		content: "";
		height: 14px;
		width: 15px;
		left: 2px;
		top: 1px;
		background-color: #ffffff;
		-webkit-transition: .4s;
		transition: .4s;
	}
	.topbarnsb-nicecheck input:checked + .slider {
		background-color: #a36597;
		border: 2px solid #a36597;
	}
	.topbarnsb-nicecheck input:checked + .slider:before {
		transform: translateX(16px);
	}

/* help tooltips */
.topbarnsb-help {
	position: absolute;
	margin-left: -30px;
	font-size: 1.2em;
	margin-top: 5px;
	color: #666;
	cursor: help;
}
.tooltip-text {
    visibility: hidden;
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 8px;
    border-radius: 5px;
    position: absolute;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: normal; /* Permet que el text ocupi diverses línies */
    max-width: 200px; /* Limita l'amplada màxima del tooltip */
    font-size: 14px;
    line-height: 1.4;
}
	.tooltip-text::after {
		content: "";
		position: absolute;
		top: 100%; /* Situa la fletxeta just sota el tooltip */
		left: 50%;
		transform: translateX(-50%) rotate(45deg); /* Gira el quadrat 45 graus per formar un triangle */
		width: 10px; /* Amplada de la fletxeta */
		height: 10px; /* Alçada de la fletxeta */
		background-color: #333; /* Color de la fletxeta que coincideix amb el tooltip */
		z-index: -1; /* Ens assegurem que no interfereix amb el hover */
		margin-top: -5px; /* Ajustar el marge per fer que la punta es col·loqui exactament on volem */
	}

/*************** CPT CUSTOM FIELDS ****************/

fieldset.topbarnsb {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	max-width: 900px;
}
fieldset.topbarnsb p {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	min-height: 50px;
	margin: 0;
}
	fieldset.topbarnsb .topbarnsb-help {
		margin-left: 193px;
	}
	fieldset.topbarnsb input[type="text"] {
		width: 102px;
	}
	fieldset.topbarnsb input[type="text"].text-input {
		width: 200px;
	}
	fieldset.topbarnsb label {
		font-weight: 500;
		width: 200px;
		padding-right: 20px;
	}
	fieldset.topbarnsb .wp-picker-active {
		margin-bottom: 20px;
	}
	fieldset.topbarnsb .color-wrapper label {
		padding-right: 0;
		width: auto;
		font-weight: normal;
	}

@media screen and (max-width: 850px) {
	fieldset.topbarnsb {
		display: block;
	}
}

fieldset.topbarnsb h3 {
	margin-top: 0;
	margin-bottom: 0.5em;
}

.topbarnsb_style_basics,
.topbarnsb_banner_class,
.topbarnsb_banner_cta_on,
.topbarnsb_style_cta,
.topbarnsb_style_textlink,
.topbarnsb_style_custom_css {
	border-top: #aaa 1px solid;
	padding-top: 22px;
}

#topbarnsb_banner_cf .inside {
	padding-top: 15px;
}
#topbarnsb_banner_cf fieldset {
	display: block;
}
#topbarnsb_banner_cf input {
	width: 200px;
}
fieldset.topbarnsb_style_custom_css {
	display: block;
}
	fieldset.topbarnsb_style_custom_css p {
		width: auto;
	}

.topbarnsb_style_custom_css textarea,
.topbarnsb_banner_cta_url textarea {
	height: 45px;
	max-width: 600px;
	margin-bottom: 20px;
	flex: 1 1 auto;
	resize: vertical;
}
.topbarnsb_style_custom_css textarea {
	height: 100px;
}

#topbarnsb_banner_cf .topbarnsb_banner_cta_blank,
#topbarnsb_banner_cf .topbarnsb_banner_cta_url,
#topbarnsb_banner_cf .topbarnsb_banner_cta_text {
	display: none;
}


/* Tune a bit the editor page for CPT styles only */
body.topbarnsb-editing_cpt_style #minor-publishing {
	display: none;
}
@media screen and (max-width: 1320px) {
	body.topbarnsb-editing_cpt_style #post-body {
		display: flex;
		flex-direction: column;
		margin-right: 0 !important;
	}
	body.topbarnsb-editing_cpt_style #postbox-container-1 {
		order: 1;
	}
	body.topbarnsb-editing_cpt_style #side-sortables,
	body.topbarnsb-editing_cpt_style #poststuff .postbox-container {
		width: auto !important;
		margin: 0 !important;;
		float: none !important;
	}
}

/***************** BANNER STYLES PREVIEW *******************/

.topbarnsb-admin-preview {
	position: sticky;
	top: 32px;
	background: #fff;
	padding: 5px 0 20px 0;
	margin-bottom: 10px;
	z-index: 1;
}
#topbarnsb_banner_preview {
	position: sticky;
	top: 32px;
	z-index: 1;
}
#topbarnsb_banner_preview .topbarnsb-admin-preview {
	padding: 5px 0;
	margin: 0;
	position: static;
}
.topbarnsb-admin-preview .topbarnsb-item {
	text-align: center;
	display: flex;
	align-items: center;
	justify-content: center;
}

	.topbarnsb-admin-preview .inner {
		padding: 16px 40px;
		display: flex;
		justify-content: center;
		align-items: center;
		width: 100%;
	}
	.topbarnsb-admin-preview .inner img {
		max-width: 100%;
		height: auto;
	}
	
	.topbarnsb-admin-preview p {
		margin-top: 0.5em;
		margin-bottom: 0.5em;
		line-height: 1.2em;
	}

	.topbarnsb-admin-preview .text,
	.topbarnsb-admin-preview .cta {
		margin-right: 20px;
	}
		.topbarnsb-admin-preview .cta a {
			line-height: 1em;
			display: inline-block;
			font-weight: bold;
			text-decoration: none !important;
			padding: 8px 16px;
		}

 /* Layouts */

.topbarnsb-admin-preview .all-left .inner {
	justify-content: flex-start;
}
.topbarnsb-admin-preview .all-right .inner {
	justify-content: flex-end;
}
.topbarnsb-admin-preview .button-right .text {
	flex: 1;
}
.topbarnsb-admin-preview .expanded .inner {
	justify-content: space-between;
}
.topbarnsb-admin-preview .topbarnsb-item[class*="below"] .inner {
	display: block;
}
	.topbarnsb-admin-preview .topbarnsb-item[class*="below"] .cta {
		margin-top: 10px;
	}
.topbarnsb-admin-preview .right-below p,
.topbarnsb-admin-preview .right-below .cta {
	text-align: right;
}
.topbarnsb-admin-preview .left-below p,
.topbarnsb-admin-preview .left-below .cta {
	text-align: left;
}

.topbarnsb-inline-help {
	margin-top: -10px;
	margin-left: 220px;
}

 /* Other stuff */
 
.button.topbarnsb-sniff-fonts {
	border-color: #a36597;
	background-color: #a36597;
	color: #fff;
	font-weight: 600;
}
.button.topbarnsb-sniff-fonts:hover {
	background: #8b4c7f;
	color: #fff;
	border-color: #8b4c7f;
}
.topbarnsb-silent {
	position: fixed; 
	top: 0;
	left: 0;
	width: 30px;
	height: 30px;
	z-index: -1;
}
.topbarnsb-overlay {
	position: fixed;
	left: 0;
	top: 0;
	right: 0;
	height:100vh;
	background: #333333DD;
	z-index: 1000000000;
	display: flex;
    justify-content: center;
    align-items: center;
    animation: topbarnsb-fade-in 1s forwards; /* Animació de fosa */
	cursor: wait;
}
.topbarnsb-overlay .topbarnsb-rotator {
	position: absolute;
	width: 40px;
	height: 40px;
	border: #a2a2a2 4px solid;
	border-bottom-color: #b661a6;
	border-radius: 50%;
    animation: topbarnsb-rotation 0.6s linear infinite;
}
.topbarnsb-overlay .topbarnsb-icon {
    font-size: 40px;
	width: 1em;
    height: 1em;
    border-radius: 50%;
	background: none;
    color: #ccc;
	display: flex;
    justify-content: center;
    align-items: center;
}
.topbarnsb-overlay .topbarnsb-icon .dashicons {
    animation: topbarnsb-grow-shrink 2s infinite;
}

/* Fade animation */
@keyframes topbarnsb-fade-in {
    0% {
        opacity: 0; /* Transparent */
    }
    100% {
        opacity: 1; /* Opac complet */
    }
}

@keyframes topbarnsb-grow-shrink {
    0% {
        transform: scale(1.4);
    }
    50% {
        transform: scale(1.7);
    }
    100% {
        transform: scale(1.4);
    }
}

@keyframes topbarnsb-rotation {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}