* {
    box-sizing: border-box;
}

html,
body {
	margin: 0;

	font-family: "Segoe UI", Tahoma, sans-serif;
    line-height: 1.5;
	color: #333333;
}

/*==========================
	LOGIN PAGE
==========================*/

.login-page {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
	
	min-height: 100vh;

    margin: 0;
	padding-bottom: 60px;
	
	background-image: var(--login-bg, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.login-wrapper {
    width: 100%;
    max-width: 340px;

    padding: 0 20px;
}

.login-error {
    width: 100%;

    margin-bottom: 14px;
    padding: 10px 12px;

    background-color: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 6px;

    font-size: 14px;
    text-align: center;
	color: #b91c1c;
}

.login-group {
    margin-bottom: 14px;
}

.login-group label {
    display: block;

    margin-bottom: 5px;

    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

.login-group input {
    width: 100%;

    padding: 10px 12px;

    background-color: rgba(255, 255, 255, 0.92);
    border: 1px solid #cbd5e1;
    border-radius: 8px;

    font-size: 14px;
    color: #111827;

    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-group input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.btn-login {
    width: 100%;

    margin-top: 18px;
	padding: 11px;

    background-color: #1d4ed8;
    border: none;
    border-radius: 8px;

    font-size: 15px;
    font-weight: 600;
    color: #ffffff;

    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-login:hover {
    background-color: #1e40af;
}

/*==========================
	PAGE LAYOUT
==========================*/

.layout {
	display: flex;

	min-height: 100dvh;
}

/*==========================
	SIDEBAR
==========================*/

.sidebar {
	position: fixed;
    top: 0;
    left: 0;

	display: flex;
	flex-direction: column;

	overflow-y: auto;

	width: 240px;
	height: 100dvh;

	padding: 20px;

	background-color: #273f55;

	color: #afb8c5;
}

.sidebar-scroll {
    flex: 1;

    overflow-y: auto;
}

.sidebar__title {
    margin-bottom: 32px;

	font-size: 18px;
    font-weight: 600;
	color: #ffffff;
}

.sidebar__logo-wrap {
	display: inline-flex;
	align-items: center;

	padding: 6px 0;

	background: none;
	border: none;
	box-shadow: none;
}

.sidebar__logo {
	display: block;

	width: auto;

	max-height: 36px;

	filter:
		drop-shadow(1px 0 0 rgba(255, 255, 255, 0.85))
		drop-shadow(-1px 0 0 rgba(255, 255, 255, 0.85))
		drop-shadow(0 1px 0 rgba(255, 255, 255, 0.85))
		drop-shadow(0 -1px 0 rgba(255, 255, 255, 0.85));
}

/*=== SIDEBAR SITE SELECTOR ===*/

.sidebar-selector {
	width: 100%;

    margin-bottom: 16px;
	padding-bottom: 10px;
}

.sidebar-selector label {
    display: block;

    margin-bottom: 6px;

    font-size: 12px;
    font-weight: 600;
}

.sidebar-selector form {
    width: 100%;
}

.sidebar-selector select {
    width: 100%;

	padding: 8px;

	background-color: #2b67a6;
	border: 1px solid #959ba3;
    border-radius: 6px;

	font-size: 16px;
	color: #ffffff;
}

.sidebar-single-site {
    padding-left: 13px;

	font-size: 16px;
    color: #ffffff;
}

/*=== SIDEBAR MENU ===*/

.sidebar-nav {
	display: flex;
	flex-direction: column;
	gap: 10px;

	width: 100%;
}

.sidebar-nav__group {
    margin-top: 16px;
    padding-top: 12px;

	border-top: 1px solid #95a1b1;
}

.sidebar-nav__group-toggle {
    display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	
	width: 100%;

	padding: 8px 12px;

	background: transparent;	
	border: none;
	border-radius: 12px;
    
    font-size: 14px;
    font-weight: 500;
    color: inherit;

    cursor: pointer;
}

.sidebar-nav__group-toggle:hover {
    background-color: rgba(255,255,255,.1);
}

.sidebar-nav__group-label {
    margin-right: auto;

	font-size: 14px;
	line-height: 1.5;
    text-align: left;
}

.sidebar-nav__submenu {
    display: none;
	flex-direction: column;
	gap: 4px;

	margin-top: 6px;
}

.sidebar-nav__submenu.active {
    display: flex;
}

.sidebar-nav__link {
	display: flex;
	align-items: center;
	gap: 10px;
	
	padding: 8px 12px;
    border-radius: 12px;

	font-size: 14px;
    font-weight: 500;
	text-decoration: none;
	color: inherit;

	transition: all 0.2s ease;
}

.sidebar-nav__link:hover {
	background-color: rgba(255, 255, 255, 0.1);
	opacity: 0.5;
}

.sidebar-nav__link.active {
    background-color: #44688d;
	opacity: 1;

	font-weight: 600;
    color: #ffffff;
}

.sidebar-nav__sublink {
    display: flex;
	align-items: center;
	gap: 8px;
	
	padding: 6px 12px 6px 28px;
	
	border-radius: 12px;

	font-size: 14px;
	text-decoration: none;
    color: inherit;

    transition: all 0.2s ease;
}

.sidebar-nav__sublink:hover {
    background-color: rgba(255,255,255,0.1);
	opacity: 0.5;
}

.sidebar-nav__sublink.active {
    background-color: #44688d;
	
    font-weight: 600;
	color: #ffffff;
}

/*=== SIDEBAR USER PROFILE ===*/

.sidebar-user {
    position: relative;

    margin-top: auto;
	padding-top: 15px;
	padding-left: 0px;

	border-top: 1px solid #95a1b1;
}

.sidebar-user__profile {
    display: flex;
	align-items: center;
	gap: 10px;

    padding: 0;

    border-radius: 8px;

    cursor: pointer;
	transition: background 0.2s ease;
}

.sidebar-user__profile:hover {
    background: rgba(0, 0, 0, 0.04);
}

.sidebar-user__avatar {
    border-radius: 50%;

    object-fit: cover;
}

.sidebar-user__info {
    flex-grow: 1;

    min-width: 0;
}

.sidebar-user__name {
	overflow: hidden;

	font-size: 12px;
    font-weight: 600;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: #ffffff;
}

.sidebar-user__role {
    font-size: 11px;
}

/*=== SIDEBAR USER MENU ===*/

.user-menu {
    position: absolute;
	bottom: calc(100% + 12px);
	left: 0;
    z-index: 99999;
	
	display: none;

	overflow: hidden;

	width: 200px;

	background: #ffffff;
	border: 1px solid #eaeaea;
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.user-menu.active {
    display: block !important;
}

.user-menu__name {
    padding: 12px 15px 4px;

	font-size: 14px;
	font-weight: 600;
}

.user-menu__email {
	padding: 0 15px 12px;
	
	font-size: 12px;
	color: #666666; 
}

.user-menu__item,
.user-menu__logout {
	display: block;

	padding: 10px 15px;

	font-size: 13px;
	text-decoration: none;
}

.user-menu__item {
    color: #333333;
}

.user-menu__logout {
	font-weight: 500;
	color: #dc3545;
}

.user-menu__item:hover,
.user-menu__logout:hover {
    background: #f8f9fa;
}

.user-menu hr {
    margin: 0;

    border: none;
    border-top: 1px solid #eeeeee;
}

/*==========================
	RIGHT PANEL
==========================*/

.main-wrapper {
	display: flex;
	flex-direction: column;
	flex: 1;
	
	min-width: 0;
	height: 100dvh;

	margin-left: 240px;

	background-color: #edf2f7;
	background-image: url('/assets/img/app_background.webp');
	background-position: center;
	background-repeat: no-repeat;
	background-size: cover;
}

/*==========================
	HEADER
==========================*/

.header {
    position: relative;
	z-index: 100;
	
	display: flex;
	justify-content: space-between;
	align-items: center;
	
	height: 45px;

	padding: 0 10px;

	background: #ffffff;
}

.header__right {
	display: flex;
	align-items: center;
	gap: 12px;
	
	margin-left: auto;
}

.language-dropdown {
    position: relative;
}

.language-dropdown__button {
	display: flex;
	align-items: center;
	gap: 6px;

	padding: 6px 10px;
	
	background: transparent;
	border: none;

	font-size: 13px;
	font-weight: 500;
	color: #344054;    

	cursor: pointer;
}

.language-dropdown__button:hover {
	background-color: #f5f7fa;
	color: #2563eb;
}

.language-dropdown__button img {
    display: block;
}

.language-dropdown__menu {
	position: absolute;
	top: 100%;
	right: 0;
	z-index: 1000;
	
	display: none;

	overflow: hidden;

	min-width: 80px;

	background: #ffffff;

	margin-top: 6px;

	border: 1px solid #d7dde5;
	border-radius: 6px;
	box-shadow: 0 8px 20px rgba(0,0,0,.10);
}

.language-dropdown__menu.active {
    display: block;
}

.language-dropdown__menu a {
	display: block;

	padding: 8px 12px;

	font-size: 13px;
	text-decoration: none;
	color: #344054;
}

.language-dropdown__menu a:hover {
    background: #f5f7fa;
}

/*==========================
	MAIN CONTENT
==========================*/

.main-content {
	flex: 1;

	overflow-y: auto;

	padding: 10px 24px;
}

.main-content--layout {
    display: flex;
	
	overflow: hidden;
	
	padding: 0;
}

.home-content {
	display: flex;
	align-items: flex-start;
	gap: 30px;
    
	padding: 12px 20px;
}

.home-content h1 {
	margin-top: 0;
	margin-bottom: 12px;
}

.home-content__image {
	width: 40%;
}

.home-content__text {
	width: 60%;
}

.home-image {
	width: 100%;
	height: auto;

	border-radius: 10px;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 15px;
}

.content-header h1 {
	margin: 0;
	
	font-size: 22px;
	font-weight: 600;
	color: #1e293b;
}

/*==========================
	FOOTER
==========================*/

.footer {
	display: flex;
	align-items: center;
	
	height: 32px;

	padding: 0 15px;

	background: transparent;
	border-top: none;
    
	font-size: 11px;
	color: rgba(51, 51, 51, 0.7);
}

/*==========================
	CARD BOX
==========================*/

.card {
	overflow: hidden;
	
	background-color: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card-form {
	max-width: 760px;

	padding: 20px;
}

/*==========================
	TABLE
==========================*/

.data-table {
	width: 100%;

	border-collapse: collapse;

	font-size: 14px;
	text-align: left;
}

.data-table th {
	padding: 12px 16px;

	background-color: #f8fafc;
	border-bottom: 1px solid #e2e8f0;
    
	font-weight: 600;
	color: #475569;
}

.data-table th a {
	text-decoration: none;
	color: inherit;
}

.data-table th a:hover {
	color: #2563eb;
}

.data-table td {
	vertical-align: middle;
	
	padding: 8px 16px;

	border-bottom: 1px solid #f1f5f9;

	color: #334155;
}

/* เอฟเฟกต์เปลี่ยนสีเมื่อเอาเมาส์ชี้แถวข้อมูล */

.data-table tbody tr:hover {
	background-color: #f8fafc;
}

.data-table tbody tr:last-child td {
	border-bottom: none;
}

/* คลาสจัดข้อความชิดขวา */

.text-right {
	text-align: right;
}

/* Search */

.table-toolbar {
	margin-bottom: 16px;
}

.table-toolbar .btn {
	height: 36px;
}

.table-toolbar__form {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
}

.table-toolbar__left {
	display: flex;
	align-items: center;
	gap: 10px;
}

.table-toolbar__right {
    display: flex;
	align-items: center;
    gap: 8px;
}

.search-input {
    width: 300px;
	height: 36px;

    padding: 8px 12px;

    border: 1px solid #cccccc;
    border-radius: 6px;

	font-size: 14px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 2px;
}

.search-button {
    position: relative;
	top: 2px;
	
	background: transparent;
    border: none;

    font-size: 18px;
    color: #64748b;

	cursor: pointer;
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;

	margin-top: 16px;
}

.table-footer select {
    width: 70px;
	height: 32px;

    padding: 0 8px;

    background: #ffffff;
	border: 1px solid #cbd5e1;
    border-radius: 6px;

	font-size: 13px;
    color: #475569;
}

.table-footer__left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-footer__left form {
    display: flex;
    align-items: center;
}

.table-footer__right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.table-footer__summary {
    margin-left: 12px;
	
	font-size: 13px;
    color: #475569;
}

/* Pagination */

.pagination {
    display: flex;
	align-items: center;
    gap: 6px;

	font-size: 13px;
}

.pagination a,
.pagination-info,
.pagination-disabled {
    display: flex;
    align-items: center;

	font-size: 13px;
	color: #475569;
}

.pagination a {
    min-width: 30px;
    height: 30px;

    border-radius: 6px;

	text-decoration: none;
}

.pagination a.active {
	background: #3b82f6;
	border-color: #3b82f6;

	color: #ffffff;
}

.pagination-info {
    margin-right: 8px;
}

.pagination-disabled {
	color: #94a3b8;

	cursor: default;
}

.pagination-form {
    margin-left: 8px;
	margin-right: 1px;
}

.pagination-current {
    width: 30px;
    height: 30px;

	background: #ffffff;
	border: 1px solid #cbd5e1;
    border-radius: 6px;
	box-shadow: 0 1px 2px rgba(0,0,0,.05);

    font-size: 13px;
	text-align: center;
}

.pagination-current::-webkit-outer-spin-button,
.pagination-current::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/*==========================
	FORM
==========================*/

.form-grid {
    display: grid;

    grid-template-columns: repeat(3, 1fr);
    row-gap: 10px;
	column-gap: 20px;
}

.form-group {
    margin-bottom: 5px;
}

.form-group label {
    display: block;

    margin-bottom: 4px;

	font-size: 13px;
    font-weight: 600;
	color: #475569;
}

.form-group input,
.form-group select {
    width: 100%;

    padding: 8px 10px;

    background-color: #ffffff;
	border: 1px solid #cccccc;
    border-radius: 6px;

	font-size: 14px;
	color: #475569;
}

.form-group textarea {
    width: 100%;
    min-height: 80px;

    padding: 8px 10px;

    background-color: #ffffff;
	border: 1px solid #cccccc;
    border-radius: 6px;

    font-size: 14px;
    color: #475569;

	resize: vertical;
}

.form-group-wide {
    grid-column: span 2;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group-checkbox {
    display: flex;
    flex-direction: column;
}

.form-group-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;

    margin-top: 6px;
}

.form-actions {
    margin-top: 20px;
}

.form-actions .btn {
    min-width: 80px;
}

.actions-column {
    text-align: center;
}

.action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-button img {
    display: block;
	
	width: 32px;
    height: 32px;
}

/*==========================
	BUTTON
==========================*/

/*=== General Button ===*/

.btn {
    display: inline-flex;
	justify-content: center;
	align-items: center;
	gap: 6px;

	min-height: 36px;

    padding: 7px 12px;

	border: 1px solid transparent;
	border-radius: 8px;

	font-size: 13px;
    font-weight: 600;
	text-decoration: none;

	cursor: pointer;
	transition:
		background-color .2s ease,
		box-shadow .2s ease,
		transform .2s ease;
}

.btn-primary {
    background-color: #3b82f6;
	border: 1px solid #3b82f6;
	border-top: 1px solid rgba(255,255,255,.25);
	box-shadow:
		0 1px 2px rgba(0,0,0,.08),
		0 2px 6px rgba(59,130,246,.15);

    color: #ffffff;
}

.btn-primary:hover {
    background-color: #2563eb;
	box-shadow: 0 4px 10px rgba(59,130,246,.25);

	transform: translateY(-1px);
}

.btn-secondary {
    background-color: #f1f5f9;
	border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);

    color: #475569;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
	box-shadow: 0 3px 8px rgba(0,0,0,.08);

	transform: translateY(-1px);
}

.btn-icon {
    position: relative;
	top: -1px;
	
	display: flex;
    align-items: center;
    justify-content: center;

    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

/*=== Small Button ===*/

.btn-sm {
    padding: 4px 10px;

	border-radius: 4px;

    font-size: 12px;
}

/*=== Dangerous Button ===*/

.btn-danger {
    background-color: #fee2e2;
	border: 1px solid #fca5a5;

    text-decoration: none;
	color: #dc2626;
}

.btn-danger:hover {
    background-color: #fecaca;
}

/*==========================
	TOGGLE SWITCH
==========================*/

.toggle-switch {
    position: relative;

    display: inline-block;

    width: 48px;
    height: 24px;
}

.toggle-switch input {
    display: none;
}

.slider {
    position: absolute;
    inset: 0;

    background: #cbd5e1;
    border-radius: 24px;

    cursor: pointer;
    transition: .3s;
}

.slider::before {
    position: absolute;
	top: 3px;
	left: 3px;

    width: 18px;
    height: 18px;

    background: white;
	border-radius: 50%;

	transition: .3s;

	content: '';
}

.toggle-switch input:checked + .slider {
    background: #22c55e;
}

.toggle-switch input:checked + .slider::before {
    transform: translateX(24px);
}

/*==========================
	DOT STATUS
==========================*/

.status-dot {
    display: inline-block;

	width: 10px;
    height: 10px;

	margin-right: 8px;
    
    border: 1px solid rgba(0,0,0,.1);
	border-radius: 50%;
}

/*==========================
	ALERT
==========================*/

.alert-success,
.alert-error {
    width: fit-content;
    min-width: 300px;
	
	margin-bottom: 16px;
	padding: 7px 12px;

    border-radius: 6px;

	font-size: 14px;
    line-height: 1.4;
}

.alert-success {
    background-color: #d1e7dd;
    border: 1px solid #badbcc;

	color: #0f5132;
}

.alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    
	color: #842029;
}

/*==========================
	SITE LAYOUT
==========================*/

.layout-editor {
    display: flex;
    flex-direction: column;
	flex: 1;
	
	width: 100%;

	min-height: 0;
}

.layout-toolbar {
    display: flex;
	flex-shrink: 0;
    align-items: center;
    gap: 6px;

	height: 50px;

    padding: 0 24px;

	background: #E2E8F0;
}

.layout-body {
    display: flex;
    flex: 1;

    min-height: 0;
}

.layout-wrapper {
    position: relative;

    flex: 1;

    min-width: 0;
    min-height: 0;
}

.layout-viewer {
    width: 100%;
    height: 100%;

    background: #E2E8F0;

}

.space-details {
    position: absolute;
    bottom: 16px;
	left: 16px;
    z-index: 99999;

	display: none;

    width: 240px;

    padding: 10px 12px;

    background: rgba(255,255,255,.95);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);

	font-size: 13px;

    backdrop-filter: blur(4px);
}

.space-details h3 {
    margin: 0 0 8px 0;

    font-size: 16px;
    font-weight: 600;
}

.detail-warning {
    margin-top: 8px;
	margin-bottom: 4px;

    font-size: 12px;
    font-style: italic;
	font-weight: 600;
    color: #dc2626;
}

.detail-row {
    display: flex;

    margin-bottom: 4px;
}

.detail-label {
    width: 55px;

    font-weight: 600;
    color: #64748b;
}

#btn-close-space-details {
    position: absolute;

    top: 6px;
    right: 8px;

    background: none;
    border: none;

	font-size: 18px;
	color: #64748b;

    cursor: pointer;
}

#edit-toolbar {
    display: none;
	align-items: center;
    gap: 6px;
}

.modal {
    position: fixed;
	inset: 0;
	z-index: 9999;
	
	display: none;
	justify-content: center;
	align-items: center;

    background: rgba(0, 0, 0, .5);
}

.modal-content {
    width: 320px;
	
	padding: 24px;
	
	background: #fff;
    border-radius: 8px;
}

.modal-actions {
    display: flex;

    justify-content: flex-end;
    gap: 8px;

	margin-top: 16px;
}

/*==========================
	OTHERS
==========================*/

.required-label::after {
    font-weight: 700;
	color: #dc3545;

	content: " *";
}

input,
select,
textarea,
button {
    font-family: inherit;
    font-size: inherit;
}

input:required,
select:required,
textarea:required {
	border: 1px solid #86b7fe;
    border-left: 3px solid #0d6efd;
}

.arrow-sm {
    font-size: 10px;
}