/* *************************
 * Import font (Electrolize)
 *************************** */

@font-face {
	font-family: "Electrolize";
	src: local("Electrolize"), url("../../node_modules/@fontsource/electrolize/files/electrolize-latin-400-normal.woff2") format("woff2");
}


/* ***********************
 * Non-bootstrap variables
 ************************* */

// foreground colors
$fg: gold;
$fg-bright: yellow;
$fg-dark: orange;
// old fg-colors: deeppink, lightpink, #b3005f;

// background colors
$bg: cyan;					// #00ffff
$bg-bright: lightcyan;		// #e0ffff
$bg-dark: darkcyan;			// #008b8b

// base font size
$html-font-size: 14px;


/* ******************************
 * Override Bootstrap variables
 ******************************** */

@import "../../node_modules/bootstrap/scss/functions";

// font
$font-family-base: "Electrolize";

// colors
$warning: $bg;
$danger: $fg;

// <input>
$input-bg: transparent;
$input-color: $fg;
$input-font-size: 1rem !important;
$input-focus-box-shadow: 0 0 .25rem $bg-bright, 0 0 .5rem $bg, 0 0 1rem $bg-dark !important;

// <input type="text/number">
$input-group-addon-color: $bg;
$input-group-addon-bg: transparent;
$input-group-addon-border-color: none;

// <input type="range">
$form-range-track-height: .2rem;
$form-range-track-bg: $bg;
$form-range-track-box-shadow: none;
$form-range-thumb-width: .25rem;
$form-range-thumb-height: 1rem;
$form-range-thumb-bg: $fg;
$form-range-thumb-border: none;
$form-range-thumb-box-shadow: none;
$form-range-thumb-focus-box-shadow: 0 0 .5rem $fg-bright, 0 0 1rem $fg, 0 0 2rem $fg-dark;

// <input> validation
$form-feedback-valid-color: $warning;
$form-feedback-icon-valid: none;
$form-feedback-icon-invalid: none;

// more bootstrap stylesheets
//@import "../../node_modules/bootstrap/scss/bootstrap";	// everything  
@import "../../node_modules/bootstrap/scss/variables";
@import "../../node_modules/bootstrap/scss/variables-dark";
@import "../../node_modules/bootstrap/scss/maps";
@import "../../node_modules/bootstrap/scss/mixins";
@import "../../node_modules/bootstrap/scss/root";
@import "../../node_modules/bootstrap/scss/containers";
@import "../../node_modules/bootstrap/scss/navbar";
@import "../../node_modules/bootstrap/scss/tables";
@import "../../node_modules/bootstrap/scss/modal";
@import "../../node_modules/bootstrap/scss/forms";
@import "../../node_modules/bootstrap/scss/utilities";
@import "../../node_modules/bootstrap/scss/badge";
@import "../../node_modules/bootstrap/scss/reboot";


/* *************
 * Custom mixins
 *************** */

@mixin aug() {
	--aug-b: 5px;
	--aug-bl: 5px;
	--aug-br: 5px;
	--aug-l: 5px;
	--aug-r: 5px;
	--aug-tl: 5px;
	--aug-tr: 5px;
}

@mixin border() {
	--aug-border-all: .1rem;
	--aug-border-bg: cyan; // variables don't work in this specific instance
	--aug-border-opacity: .5;
}

@mixin inlay() {
	--aug-inlay-bg: rgba(0, 0, 0, .5);
	--aug-inlay-x: .12em;
	--aug-inlay-y: .12em;
}


/* **************
 * Responsiveness
 **************** */

@media (width <= 500px) {
	html { font-size: $html-font-size; }

	.container {
		min-width: 100vw;
		max-width: 100vw;
  	}

  	.table-responsive { max-width: calc(100% - .8rem); }
}

@media (500px < width < 1000px) {
	html { font-size: calc(100vw / (500px / $html-font-size)); }

	.container {
		$calc-width: calc(100vw / 2 + 250px);
		min-width: $calc-width;
		max-width: $calc-width;
  	}
}

@media (1000px <= width) {
	html { font-size: calc($html-font-size * 2); }	

	.container {
		min-width: 75vw;
		max-width: 75vw;
  	}
}


/* *****************
 *  Basic styles
 ******************* */

html {
	font-family: 'Electrolize', sans-serif;
	height: 100%;
	margin: 0;
	overflow-x: hidden;
	user-select: none;
}

body {
	background-color: darkslategray;
	background-image: url("../img/bg.jpg");
	background-repeat: no-repeat;
	background-position: center center;
	background-size: cover;
	margin: .2rem;
}

//button { font-family: Electrolize; }

.container {
	padding: .2rem;
	position: relative;
}

