/* Material Design Enhancements for Bulma */
/* Import Material Design Font - Roboto */
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap");

:root {
	/* Corporate Teal Color Palette */
	--md-primary: #0f766e;
	--md-primary-dark: #0d5f58;
	--md-primary-light: #14b8a6;
	--md-accent: #5eead4;
	--md-success: #10b981;
	--md-warning: #fbbf24;
	--md-danger: #ef4444;
	--md-info: #14b8a6;
	--md-dark: #374151;
	--md-grey: #6b7280;
	--md-light-grey: #f3f4f6;

	/* Shadows with Teal tint */
	--md-shadow-1: 0 1px 3px rgba(15, 118, 110, 0.12),
		0 1px 2px rgba(15, 118, 110, 0.24);
	--md-shadow-2: 0 3px 6px rgba(15, 118, 110, 0.16),
		0 3px 6px rgba(15, 118, 110, 0.23);
	--md-shadow-3: 0 10px 20px rgba(15, 118, 110, 0.19),
		0 6px 6px rgba(15, 118, 110, 0.23);
	--md-shadow-4: 0 14px 28px rgba(15, 118, 110, 0.25),
		0 10px 10px rgba(15, 118, 110, 0.22);
	--md-shadow-5: 0 19px 38px rgba(15, 118, 110, 0.3),
		0 15px 12px rgba(15, 118, 110, 0.22);
}

/* Global Font - Exclude icon fonts */
body,
.button,
.input,
.textarea,
.select,
.label,
.title,
.subtitle,
.heading {
	font-family: "Roboto", sans-serif !important;
}

/* Preserve icon fonts */
.icon,
.fa,
.fas,
.far,
.fal,
.fab {
	font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
}

/* Material Design Elevation */
.box,
.card,
.panel {
	box-shadow: var(--md-shadow-2);
	transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	border-radius: 4px;
}

.box:hover,
.card:hover {
	box-shadow: var(--md-shadow-3);
}

/* Sidebar Material Design */
.menu {
	box-shadow: var(--md-shadow-2);
}

