/*
Arch UI Layout Styles
Updated: 08/05/2025
*/

.app-interface {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background-color: #595959;
}
@media screen and (width <= 850px) {
.app-interface {
	height: 100svh;
    min-height: 100svh;
}
}

.main-wrapper {
  display: flex;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.content-area {
    width: 100%;
    height: 100%;
    padding: 10px 15px;
    overflow-y: auto;
}

.main-content {
    display: grid;
}

/* SIDEBAR */
.sidebar {
    position: relative;
    width: 240px;
    background: #1c2833;
    /* flex-shrink: 0; */
    border-right: solid 1px #777;
    overflow: visible;
    scrollbar-width: none;
    transform: translateX(0);
    transition: transform 0.3s ease;
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 1001;
}

.sidebar.toggled {
	transform: translateX(-100%);
	box-shadow: none;
}

.sidebar.toggled + .content-area {
	margin-left: -240px;
}

.sidebar-inner {
	height: 100%;
	overflow-y: auto;
	scrollbar-width: none;
}

.sidebar-inner::-webkit-scrollbar {
	display: none;
}

.app-header {
    display: flex;
    gap: 5px;
    background-color: #1c2833;
    padding: 5px;
    align-items: center;
    color: #fff;
    padding-left: 30px;
    border-bottom: solid 1px #7e8489;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar nav ul li {
    position: relative;
}

/* Base menu link style */
.sidebar nav ul li > a.menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #ecf0f1;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    outline: none;
    transition: background 0.2s ease;
    white-space: nowrap;
	overflow: hidden;
}

.sidebar nav ul li a svg{
    width: 30px;
    height: auto;
    flex-shrink: 0;
	text-align: center;
}

/* Arrow inside menu links */
.sidebar nav ul li > a.menu-link .arrow {
    float: right;
    transition: transform 0.3s;
}

/* Indentation and styling by depth */
.sidebar nav ul li.depth-1 > a.menu-link, .flyout-panel li.depth-1 > a.menu-link {
    padding-left: 40px;
    background: #3b4a5a;
    font-size: 0.95rem;
}

.sidebar nav ul li.depth-2 > a.menu-link, .flyout-panel li.depth-2 > a.menu-link {
    padding-left: 60px;
    background: #2c3e50;
    font-size: 0.9rem;
}

.sidebar nav ul li.depth-3 > a.menu-link, .flyout-panel li.depth-3 > a.menu-link {
    padding-left: 80px;
    background: #22303e;
    font-size: 0.85rem;
}

/* Hover styles */
.sidebar nav ul li > a.menu-link:hover,.flyout-panel li > a.menu-link:hover  {
    background: #2c3e50;
}

.sidebar nav ul li.depth-1 > a.menu-link:hover, .flyout-panel li.depth-1 > a.menu-link:hover {
    background: #2c3e50;
}

.sidebar nav ul li.depth-2 > a.menu-link:hover, .flyout-panel li.depth-2 > a.menu-link:hover {
    background: #1c2833;
}

.sidebar nav ul li.depth-3 > a.menu-link:hover, .flyout-panel li.depth-3 > a.menu-link:hover {
    background: #1c2833;
}

/* Active link style */
.sidebar a.menu-link.active,
.sidebar nav ul li ul.submenu li > a.menu-link.active,
.flyout-panel a.menu-link.active {
    font-weight: bold;
    color: #66c000;
}

.sidebar a.menu-link.active svg {
	fill: #66c000;
}

/* Submenu container */
.sidebar nav ul li.has-children > ul.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

/* Open submenu */
.sidebar li.has-children.open > ul.submenu {
    max-height: 500px;
}

.flyout-panel li.has-children.open > ul.submenu {
    max-height: 500px;
}

/* Arrow rotation when open */
.sidebar nav ul li.has-children.open > a.menu-link .arrow {
    transform: rotate(180deg);
}

.menu-text-wrapper {
    display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	gap: 6px;
	opacity: 1;
	transition: opacity 1s ease, transform 0.2s ease;
}
.sidebar.expanded .menu-text-wrapper {
    display: flex;
	align-items: center;
	gap: 6px;
	opacity: 0;
}
.sidebar.expanded .menu-text-wrapper.fade-in {
	opacity: 1;
}
.sidebar.collapsed {
	width: 60px;
}