.sr2-button {
	background: transparent;
	border: .07rem solid $bg;
	border-radius: .07rem;
	box-shadow: 0 0 .15rem $bg-bright, 0 0 .3rem $bg, 0 0 .6rem $bg-dark;
	color: $fg;
	font-size: 1rem;
	margin-left: .2rem;
	margin-right: .2rem;
	padding-inline: 0px;

	svg {
		fill: $fg; 
		height: 93%;
		width: 93%;
		vertical-align: unset;
	}

	&:focus {
		border: .1rem solid $bg !important;
		box-shadow: 0 0 .3rem $bg-bright, 0 0 .6rem $bg, 0 0 1.2rem $bg-dark !important;
		filter: brightness(150%) !important;
		outline: none;
	}
	
	&:disabled {
		box-shadow: none;
		border-color: $bg-dark;

		svg { fill: $fg-dark; }
	}
}

.display-none { display: none; }


/* *****************
 *  Header styles
 ******************* */

header.navbar {
	@include border;
	@include inlay;

	--aug-b: 7px;
	--aug-bl: 7px;
	--aug-br: 7px;
	--aug-inlay-bg: rgba(0, 0, 0, .75);
	--aug-l: 7px;
	--aug-r: 7px;
	--aug-tl: 7px;
	--aug-tr: 7px;
	padding-left: calc(15px + 1rem);
	padding-right: 15px;

	.navbar-brand {
		color: $bg;
		font-size: 140%;
		text-shadow: 0 0 .25rem, 0 0 .5rem, 0 0 .75rem, 0 0 1rem;
	}

	nav { justify-content: flex-end !important; }

	button {
		height: 2rem;
		width: 2rem;
	}
}


/* *****************
 *  Table styles
 ******************* */

.table-responsive {	overflow: visible !important; }

#combatants-table {
	border-collapse: collapse !important;
	margin-bottom: .1rem; 
	margin-top: .4rem;

	tr {
		@include aug;
		@include border;
		@include inlay;

		--aug-border-bottom: 0px;
		--aug-border-right: 0px;
	}

	tr:last-of-type td,
	tr:last-of-type th { --aug-border-bottom: 2px; }

	.combatant-row { clip-path: none; }

	th, 
	td {
		@include aug;
		@include border;
		@include inlay;

		--aug-border-bottom: 0px;
		--aug-border-right: 0px;
		background: none !important;
		vertical-align: middle !important;
	}

	th {
		color: $bg;
		text-transform: uppercase; 
	}

	.th-name { 
		padding-left: .75rem !important; 
		text-align: left;
		width: 100%;
	}

	.th-ini { 
		min-width: 4rem; 
	}

	.th-dice-and-rea { min-width: 3rem; }

	.th-actions { 
		min-width: min-content; 
		--aug-border-right: 2px; 		
	}

	td {
		color: $fg;
		font-weight: bold;
		text-align: center; 
		
		.sr2-button {
			height: 1.3rem;
			width: 1.3rem;
		}
	}

	.combatant-name { 
		padding-left: .6rem !important; 
		text-align: left;

		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.combatant-dice::before { content: attr(data-combatant-dice); }

	.combatant-rea::before { content: attr(data-combatant-rea); }

	.combatant-actions { 
		--aug-border-right: 2px; 
		display: flex;
		min-width: 5rem;
	}

	.actions-menu {
		display: flex;
		flex-flow: column;
		padding: .2rem;

		.sr2-button {
			margin-bottom: .2rem;
			margin-top: .2rem;
		}
	}
}

.max-ini td {
	text-shadow: 0 0 .15rem $fg;
}

.zero-ini td {
	color: $fg-dark;

	svg { fill: $fg-dark; }
}

.ko-or-dead td {
	background-color: rgba(0, 0, 0, .5);
	color: $fg-dark;
	text-decoration: line-through .1rem $fg;

	.sr2-button svg { fill: $fg-dark; }
}

.badge.bg-warning {
	background: radial-gradient(circle at center, $bg, $bg-dark);
	bottom: .2rem;
	color: black;
	left: .2rem;
	position: absolute;
}

.badge.bg-danger {
	background: radial-gradient(circle at center, $fg, $fg-dark);
	color: black;
	left: .2rem;
	position: absolute;
	top: .3rem;
}

.damage-dropdown, 
.actions-dropdown { 
	display: inline-block; 
	position: relative;	// required in order to center dropdowns vertically
}

.damage-monitor, 
.actions-menu {
	@include aug;
	@include border;

	--aug-inlay-bg: rgba(0, 0, 0, .5);
	--aug-border-opacity: .75;
	padding-top: .7rem;
	padding-bottom: .7rem;
	position: absolute;
	z-index: 200;

	// center element horizontally w/ respect to parent 
	right: 50%;
	transform: translateX(50%);

	// transition: fade in/out 
	transition: opacity .2s ease-in-out, visibility .2s;
	opacity: 0%;
	visibility: hidden;
}

