/* Theme Colors */
:root {
    --primary-color: #CD9F7A;
    --primary-dark: #B88B66;
    --primary-light: #E2B68D;
    --text-on-primary: #ffffff;
    --sidebar-bg: #1a1a1a;
    --sidebar-hover: #2c2c2c;
    --border-color: #dee2e6;
    --success-bg: #d4edda;
    --success-text: #155724;
    --danger-bg: #f8d7da;
    --danger-text: #721c24;
}

/* Form Controls */
.form-check-input:checked {
    background-color: #CD9F7A;
    border-color: #CD9F7A;
}

.form-check-input:focus {
    border-color: #CD9F7A;
    box-shadow: 0 0 0 0.25rem rgba(205, 159, 122, 0.25);
}

/* Select2 Custom Styles */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 38px;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding-left: 0;
    line-height: 1.5;
}

.select2-container--bootstrap-5 .select2-dropdown {
    border-color: var(--border-color);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-on-primary);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--text-on-primary);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-on-primary);
}

.btn-link {
    color: var(--primary-color);
}

.btn-link:hover {
    color: var(--primary-dark);
}

/* Menu Toggle Button */
#sidebarCollapse {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-on-primary);
}

#sidebarCollapse:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

#sidebarCollapse:focus {
    box-shadow: 0 0 0 0.25rem rgba(205, 159, 122, 0.25);
}

/* Tabs */
.nav-tabs .nav-link {
    color: var(--primary-color);
}

.nav-tabs .nav-link.active {
    color: var(--text-on-primary);
    background-color: var(--primary-color);
    border-color: var(--primary-color) var(--primary-color) #fff;
}

.tab-content {
    border: 1px solid var(--primary-color);
    border-top: none;
    padding: 20px;
}

.nav-tabs {
    border-bottom: 1px solid var(--primary-color);
}

/* Table Sorting */
.sortable {
    cursor: pointer;
    position: relative;
}

.index-page .table thead th,
.index-page .table tbody td {
    font-size: 0.875rem;
}

.sortable::after {
    content: '↕';
    position: absolute;
    right: 8px;
    color: #999;
}

.sortable.asc::after {
    content: '↑';
    color: #000;
}

.sortable.desc::after {
    content: '↓';
    color: #000;
}

.sortable:hover {
    background-color: rgba(0,0,0,0.05);
}

/* Sidebar */
#sidebar {
    min-width: 250px;
    max-width: 250px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: #fff;
    transition: all 0.3s;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* keep header visible; scroll menu instead */
}

#sidebar.active {
    margin-left: -250px;
}

#sidebar .sidebar-header {
    padding: 20px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-hover);
}

#sidebar .sidebar-menu {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
}

#sidebar ul.components {
    padding: 20px 0;
}

#sidebar ul li a {
    padding: 10px;
    font-size: 1.1em;
    display: block;
    color: #fff;
    text-decoration: none;
    border-left: 3px solid transparent;
}

#sidebar ul li a:hover {
    background: var(--sidebar-hover);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

#sidebar ul li.active > a {
    background: var(--sidebar-hover);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

/* Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    overflow-x: hidden;
    align-items: stretch;
    background: var(--sidebar-bg);
}

#content {
    width: 100%;
    min-height: 100%;
    transition: all 0.3s;
    background: #ffffff;
    margin-left: 250px;
    flex: 1;
    padding: 0 15px;
}

#content.full-width {
    margin-left: 0;
    width: 100%;
}

/* Auth Layout */
.auth-layout {
    background-color: var(--bs-light);
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.auth-layout .card {
    border-radius: 1rem;
    border: none;
}

.auth-layout .card-body {
    padding: 2rem;
}

/* Images */
.img-thumbnail {
    transition: transform 0.2s;
    max-height: 150px;
    cursor: pointer;
}

.img-thumbnail:hover {
    transform: scale(1.1);
}

.modal-body img {
    max-height: 80vh;
    object-fit: contain;
}

/* Toast */
.toast-container {
    z-index: 1050;
    position: fixed;
    bottom: 1rem;
    right: 1rem;
}

.toast {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-header {
    background-color: var(--sidebar-bg);
    color: white;
    border-radius: 8px 8px 0 0;
}

.toast-header .btn-close {
    filter: brightness(0) invert(1);
}

.toast-body.text-bg-success {
    background-color: var(--success-bg);
    color: var(--success-text);
}

.toast-body.text-bg-danger {
    background-color: var(--danger-bg);
    color: var(--danger-text);
}

/* Filter Section */
.filter-section {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.filter-section .form-control,
.filter-section .form-select {
    border-radius: 4px;
}

/* Cards */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    background: #ffffff;
    margin-bottom: 20px;
}

.card-body {
    padding: 20px;
}

/* Navbar */
#content .navbar {
    padding: 15px 10px;
    background: #ffffff !important;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

/* Container */
.container-fluid {
    padding-top: 10px;
    padding-bottom: 20px;
}

/* Dropdown */
.dropdown-item:active,
.dropdown-item:focus,
.dropdown-item:hover {
    background-color: var(--primary-light);
    color: var(--text-on-primary);
}

/* Sidebar Dropdown */
.sidebar-dropdown > a:after {
    content: "\F282";
    font-family: "bootstrap-icons";
    font-size: 0.8em;
    margin-left: 10px;
    transition: transform 0.3s;
}

.sidebar-dropdown.active > a:after {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: none;
    padding-left: 20px;
}

.sidebar-submenu.show {
    display: block;
}

.sidebar-submenu ul {
    padding-left: 0;
    list-style: none;
}

.sidebar-submenu li a {
    padding: 8px 15px;
    display: block;
    font-size: 0.9em;
    color: #818896;
    text-decoration: none;
}

.sidebar-submenu li a:hover,
.sidebar-submenu li.active a {
    color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    #sidebar {
        margin-left: -250px;
    }
    #sidebar.active {
        margin-left: 0;
    }
    #content {
        margin-left: 0;
    }
    #content.full-width {
        margin-left: 0;
    }
}

/* 語言切換按鈕 */
.language-btn {
    margin: 0 5px;
}

.language-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-on-primary);
}

/* 菜單切換按鈕 */
#sidebarCollapse {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-on-primary);
}

#sidebarCollapse:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

#sidebarCollapse:focus {
    box-shadow: 0 0 0 0.25rem rgba(205, 159, 122, 0.25);
}

/* 卡片樣式 */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    background: #ffffff;
    margin-bottom: 20px;  /* 添加底部間距 */
}

/* 卡片內容區域 */
.card-body {
    padding: 20px;  /* 增加內邊距 */
}

/* 排序表頭樣式 */
.sortable {
    position: relative;
    cursor: pointer;
}

.sortable:hover {
    background-color: rgba(0,0,0,0.05);
}

/* 篩選區域樣式 */
.filter-section {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.filter-section .form-control,
.filter-section .form-select {
    border-radius: 4px;
} 

/* Sidebar dropdown styles */
.sidebar-dropdown > a:after {
    content: "\F282";
    font-family: "bootstrap-icons";
    font-size: 0.8em;
    margin-left: 10px;
    transition: transform 0.3s;
}

.sidebar-dropdown.active > a:after {
    transform: rotate(180deg);
}

.sidebar-submenu {
    display: none;
    padding-left: 20px;
}

.sidebar-submenu.show {
    display: block;
}

.sidebar-submenu ul {
    padding-left: 0;
    list-style: none;
}

.sidebar-submenu li a {
    padding: 8px 15px;
    display: block;
    font-size: 0.9em;
    color: #818896;
    text-decoration: none;
}

.sidebar-submenu li a:hover,
.sidebar-submenu li.active a {
    color: var(--bs-primary);
}

/* Select2 Styles */
/* Ensure dropdowns appear above other elements */
.select2-container--bootstrap-5 {
    z-index: 1056 !important; /* Higher than modal backdrop */
}

/* Prevent dropdown from being cut off */
.select2-container--bootstrap-5 .select2-dropdown {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}

/* Ensure proper spacing and alignment */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 38px !important;
}

/* Fix dropdown position in table */
.table td .select2-container {
    width: 100% !important;
} 