.sidebar.collapsed .menu-text-wrapper {
    display: flex;
	align-items: center;
	gap: 6px;
	opacity: 0;
}

.sidebar.collapsed a.menu-link {
	padding: 12px;
	text-align: center;
}

.sidebar.collapsed .menu-icon {
	display: block;
	margin: 0 auto;
}

/* Optional tooltip-style hover labels */
.sidebar.collapsed .menu-link::after {
	content: attr(data-label);
	position: absolute;
	left: 100%;
	top: 50%;
	transform: translateY(-50%);
	background: #222;
	color: #fff;
	padding: 4px 8px;
	border-radius: 4px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
	margin-left: 6px;
	font-size: 0.9rem;
	z-index: 9999;
}

.sidebar.collapsed .menu-link:hover::after {
	opacity: 1;
}

.icon svg {
    transition: transform 0.3s ease;
    transform-origin: center;
}

.icon svg.rotate {
    transform: rotate(180deg);
}

.sidebar.collapsed .menu-label {
	opacity: 0;
	pointer-events: none;
}

.flyout-panel {
	position: absolute;
	top: 0;
	left: 60px; /* default beside collapsed sidebar */
	min-width: 200px;
	background: #1c2833;
	border: 1px solid #444;
	box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.4);
	z-index: 2000;
	display: none;
	overflow: hidden;
	animation: fadeIn 0.2s ease;
}

.flyout-panel.visible {
	display: block;
}

.flyout-panel ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.flyout-panel li > a.menu-link {
	padding: 10px 16px;
	display: block;
	color: #fff;
	text-decoration: none;
	background: none;
	font-size: 0.95rem;
}

.flyout-panel li.has-children > ul.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    background-color: #fff;
    transition: max-height 0.3s ease;
}

.flyout-panel li.has-children.open > ul.submenu {
    max-height: 500px;
}

.flyout-panel li > a.menu-link:hover {
	background-color: #2c3e50;
}

/* Indentation and styling by depth */
.flyout-panel li.depth-1 > a.menu-link {
    padding-left: 10px;
    background: #3b4a5a;
}

.flyout-panel li.depth-2 > a.menu-link {
    padding-left: 30px;
    background: #2c3e50;
}

.flyout-panel li.depth-3 > a.menu-link {
    padding-left: 50px;
    background: #22303e;
}

@keyframes fadeIn {
	from { opacity: 0; transform: translateX(-4px); }
	to { opacity: 1; transform: translateX(0); }
}


/*=============== table style listing (dark mode) ================*/
/*=============== container ===============*/
.at-list {
	container-type: inline-size;
	--card-gap: 10px;
}

.at-list__inner {
	display: flex;
	flex-direction: column;
	width: 100%;
	border-radius: 8px;
	overflow: hidden;
	background: #3b4a5a;
	box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/*=============== desktop header row ===============*/
.at-list-header {
	display: grid;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	background: #1c2833;
	color: #ccc;
	font-weight: 600;
	font-size: 14px;
	border-bottom: 1px solid #313131;
}
.at-list-header .at-col { padding: 0 4px; }

/*=============== row in desktop/table mode ===============*/
.at-card {
	display: grid;
	grid-auto-flow: column dense;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	color: #e0e0e0;
	border-bottom: 1px solid #313131;
}

.at-col {
    overflow: hidden;
	overflow-wrap: break-word;
}

/* place header/body/footer into tracks */
.at-card-header { display: contents; }
.at-card-body   { display: contents; }
.at-card-footer { display: inline-flex; gap: 8px; }

/* kv bits – desktop: no labels, inline layout */
.kv {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	overflow: hidden;
}
.kv .label {
	display: none;
}

/* avatars, pills, dots */
.avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid #444;
}
.badge {
    display: block;
    background: #22303e;
    color: #eee;
    border-radius: 10px;
    padding: 4px 8px;
    font-weight: bold;
    font-size: 16px;
}
.badge.red {
	color: #e14848;
}
.badge.green {
	color: #369f36;
}
.badge.yellow {
	color: #b5b526;
}
.badge.blue {
	color: #5a5af3;
}
.dot {
	width:8px;
	height:8px;
	border-radius:50%;
	display:inline-block;
}
.dot.green {
	background:#369f36;
}
.dot.red {
	background:#e14848;
}
.dot.yellow {
	background:#b5b526;
}
.dot.blue {
	background:#5a5af3;
}
.at-pagination {
    display: flex;
    gap: 20px;
    padding: 10px 10px;
}