.seen { 
	visibility: visible;
	opacity: 100%;
}

.damage-monitor {
	padding: .5rem;

	td { padding: .1rem; }

	button {
		border: none;
		border-radius: 0;
		font-family: Electrolize;
		font-size: .9rem;
		font-weight: bold;
		height: 1.5rem !important;
		margin: 0rem .15rem;
		width: 1.5rem !important;

		svg { 
			height: 100%;
			width: 100%;
		}

		&:focus {
			outline: none;
			animation: .6s alternate infinite pulse;
			animation-delay: -.3s;
		}
	
		@keyframes pulse {
			from { filter: brightness(.85) }
			50% { filter: brightness(1); }
			to { filter: brightness(1.15); }
		}

	}

	.damage-stun {
		background: radial-gradient(circle at center, $bg, $bg-dark);
		box-shadow: none;
		transition: background .5s, box-shadow .5s;
	}

	.damage-stun.active {
		background: radial-gradient(circle at center, $bg-bright, $bg);
		box-shadow: 0 0 .25rem $bg-bright, 0 0 .5rem $bg, 0 0 1rem $bg-dark;
	}

	.damage-physical {
		background: radial-gradient(circle at center, $fg, $fg-dark);
		border-radius: 50%;  // circle, not square
		box-shadow: none;
		transition: background .5s, box-shadow .5s;
	}

	.damage-physical.active {
		background: radial-gradient(circle at center, $fg-bright, $fg);
		box-shadow: 0 0 .25rem $fg-bright, 0 0 .5rem $fg, 0 0 1rem $fg-dark;
	}
}


/* *****************
 *  Modal styles
 ******************* */

.sr2-modal {
	@include border;
	@include aug;

	color: $bg;
	font-family: Electrolize !important;
	pointer-events: auto;

	.modal-header {
		@include inlay;
		@include border;

		--aug-inlay-bottom: 0;
		border-bottom: none;
		text-transform: uppercase;

		button { width: 2.5rem; }
	}

	.modal-body {
		@include inlay;
		@include border;

		--aug-inlay-y: 0;
	}

	.modal-footer {
		@include inlay;
		@include border;

		--aug-inlay-top: 0;
		border-top: none;

		button { 
			width: 5rem; 
			margin: .3rem;
		}
	}

	label { 
		margin: 0; 
		margin-left: calc(100% / 22 + 1rem);
	}

	.label-swap {
		display: flex;
		flex-flow: column;
	
		label { order: 2; }

		input { order: 1; }

	}

	.range-group { margin-top: 1rem; }

	input {
		margin: .3em;
		user-select: text;
		width: 98%;		// 100% is inexplicably too long on the right hand side  

		&::selection {
			background-color: $fg;
			color: black;
		}
	
		&[type="number"] {
			-moz-appearance: textfield;

			&::-webkit-inner-spin-button,
			&::-webkit-outer-spin-button { 
				-webkit-appearance: none; 
				margin: 0;
			}
		}

		&:focus:invalid { box-shadow: 0 0 .25rem $fg-bright, 0 0 .5rem $fg, 0 0 1rem $fg-dark !important; }

	 	&[type="range"] {
			box-shadow: none !important;
			margin-left: calc(100% / 22 - .15rem);
			width: calc(100% / 11 * 10 + .3rem);

	 		+ datalist {
	 			border-collapse: collapse;
	 			display: table;
	 			table-layout: fixed;
	 			width: 100%;

	 			option {
	 				display: table-cell;
	 				text-align: center;
	 			}
	 		}
		}
 	}

 	#combatant-modal-dice { margin-right: 0; }

	#combatant-modal-rea { margin-left: 0; }

 	.input-group-text {
 		background-color: transparent;
 		border: none;
 		color: $fg;
 		padding: .25rem;
 	}
}


/* *****************
 *  Footer styles
 ******************* */

.footer-container {
	bottom: 0px;
	left: 0px;
	position: fixed;
	right: 0px;
}

footer {
	@include aug;
	@include inlay;

	--aug-border-all: .1rem !important;
	--aug-border-bg: cyan !important; // vars don't work here
	--aug-border-opacity: .5 !important;
	--aug-inlay-bg: rgba(0, 0, 0, .75) !important;
	--aug-tl: .7rem;
	--aug-tr: .7rem;

	p {
		color: $bg;
		font-size: x-small;
		margin: .15em;
		padding: .25rem;
		text-align: center;
		user-select: text;
		-webkit-user-select: text;

		a {
			color: $fg;
			text-decoration: none;
		}

		&::selection,
		a::selection {
			background-color: $fg;
			color: black;
		}

	}
}
