// PixJet Admin SCSS
// Import variables
@import 'variables';

// Mixins
@mixin flex-center {
	display: flex;
	align-items: center;
	justify-content: center;
}

@mixin button-base {
	cursor: pointer;
	padding: 10px 20px;
	border: 0;
	border-radius: 4px;
}

@mixin button-variant($bg-color, $hover-color) {
	background: $bg-color;
	color: white;

	&:hover {
		background: $hover-color;
	}
}

// Utility classes generator
@mixin generate-spacing($property, $prefix) {
	@for $i from 1 through 6 {
		.#{$prefix}-#{$i} {
		#{$property}: #{$i * 0.5}rem;
		}
	}
}

// Main container
.pj-admin {
	// margin: 20px 20px 15px;
	position: relative;
	font-size: 1rem;
	max-width: 100%;
	box-sizing: border-box;
	margin-left: 15px;
	margin-top: 15px;
	
	// Prevent overflow issues in WordPress admin
	// overflow-x: hidden;

	// Typography
	h2 {
		font-size: 1.5rem;
		margin: 0;
	}

	a {
		text-decoration: none;
		color: white;

		&:hover {
			text-decoration: none;
			color: white;
		}
	}

	// Loader
	#pixjet_loader {
		position: fixed;
		left: 0;
		right: 0;
		top: 0;
		bottom: 0;
		@include flex-center;
		z-index: 1;

		&::before {
			content: "";
			position: fixed;
			left: 0;
			right: 0;
			top: 0;
			bottom: 0;
			@include flex-center;
			z-index: 1;
			backdrop-filter: blur(3px);
			background: hsl(0deg 0% 100% / 10%);
		}
	}

	.bars {
		z-index: 2;
		width: 50.4px;
		height: 44.8px;
		--c: linear-gradient(
			#{$loader-color} calc(50% - 11.2px),
			#0000 0 calc(50% + 11.2px),
			#{$loader-color} 0
		);
		background: var(--c) 0% 100%, var(--c) 50% 100%, var(--c) 100% 100%;
		background-size: 10.1px calc(200% + 22.4px);
		background-repeat: no-repeat;
		animation: bars-th2joa 1s infinite linear;
	}

	// Spacing utilities
	@include generate-spacing(margin-bottom, mb);
	@include generate-spacing(margin-top, mt);
	@include generate-spacing(margin-right, mr);
	@include generate-spacing(margin-left, ml);

	// Grid System - DEPRECATED: Use Bootstrap grid instead
	// .pj-row {
	// 	display: flex;
	// 	flex-wrap: wrap;

	// 	&.pj-row-equal-height {
	// 		align-items: stretch;

	// 		> [class^="pj-col-"] {
	// 			display: flex;
	// 			flex-direction: column;
	// 		}
	// 	}

	// 	// Gap utilities
	// 	@for $i from 0 through 5 {
	// 		&.pj-gap-#{$i} {
	// 			--gap: #{if($i == 0, 0, $i * 0.25)}rem;
	// 			gap: var(--gap);
	// 		}
	// 	}
	// }

	// // Column classes
	// [class^="pj-col-"] {
	// 	box-sizing: border-box;
	// }

	// // Generate column classes
	// @for $i from 1 through 12 {
	// 	.pj-col-#{$i} {
	// 		flex: 0 1 calc(#{($i * 8.33333) + "%"} - var(--gap, 0));
	// 	}
	// }

	// .pj-col-12 {
	// 	flex: 0 1 100%;
	// }

	// // Responsive columns
	// @media (min-width: 576px) {
	// 	@for $i from 1 through 12 {
	// 		.pj-col-sm-#{$i} {
	// 			flex: 0 1 calc(#{($i * 8.33333) + "%"} - var(--gap, 0));
	// 		}
	// 	}
	// 	.pj-col-sm-12 {
	// 		flex: 0 1 100%;
	// 	}
	// }

	// @media (min-width: 768px) {
	// 	@for $i from 1 through 12 {
	// 		.pj-col-md-#{$i} {
	// 			flex: 0 1 calc(#{($i * 8.33333) + "%"} - var(--gap, 0));
	// 		}
	// 	}
	// 	.pj-col-md-12 {
	// 		flex: 0 1 100%;
	// 	}
	// }

	// @media (min-width: 992px) {
	// 	@for $i from 1 through 12 {
	// 		.pj-col-lg-#{$i} {
	// 			flex: 0 1 calc(#{($i * 8.33333) + "%"} - var(--gap, 0));
	// 		}
	// 	}
	// 	.pj-col-lg-12 {
	// 		flex: 0 1 100%;
	// 	}
	// }

	// @media (min-width: 1200px) {
	// 	@for $i from 1 through 12 {
	// 		.pj-col-xl-#{$i} {
	// 			flex: 0 1 calc(#{($i * 8.33333) + "%"} - var(--gap, 0));
	// 		}
	// 	}
	// 	.pj-col-xl-12 {
	// 		flex: 0 1 100%;
	// 	}
	// }

	// Components
	.pj-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		flex-direction: row;

		@media (max-width: 768px) {
			flex-direction: column;
			gap: 0.3rem;
		}

		a {
			color: #000000;

			&:hover {
				color: #2d2dff;
			}
		}
	}

	.pj-card {
		width: 100%;
		display: flex;
		background-color: white;
		flex-direction: column;
		border-radius: 8px;
		height: 100%;
		border: 1px solid rgba(0, 0, 0, 0.125);
		box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);

		&-header {
			padding: 20px 20px;
			color: $text-color;
			font-weight: 700;
			font-size: 15px;
			border-bottom: 1px solid rgba(0, 0, 0, 0.125);
			border-radius: 8px 8px 0 0;
		}

		&-body {
			padding: 15px 20px;
			height: 100%;
			flex: 1 1 auto;

			a {
				color: $primary-hover !important;
				text-decoration: underline;
			}

			input[type="file"] {
				border: 0;
			}
		}

		&-footer {
			padding: 12px 20px;
			border-top: 1px solid rgba(0, 0, 0, 0.125);
			display: flex;
			border-radius: 0 0 8px 8px;
		}
	}

	// .pj-row-equal-height .pj-card {
	// 	height: 100%;
	// }

	// Buttons
	.pj-btn {
		@include button-base;

		&-blue {
			@include button-variant($primary-color, $primary-hover);
		}

		&-red {
			@include button-variant($danger-color, $danger-hover);
		}
	}

	// Additional utility classes
	.pj-mt-1 {
		margin-top: 0.5rem;
	}
	.pj-mt-2 {
		margin-top: 1rem;
	}
	.pj-mb-2 {
		margin-bottom: 1rem;
	}

	// Charts
	#cdnHistory {
		width: 100%;
		height: 300px;
	}

	#imgHistory .apexcharts-toolbar,
	#cdnHistory .apexcharts-toolbar {
		top: -55px !important;
	}

	// Forms
	.form-group {
		display: flex;
		flex-direction: column;
		row-gap: 0.6rem;
		margin-bottom: 1rem;
	

		// Form elements styling
		label {
			font-weight: 700;
			display: block;
		}

		select{
			line-height: 1;
		}

		select,
		input,
		textarea {
			display: block;
			width: 100%;
			padding: 10px;
			border-radius: 4px;
			border: 1px solid $border-color;
			height: 40px;

			&:disabled {
				background-color: $disabled-bg;
			}
		}

	}

	// Bootstrap grid row equal height support
	.row-equal-height {
		display: flex;
		flex-wrap: wrap;
		
		> [class*="col-"] {
			display: flex;
			flex-direction: column;
		}
	}

	// Watermark styles
	.watermark-selector {
		font-family: Arial, sans-serif;
	}

	.watermark-alignment {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: 0.6rem;

		.grid {
			display: grid;
			grid-template-columns: repeat(3, 50px);
			gap: 10px;
			justify-content: center;
			margin-bottom: 10px;

			label {
				display: flex;
				justify-content: center;
				align-items: center;
				width: 50px;
				height: 50px;
				border: 1px solid #ccc;
				border-radius: 4px;
				cursor: pointer;
				position: relative;
			}
			span.radio {
				display: block;
				width: 15px;
				height: 15px;
				border-radius: 50%;
				background: transparent;
				border: 2px solid #ccc;
				position: absolute;
			}
		}

			input[type="radio"] {
			display: none;

			&:checked + span.radio {
				background: #007bff;
				border-color: #007bff;
			}
		}
	}

	// Pro features
	.pro {
		background: $pro-bg;
		-webkit-touch-callout: none !important;
		-webkit-user-select: none !important;
		-khtml-user-select: none !important;
		-moz-user-select: none !important;
		-ms-user-select: none !important;
		user-select: none !important;
		cursor: not-allowed !important;
		position: relative;

		input {
			pointer-events: none;
			opacity: 0.5;
		}

		.badge {
			background: $badge-color !important;
			color: white;
			font-size: 12px;
			font-weight: bold;
			padding: 2px 5px;
			border-radius: 3px !important;
			text-transform: uppercase;
			border: 0 !important;
			width: auto !important;
			height: auto !important;
		}
	}

	// Icons
	.pj-icon-1 {
		width: 60px;
	}

	.ion {
		background-size: 45px;
		background-repeat: no-repeat;
		background-position: center center;
		height: 50px;
		width: 50px;

		&.browsers-outline {
			background-image: url(../images/browsers-outline.svg);
		}

		&.images-outline {
			background-image: url(../images/image-outline.svg);
		}

		&.wifi-outline {
			background-image: url(../images/wifi-outline.svg);
		}

		&.cloud-outline {
			background-image: url(../images/cloud-outline.svg);
		}
	}

	// Animation keyframes
	@keyframes bars-th2joa {
		33% {
			background-position: 0% 50%, 50% 100%, 100% 100%;
		}

		50% {
			background-position: 0% 0%, 50% 50%, 100% 100%;
		}

		66% {
			background-position: 0% 0%, 50% 0%, 100% 50%;
		}

		100% {
			background-position: 0% 0%, 50% 0%, 100% 0%;
		}
	}
}

// Global scoping for PixJet admin pages (legacy support)
.toplevel_page_pixjet,
.pixjet_page_pixjet-watermark,
.pixjet_page_pixjet-optimize,
.pixjet_page_pixjet-cdn,
.pixjet_page_pixjet-usages {
	label {
		font-weight: 700;
		display: block;
	}

	select,
	input,
	textarea {
		display: block;
		width: 100%;
		padding: 10px;
		border-radius: 4px;
		border: 1px solid $border-color;
		height: 40px;

		&:disabled {
			background-color: $disabled-bg;
		}
	}
}

// @import 'sweetalert2';

@import 'sweetalert2/src/sweetalert2.scss'