:root {
    --primary-red: #ff6b6b;
    --sidebar-bg: #212529;
    --sidebar-width: 260px;
}

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    overflow-x: hidden;
}

/* 側邊欄佈局 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: 0.3s;
    padding: 20px;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
}

.main-content {
    margin-left: var(--sidebar-width);
    transition: 0.3s;
    padding: 30px;
    min-height: 100vh;
}

/* 導航連結 */
.nav-link {
    color: #adb5bd;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: 0.2s;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-red);
    color: white;
}

.nav-link i {
    width: 25px;
}

/* Dashboard 卡片 */
.stat-card {
    border: none;
    border-radius: 15px;
    padding: 25px;
    color: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    height: 100%;
    transition: 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    filter: brightness(1.1);
}

.stat-card i {
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 5rem;
    opacity: 0.2;
}

/* 排班表樣式 */
.schedule-scroll {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    border: 1px solid #ddd;
    padding: 1px;
}

.schedule-table {
    width: 100%;
    min-width: 1400px;
    border-collapse: collapse;
}

.schedule-table th,
.schedule-table td {
    border: 1px solid #eee;
    text-align: center;
    font-size: 11px;
    padding: 10px 4px;
}

.schedule-table th:first-child,
.schedule-table td:first-child {
    position: sticky;
    left: 0;
    background: #f8f9fa;
    z-index: 10;
    border-right: 2px solid #ddd;
}

.shift-select {
    width: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-weight: bold;
    cursor: pointer;
}

.shift-select:focus {
    outline: none;
}

/* 班別顏色 */
.shift-A { background: #fff3cd !important; color: #856404; font-weight: bold; }
.shift-B { background: #d1ecf1 !important; color: #0c5460; font-weight: bold; }
.shift-C { background: #d4edda !important; color: #155724; font-weight: bold; }
.shift-D { background: #f8d7da !important; color: #721c24; font-weight: bold; }
.shift-E { background: #e2e3e5 !important; color: #383d41; font-weight: bold; }

/* 薪資輸入 */
.payroll-input {
    width: 70px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
}

.payroll-input:focus {
    border-color: var(--primary-red);
    outline: none;
}

/* 菜單圖片預覽 */
.menu-img-preview {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
}

/* RTL (波斯語) 支援 - 原有規則 */
body.rtl {
    direction: rtl;
    text-align: right;
}

body.rtl .sidebar {
    right: 0;
    left: auto;
}

body.rtl .main-content {
    margin-right: var(--sidebar-width);
    margin-left: 0;
}

body.rtl .me-2 {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

body.rtl .ms-2 {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
}

body.rtl .schedule-table th:first-child,
body.rtl .schedule-table td:first-child {
    right: 0;
    left: auto;
    border-left: 2px solid #ddd;
    border-right: none;
}

/* RTL 加強規則 - 表格、按鈕、輸入框等 */
body.rtl .table th,
body.rtl .table td {
    text-align: right !important;
}

body.rtl input,
body.rtl textarea,
body.rtl select {
    text-align: right;
}

body.rtl input::placeholder,
body.rtl textarea::placeholder {
    text-align: right;
}

body.rtl .btn i,
body.rtl .btn .fas,
body.rtl .btn .far,
body.rtl .btn .fab {
    margin-right: 0 !important;
    margin-left: 0.5rem !important;
}

body.rtl .d-flex.justify-content-between,
body.rtl .d-flex.justify-content-start,
body.rtl .d-flex.justify-content-end {
    flex-direction: row-reverse;
}

body.rtl .card-body,
body.rtl .card-title,
body.rtl .card-text,
body.rtl .text-center,
body.rtl .text-start,
body.rtl .text-end {
    text-align: right !important;
}

body.rtl ul,
body.rtl ol {
    padding-right: 1.5rem;
    padding-left: 0;
}

/* RTL - 手機版加強 */
@media (max-width: 992px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }
    .sidebar.active {
        margin-left: 0;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 15px;
    }
    body.rtl .sidebar {
        margin-right: calc(-1 * var(--sidebar-width));
        margin-left: 0;
    }
    body.rtl .sidebar.active {
        margin-right: 0;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 900;
    }
    body.rtl .sidebar-overlay {
        left: auto;
        right: 0;
    }
    .sidebar-overlay.show {
        display: block;
    }
}