// RedmineX Theme
// Copyright 2020 RedmineX
// For license, see https://www.redmine-x.com
// Created by Michael Staněk
// Created without vendor prefixes, "AutoPrefixed" by PrePros v5 (https://prepros.io)
 
// Media Queries to Copy / Paste:
 
// 380px
// @include media-breakpoint-up(xxs) {}

// 480px
// @include media-breakpoint-up(xs) {}

// 576px
// @include media-breakpoint-up(sm) {}

// 768px
// @include media-breakpoint-up(md) {}

// 899px
// @include media-breakpoint-up(redmine-mobile) {}

// 992px
// @include media-breakpoint-up(lg) {}

// 1200px
// @include media-breakpoint-up(xl) {}

// 1500px
// @include media-breakpoint-up(hd) {}

// 1900px
// @include media-breakpoint-up(2k) {}

/* ==========================================================================
   Table
   ========================================================================== */

.table-list {
	width: calc(100% - 2px);
	display: table;
	border-collapse: collapse;
}

.table-list-header {
	font-weight: 600;
}

.table-list-row {
	display: flex;
	align-items: center;
}

.table-list-cell {
	padding: 1rem !important;
	
	&.buttons {
		margin-left: auto;
		
		&>* {
			padding: 2px 0.5rem;
		}
	}
}

.ui-sortable .ui-sortable>div {
	padding-left: 2rem;
	border-bottom: none !important;
}

table {
	display: table;
	border-collapse: collapse;
	width: calc(100% - 2px);
	
	&.filecontent th.filename,
	&.filecontent th.line-num {
		background: $query-form-bg !important;
		border: 1px solid $border-color-light;
	}
	

	
	&#filters-table {
		width: auto;
		
		th, td {
			
			&:not(:empty) {
				padding: 0.25rem;
			}
		}
	}
	
	.group {
		border-bottom: 1px solid $border-color-light;
	}
	
	&.plugins {
		
		td.name {
			padding-left: 2rem;
		}
	}
	
	&.list {
		
		thead,
		tbody {
			
			&>th, 
			&>td {
	
				&:first-child {
					padding-left: 2rem;
				}
			}
		}
	}
	
	&.changesets {
		
		th, td {
			padding: 0;
			
			&:not(:empty) {
				padding: 0.75rem !important;
			}
		}
	}
	
	th, td {
		vertical-align: middle;
		text-align: left;
		padding: 0;
			
		&:not(:empty) {
			padding: 0.875rem;
		}
	}
	
	td.last_notes {
		padding-top: 0 !important;
	}
	
	p {
		margin: 0;
	}
	
	caption {
		text-align: left;
	}
	
	.username {
		white-space: nowrap;
	}
	
	.username>* {
		display: inline-block;
	}
	
	.gravatar {
		margin-right: 0.5rem;
	}
	
	a {
		color: $text-color;
		
		&:hover {
			color: $link-color;
		}
	}
	
	.toggle-all {
		font-size: $font-size-sm1;
		color: $link-color;
	}
}

#query_form_content {
	
	table {
		width: auto;
		
		td {
			padding: 0 1rem;
		}
	}
	
	table#list-definition {
		table-layout: fixed;
		
		tr:first-child .field {
			@include media-breakpoint-down(lg) {
				display: none;
			}
		}
	}
	
	#options {
		
		table td {
			display: block;
			
			&:first-child {
				
				@include media-breakpoint-down(lg) {
					padding-bottom: 0;
				}
				
				@include media-breakpoint-up(xl) {
					width: 20%;
					min-width: 100px;
				}
			}
			
			@include media-breakpoint-up(xl) {
				display: table-cell;
			}
			
			&:last-child {
				padding-top: 0;
			}
		}
		
		label.inline {
			margin-right: 0.5rem;
		}
	}
}

.autoscroll {
    overflow-x: auto;
    width: 100%;
}

table.list {
	border-collapse: collapse;
	margin-bottom: 0.5rem;
	
	th {
		font-weight: 600;
		
		a {
			color: $text-color;
			
			&:hover {
				color: $primary;
			}
		}
	}
	
	td {
		
		&.due_date,
		&.start_date,
		&.updated_on,
		&.created_on,
		&.last_login_on {
			min-width: 160px;
		}
		
		&.buttons,
		&.parent-subject,
		&.status {
			white-space: nowrap;
		}
		
		&.description {
			max-width: 700px;
		}
	}
	
	.buttons {
		text-align: right;
		
		a {
			background-image: none;
		}
		
		a:not(.icon-actions) {
			display: inline-block;
		}
		
		&>* {
			padding: 2px 0.5rem;
		}		
	}
	
	.id {
		min-width: 55px;
	}
	
	&.time-entries {
		
		.buttons {
			min-width: $input-max-width-xs;
			
			a {
				margin: 0 0.5rem;
			}
			
			.icon-actions:before {
				padding: 0;
			}
		}
	}
	
	&.related-issues {
		
		caption {
			font-weight: 600;
			color: $headings-color;
		}
	}
	
	// table.list.issues
	
	&.issues {
		
		td {
			
			&.buttons {
				padding-left: 0;
				padding-right: 0;
			}
		}
		
		.group .name {
			font-weight: 600;
		}
		
		.last_notes .wiki {
			padding-left: calc(3rem + 1px);
		}
	}
}