.at-page-of {
    white-space: nowrap;
}

/*=============== mobile tablet screen ===============*/
@container (max-width: 1000px) {
	.at-list__inner {
		background: none;
		box-shadow: none;
		gap: var(--card-gap);
		border-radius: 0;
		overflow: visible;
	}

	.at-list-header { display: none; }

	.at-card {
		display: block;
		padding: 0;
		border: 1px solid #313131;
		border-radius: 6px;
		background: #3b4a5a;
	}

	.at-card-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 8px;
		background: rgba(0,0,0,0.12);
		padding: 12px 16px;
	}

	.at-card-body {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		padding: 4px 0;
		width: 100%;
	}

	.at-card-body > *:last-child:nth-child(odd) {
		grid-column: span 2;
	}

	.at-card-body .kv:not(:nth-child(-n+2)) {
		border-top: 1px solid #313131;
	}

	.kv {
		display: grid;
		grid-template-columns: auto 1fr;
		align-items: center;
		column-gap: 12px;
		padding: 10px 16px;
	}

	.kv .label {
		display: block;
		font-size: 12px;
		color: #aeb6bf;
	}

	.kv .value {
		justify-self: end;
		text-align: right;
	}

	/* footer */
	.at-card-footer {
		display: flex;
		justify-content: center;
		width: 100%;
		padding: 12px 16px 14px;
		background: rgba(0,0,0,0.12);
	}
}

/*=============== Mobile small screen ===============*/
@container (max-width: 520px) {
	.at-card-body {
		display: flex;
		flex-direction: column;
		gap: 0px;
	}

	.at-card-body .kv:not(:first-child) {
		border-top: 1px solid #313131;
	}
}

/*=============================== end of table/list layout =================================*/

@media (max-width: 568px) {
    .main-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
    	top: 0;
    	left: 0;
    	height: 100svh;
    	box-shadow: none;
    	transform: translateX(-100%);
    	transition: transform 0.3s ease;
    	z-index: 1000;
    }
    
    .sidebar.toggled {
    	transform: translateX(0);
    	box-shadow: 2px 0 10px rgba(0,0,0,0.4);
    }
    
    .sidebar.toggled + .content-area {
    	margin-left: 0px;
    }
    
    .sidebar-toggle-tab {
        position: absolute;
        top: 40%;
        left: 240px;
        width: 40px;
        height: 60px;
        background: #444;
        color: #fff;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        border-top-right-radius: 8px;
        border-bottom-right-radius: 8px;
        z-index: 1001;
        transition: background 0.2s;
    }
    
    .sidebar-toggle-tab:hover {
    	background: #333;
    }
    
    .sidebar nav ul li > a.menu-link {
        padding: 20px 20px;
        font-size: 1.2rem;
    }
    #sidebarCollapse {
        display: none;
    }
    
    .content {
        order: 1;
    }
    
    footer.footer {
        text-align: center;
    }
}

@media (max-width: 480px) {
    
}

/*=============== dynamic grids and containers ================*/
/* Base wrapper */

.at-detail-view {
    display: grid;
    gap: 1rem;
}

.at-detail-group {
    display: grid;
    gap: 1rem;
}

.at-detail-group.cols-2 { grid-template-columns: 1fr 1fr; }
.at-detail-group.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.at-detail-group.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.at-detail-group.cols-1 { grid-template-columns: 1fr; }

/* Container styling */
.at-detail-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Style variants */
.at-detail-container.style-default { 
    background: #22303e;
	border-color: #686e75;
}
.at-detail-container.style-muted { 
    background: #22303e6e; 
    border-color: #686e75; 
}
.at-detail-container.style-card { 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
}

/* Optional header */
.at-detail-header {
    display: flex;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.25rem;
    height: 35px;
    justify-content: space-between;
}

.container-tools {
	display: flex;
    height: 100%;
    justify-content: flex-end;
}

.tool-button {
	height: 100%;
    cursor: pointer;
}

.tool-button svg {
	height: 100%;
    display: block;
    fill: #fff;
}

.at-inner-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 1324px) {
	.at-detail-group.cols-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1024px) {
	.at-detail-group.cols-3 { grid-template-columns: 1fr; }
}

@media (max-width: 740px) {
    .at-detail-group[class*="cols-"] { grid-template-columns: 1fr; }
}