.menu-list a {
	border-radius: 4px;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-list a:hover {
	background-color: rgba(15, 118, 110, 0.08);
	transform: translateX(4px);
}

.menu-list a.is-active {
	background-color: var(--md-primary);
	color: white;
	box-shadow: var(--md-shadow-1);
}

/* Buttons Material Design */
.button {
	border-radius: 4px;
	text-transform: uppercase;
	font-weight: 500;
	letter-spacing: 0.5px;
	box-shadow: var(--md-shadow-1);
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.button:hover {
	box-shadow: var(--md-shadow-2);
	transform: translateY(-1px);
}

.button:active {
	box-shadow: var(--md-shadow-1);
	transform: translateY(0);
}

.button.is-primary {
	background-color: var(--md-primary);
}

.button.is-primary:hover {
	background-color: var(--md-primary-dark);
}

.button.is-success {
	background-color: var(--md-success);
}

.button.is-danger {
	background-color: var(--md-danger);
}

.button.is-info {
	background-color: var(--md-info);
}

.button.is-warning {
	background-color: var(--md-warning);
}

/* Input Fields Material Design */
.input,
.textarea,
.select select {
	border-radius: 4px;
	border: 1px solid #e0e0e0;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.input:focus,
.textarea:focus,
.select select:focus {
	border-color: var(--md-primary);
	box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.1);
}

/* Tables Material Design */
.table {
	box-shadow: var(--md-shadow-1);
	border-radius: 4px;
	overflow: hidden;
}

.table thead th {
	background-color: var(--md-light-grey);
	color: var(--md-dark);
	font-weight: 500;
	text-transform: uppercase;
	font-size: 0.875rem;
	letter-spacing: 0.5px;
}

.table tbody tr {
	transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.table tbody tr:hover {
	background-color: rgba(15, 118, 110, 0.04);
}

/* Cards Material Design */
.card {
	border: none;
}

.card-header {
	background-color: white;
	box-shadow: none;
	border-bottom: 1px solid #e0e0e0;
}

.card-header-title {
	color: var(--md-dark);
	font-weight: 500;
}

/* Hero Material Design */
.hero.is-info {
	background: linear-gradient(
		135deg,
		var(--md-primary) 0%,
		var(--md-primary-light) 100%
	);
}

.hero.is-primary {
	background: linear-gradient(
		135deg,
		var(--md-primary-dark) 0%,
		var(--md-primary) 100%
	);
}

/* Tiles Material Design */
.tile.is-child.notification {
	border-radius: 8px;
	box-shadow: var(--md-shadow-2);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tile.is-child.notification:hover {
	box-shadow: var(--md-shadow-3);
	transform: translateY(-4px);
}

/* Notifications */
.notification {
	border-radius: 4px;
	box-shadow: var(--md-shadow-1);
}

/* Tags */
.tag {
	border-radius: 16px;
	font-weight: 500;
}

/* Panel Material Design */
.panel-heading {
	background-color: var(--md-primary);
	color: white;
	font-weight: 500;
	border-radius: 4px 4px 0 0;
}

.panel-block {
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel-block:hover {
	background-color: rgba(15, 118, 110, 0.04);
	transform: translateX(4px);
}

/* Main Content Area */
.main-content {
	background-color: #f5f5f5;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

::-webkit-scrollbar-track {
	background: #f5f5f5;
}

::-webkit-scrollbar-thumb {
	background: #bdbdbd;
	border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
	background: #9e9e9e;
}

/* ========== MOBILE SIDEBAR ========== */

/* Hamburger Menu Button */
.mobile-menu-toggle {
	position: fixed;
	top: 1rem;
	left: 1rem;
	z-index: 1001;
	width: 48px;
	height: 48px;
	background-color: var(--md-primary);
	color: white;
	border: none;
	border-radius: 8px;
	display: none;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: var(--md-shadow-2);
	transition: all 0.3s;
}

.mobile-menu-toggle:hover {
	background-color: var(--md-primary-dark);
	box-shadow: var(--md-shadow-3);
}

.mobile-menu-toggle i {
	font-size: 1.5rem;
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 999;
	opacity: 0;
	transition: opacity 0.3s;
}

.sidebar-overlay.is-active {
	opacity: 1;
}

/* Mobile Sidebar - Complete Fix */
@media screen and (max-width: 1023px) {
	/* Show hamburger button */
	.mobile-menu-toggle {
		display: flex;
	}

	/* Sidebar - hidden by default, slides in from left */
	.column.is-narrow {
		position: fixed !important;
		top: 0;
		left: -100%;
		width: 280px;
		height: 100vh;
		z-index: 1000;
		transition: left 0.3s ease;
		box-shadow: var(--md-shadow-4);
		overflow-y: auto;
		background-color: white;
	}

	.column.is-narrow.is-active {
		left: 0 !important;
	}

	/* Show overlay */
	.sidebar-overlay {
		display: block;
	}

	/* Main content - full width on mobile */
	.column.main-content {
		width: 100% !important;
		max-width: 100% !important;
		margin-left: 0 !important;
		padding: 1rem !important;
		padding-top: 4.5rem !important;
	}

	/* Fix columns layout */
	.columns.is-desktop {
		display: block !important;
	}

	.columns.is-gapless {
		margin: 0 !important;
	}
}

/* ========== RESPONSIVE DESIGN ========== */

/* Mobile First Approach */

/* Small Mobile (320px - 480px) */
@media screen and (max-width: 480px) {
	/* Typography */
	.title.is-3 {
		font-size: 1.5rem !important;
	}

	.title.is-4 {
		font-size: 1.25rem !important;
	}

	/* Buttons */
	.button {
		font-size: 0.875rem;
		padding: 0.5rem 0.75rem;
	}

	.buttons {
		flex-wrap: wrap;
	}

	.buttons .button {
		margin-bottom: 0.5rem;
	}

	/* Forms */
	.field.is-horizontal {
		display: block !important;
	}

	.field-label {
		text-align: left !important;
		margin-bottom: 0.5rem;
	}

	/* Hide text on small screens, show only icons */
	.button .icon + span {
		display: none;
	}

	.button.is-fullwidth .icon + span {
		display: inline;
	}

	/* Cards */
	.card {
		margin-bottom: 1rem;
	}

	/* Columns stack on mobile */
	.columns.is-mobile {
		display: flex !important;
	}

	.column {
		padding: 0.5rem !important;
	}
}

/* Mobile & Small Tablet (up to 769px) */
@media screen and (max-width: 769px) {
	/* Container padding */
	.container {
		padding: 0 1rem;
	}

	/* Sidebar - Full width on mobile */
	.column.is-2 {
		width: 100% !important;
		max-width: 100% !important;
	}

	/* Main content */
	.column.is-10 {
		width: 100% !important;
		padding: 1rem !important;
	}

	.column.is-12 {
		padding: 1rem !important;
	}

	/* Dashboard tiles */
	.tile.is-ancestor {
		flex-direction: column;
	}

	.tile.is-parent {
		padding: 0.5rem !important;
	}

	/* Hero sections */
	.hero-body {
		padding: 1.5rem 1rem !important;
	}

	.hero.is-medium .hero-body {
		padding: 2rem 1rem !important;
	}

	/* Tables */
	.table-container {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		margin: 0 -1rem;
		padding: 0 1rem;
	}

	.table {
		font-size: 0.875rem;
	}

	.table th,
	.table td {
		padding: 0.5rem 0.25rem;
		white-space: nowrap;
	}

	/* Level - Stack on mobile */
	.level {
		display: block !important;
	}

	.level-left,
	.level-right {
		display: block !important;
		margin-bottom: 1rem;
	}

	.level-item {
		margin-bottom: 0.5rem;
	}

	/* Columns - Stack by default */
	.columns:not(.is-mobile) {
		display: block !important;
	}

	.columns:not(.is-mobile) .column {
		width: 100% !important;
		margin-bottom: 1rem;
	}

	/* Buttons in columns */
	.column.is-narrow {
		width: 100% !important;
		text-align: left;
	}

	.column.is-narrow .button {
		width: 100%;
		margin-bottom: 0.5rem;
		margin-right: 0 !important;
	}

	/* Box padding */
	.box {
		padding: 1rem;
	}

	/* Notification */
	.notification {
		padding: 1rem;
	}

	/* Panel */
	.panel {
		font-size: 0.875rem;
	}

	/* Menu */
	.menu {
		margin-bottom: 1rem;
	}

	.menu-list a {
		padding: 0.75rem 1rem;
		font-size: 0.9rem;
	}

	/* Search bar */
	.field.has-addons {
		flex-wrap: wrap;
	}

	.field.has-addons .control {
		width: 100%;
	}

	.field.has-addons .control:not(:last-child) {
		margin-bottom: 0.5rem;
	}

	/* Modal */
	.modal-card {
		margin: 0 1rem;
	}

	/* Toast notifications */
	.toast-container {
		top: 10px;
		right: 10px;
		left: 10px;
		max-width: none;
	}

	.toast {
		min-width: auto;
	}

	/* FAB button */
	.fab {
		bottom: 1rem;
		right: 1rem;
		width: 48px;
		height: 48px;
	}

	/* Hide desktop-only elements */
	.is-hidden-mobile {
		display: none !important;
	}
}

/* Tablet (769px - 1023px) */
@media screen and (min-width: 769px) and (max-width: 1023px) {
	.container {
		max-width: 960px;
	}

	/* Sidebar */
	.column.is-2 {
		width: 20% !important;
	}

	.column.is-10 {
		width: 80% !important;
	}

	/* Tiles - 2 columns on tablet */
	.tile.is-parent {
		width: 50% !important;
	}

	/* Tables */
	.table {
		font-size: 0.9rem;
	}

	/* Cards in grid */
	.column.is-4 {
		width: 50% !important;
	}
}

/* Desktop (1024px and up) */
@media screen and (min-width: 1024px) {
	.container {
		max-width: 1200px;
	}

	/* Hide mobile-only elements */
	.is-hidden-desktop {
		display: none !important;
	}

	/* Sidebar fixed on desktop */
	.column.is-2 {
		position: sticky;
		top: 0;
		height: 100vh;
		overflow-y: auto;
	}
}

/* Large Desktop (1216px and up) */
@media screen and (min-width: 1216px) {
	.container {
		max-width: 1344px;
	}
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
	/* Larger touch targets */
	.button,
	.input,
	.select select,
	.textarea {
		min-height: 44px;
	}

	.menu-list a {
		min-height: 44px;
		display: flex;
		align-items: center;
	}

	/* Remove hover effects on touch */
	.button:hover,
	.menu-list a:hover {
		transform: none;
	}

	/* Larger tap targets for table actions */
	.table .button.is-small {
		min-height: 36px;
		min-width: 36px;
	}
}

/* Print Styles */
@media print {
	.navbar,
	.menu,
	.button,
	.fab,
	.toast-container,
	.page-loader {
		display: none !important;
	}

	.column.is-2 {
		display: none !important;
	}

	.column.is-10,
	.column.is-12 {
		width: 100% !important;
	}

	.box,
	.card {
		box-shadow: none !important;
		border: 1px solid #ddd;
	}
}

/* Loading Animation */
@keyframes ripple {
	0% {
		box-shadow: 0 0 0 0 rgba(15, 118, 110, 0.4);
	}
	100% {
		box-shadow: 0 0 0 20px rgba(15, 118, 110, 0);
	}
}

/* Floating Action Button Style */
.fab {
	position: fixed;
	bottom: 2rem;
	right: 2rem;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background-color: var(--md-primary);
	color: white;
	box-shadow: var(--md-shadow-3);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	z-index: 1000;
}

.fab:hover {
	box-shadow: var(--md-shadow-4);
	transform: scale(1.1);
	background-color: var(--md-primary-dark);
}

/* Smooth Transitions */
* {
	transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== LOADING STATES ========== */

/* Button Loading State */
.button.is-loading {
	color: transparent !important;
	pointer-events: none;
	position: relative;
}

.button.is-loading::after {
	animation: spinAround 500ms infinite linear;
	border: 2px solid #dbdbdb;
	border-radius: 50%;
	border-right-color: transparent;
	border-top-color: transparent;
	content: "";
	display: block;
	height: 1em;
	width: 1em;
	position: absolute;
	left: calc(50% - 0.5em);
	top: calc(50% - 0.5em);
}

.button.is-loading.is-primary::after,
.button.is-loading.is-success::after,
.button.is-loading.is-danger::after,
.button.is-loading.is-info::after,
.button.is-loading.is-warning::after {
	border-color: white;
	border-right-color: transparent;
	border-top-color: transparent;
}

@keyframes spinAround {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

/* Skeleton Loader */
.skeleton {
	background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
	background-size: 200% 100%;
	animation: loading 1.5s ease-in-out infinite;
	border-radius: 4px;
}

.skeleton-text {
	height: 1em;
	margin-bottom: 0.5em;
}

.skeleton-title {
	height: 2em;
	width: 60%;
	margin-bottom: 1em;
}

.skeleton-avatar {
	width: 48px;
	height: 48px;
	border-radius: 50%;
}

.skeleton-card {
	height: 200px;
	width: 100%;
}

@keyframes loading {
	0% {
		background-position: 200% 0;
	}
	100% {
		background-position: -200% 0;
	}
}

/* Page Loader */
.page-loader {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(255, 255, 255, 0.9);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	opacity: 0;
	visibility: hidden;
	transition:
		opacity 0.3s,
		visibility 0.3s;
}

.page-loader.is-active {
	opacity: 1;
	visibility: visible;
}

.page-loader-spinner {
	width: 60px;
	height: 60px;
	border: 4px solid var(--md-light-grey);
	border-top-color: var(--md-primary);
	border-radius: 50%;
	animation: spinAround 1s linear infinite;
}

/* ========== TOAST NOTIFICATIONS ========== */

.toast-container {
	position: fixed;
	top: 20px;
	right: 20px;
	z-index: 10000;
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-width: 400px;
}

.toast {
	background: white;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
	padding: 16px 20px;
	display: flex;
	align-items: center;
	gap: 12px;
	min-width: 300px;
	animation: slideInRight 0.3s ease-out;
	position: relative;
	overflow: hidden;
}

.toast.is-hiding {
	animation: slideOutRight 0.3s ease-out forwards;
}

.toast::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
}

.toast.is-success::before {
	background-color: var(--md-success);
}

.toast.is-danger::before {
	background-color: var(--md-danger);
}

.toast.is-warning::before {
	background-color: var(--md-warning);
}

.toast.is-info::before {
	background-color: var(--md-info);
}

.toast-icon {
	flex-shrink: 0;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	font-size: 14px;
}

.toast.is-success .toast-icon {
	background-color: rgba(16, 185, 129, 0.1);
	color: var(--md-success);
}

.toast.is-danger .toast-icon {
	background-color: rgba(239, 68, 68, 0.1);
	color: var(--md-danger);
}

.toast.is-warning .toast-icon {
	background-color: rgba(251, 191, 36, 0.1);
	color: var(--md-warning);
}

.toast.is-info .toast-icon {
	background-color: rgba(20, 184, 166, 0.1);
	color: var(--md-info);
}

.toast-content {
	flex: 1;
}

.toast-title {
	font-weight: 600;
	font-size: 14px;
	margin-bottom: 2px;
	color: var(--md-dark);
}

.toast-message {
	font-size: 13px;
	color: var(--md-grey);
	line-height: 1.4;
}

.toast-close {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	border: none;
	background: transparent;
	cursor: pointer;
	color: var(--md-grey);
	font-size: 18px;
	line-height: 1;
	padding: 0;
	transition: color 0.2s;
}

.toast-close:hover {
	color: var(--md-dark);
}

@keyframes slideInRight {
	from {
		transform: translateX(400px);
		opacity: 0;
	}
	to {
		transform: translateX(0);
		opacity: 1;
	}
}

@keyframes slideOutRight {
	from {
		transform: translateX(0);
		opacity: 1;
	}
	to {
		transform: translateX(400px);
		opacity: 0;
	}
}

/* Progress Bar for Toast */
.toast-progress {
	position: absolute;
	bottom: 0;
	left: 0;
	height: 3px;
	background-color: currentColor;
	opacity: 0.3;
	animation: progressBar 3s linear forwards;
}

@keyframes progressBar {
	from {
		width: 100%;
	}
	to {
		width: 0%;
	}
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
	.toast-container {
		top: 10px;
		right: 10px;
		left: 10px;
		max-width: none;
	}

	.toast {
		min-width: auto;
	}
}