div:not(.issue.details) table.list.issues {
	
	tr:not(.group):not([id*="relation-"]) {
		
		td:not(.buttons):not(.last_notes):not(.id) {
			
			&~*{
				white-space: nowrap;
				overflow: hidden;
				max-width: 500px;
				text-overflow: ellipsis;
			}
		}
	}
}

div.issue.details #issue_tree table.list.issues tr td > *:not(table) {
	white-space: normal;
	overflow: visible;
	width: auto;
	max-width: none;
	text-overflow: unset;
}

table.list.projects {
	
	.name {
		min-width: 160px;
	}
	
	.name>a {
		float: left;
		padding-right: 0.5rem;
	}
	
	.icon-user.my-project:before {
		@include translate-none;
		top: 5px;
	}
}

th, td {
	
	&.checkbox {
		width: 46px;
	}
	
	&.id,
	&.checkbox,
	&.hours {
		text-align: center;
	}
}

td {
	
	&.priority {
		text-align: center;
	}
	
	/* td.id a - for search purposes */
	&.id a {
		@include rounded;
		border: 1px solid $text-color;
		padding: 0.125rem 0.375rem;
		font-size: $font-size-xs;
		
		&:hover {
			background: $link-color;
			border: 1px solid $link-color;
			color: $white;
		}
	}
	
	&.due_date,
	&.id  {
		padding: 0.25rem;
	}
	
	&.subject a {		
		padding: 0;
	}
	
	&.subject a,
	&.issue a {
		color: $link-color;
	}
}

.overdue {
	
	td.due_date {
		color: $brand-danger;
	}
}

td.values>span {
	display: flex;
	flex-direction: row;
	justify-content: flex-start;
	align-items: center;
}

.attachments {
	
	table td {
		vertical-align: top;
	}
	
	table td:last-child {
		text-align: right;
		border-top: none !important;
	}
	
	&.box table {
		width: auto !important;
		
		td {
			padding: 0.25rem !important;
		}
		
		input:not([type="submit"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="button"]) {
			max-width: none !important;
			margin-bottom: 1rem;
		}
	}
}

#filters-table {
	
	td.values select {
		min-width: 130px;
	}
	
	td:last-child {
		text-align: right;
	}
}

table.progress {
	border-collapse: collapse;
    empty-cells: show;
    text-align: center;
	
	td.closed,
	td.todo,
	td.done {
		height: 8px;
		padding: 0;
		
		&:only-child {
			border-radius: $border-radius;
		}
	}
	
	td.closed,
	td.done {
		background: $primary;
		border-radius: $border-radius 0 0 $border-radius;
	}
	
	td.todo {
		border-radius: 0 $border-radius $border-radius 0;
	}
}

table.plugins {
	font-size: $font-size-xs;
	
	span.name {
		font-weight: bold;
		color: $headings-color;
		font-size: $font-size-sm2;
	}
	
	span.url {
		display: block;
	}
	
	span.url {
		margin-top: 0.5rem;
	}
}

#sidebar {
	
	table {
		
		th, td {
			padding: 0.5rem 0.5rem 0.5rem 0;
		}
	}
}

#relations,
#issue_tree,
#checklist {
	
	table.list>tbody {
		border: none;
		
		tr {
			border-top: none;
		}
	}
}

tr.project {

    &.idnt td.name span {
        background: url(../../../../images/bullet_arrow_right.png) no-repeat 0 50%;
    }

    &.idnt-1 td.name {
        padding-left: 2rem !important;
    }

    &.idnt-2 td.name {
        padding-left: 4rem !important;
    }

    &.idnt-3 td.name {
        padding-left: 6rem !important;
    }

    &.idnt-4 td.name {
        padding-left: 8rem !important;
    }

    &.idnt-5 td.name {
        padding-left: 10rem !important;
    }

    &.idnt-6 td.name {
        padding-left: 12rem !important;
    }

    &.idnt-7 td.name {
        padding-left: 14rem !important;
    }

    &.idnt-8 td.name {
        padding-left: 16rem !important;
    }

    &.idnt-9 td.name {
        padding-left: 18rem !important;
    }
}

tr.issue {
 	
 	&[class*="idnt-"] td.subject:before {
 		content: '·';
 		margin-right: 0.5rem;
 		color: $fa-font-color;
 		font-weight: 600;
 	}

    &.idnt-1 td.subject {
        padding-left: 2rem !important;
    }

    &.idnt-2 td.subject {
        padding-left: 3rem !important;
    }

    &.idnt-3 td.subject {
        padding-left: 4rem !important;
    }

    &.idnt-4 td.subject {
        padding-left: 5rem !important;
    }

    &.idnt-5 td.subject {
        padding-left: 6rem !important;
    }

    &.idnt-6 td.subject {
        padding-left: 7rem !important;
    }

    &.idnt-7 td.subject {
        padding-left: 8rem !important;
    }

    &.idnt-8 td.subject {
        padding-left: 9rem !important;
    }

    &.idnt-9 td.subject {
        padding-left: 10rem !important;
    }
}