/* 全域設定 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

/* 登入頁面 */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(145deg, #6a8caf 0%, #a8c0d8 100%);
}
.login-container {
    background: rgba(255,255,255,0.95);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    width: 90%;
    max-width: 400px;
    text-align: center;
}
.login-container h1 {
    margin-bottom: 2rem;
    color: #2c3e50;
    font-weight: 400;
    font-size: 1.8rem;
}
.login-container .form-group {
    text-align: left;
    margin-bottom: 1.2rem;
}
.login-container label {
    display: block;
    margin-bottom: 0.3rem;
    color: #4a5568;
    font-weight: 500;
}
.login-container input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d0d9e8;
    border-radius: 30px;
    font-size: 1rem;
    transition: border 0.2s;
}
.login-container input:focus {
    outline: none;
    border-color: #4f8bc9;
    box-shadow: 0 0 0 3px rgba(79,139,201,0.2);
}
/* 頁面標題與操作按鈕 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h2 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 500;
    color: #1e293b;
}

/* 強化按鈕現代感 */
.btn-primary {
    background: linear-gradient(145deg, #4f8bc9, #3a6fa3);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
	color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s;
}
	
.btn-primary:hover {
    background: linear-gradient(145deg, #3a6fa3, #2c4f7a);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
a.btn-primary {
    text-decoration: none;
    cursor: pointer;
}
/* 後台主要結構 */
.main-header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.logo a {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    text-decoration: none;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.btn-logout {
    background: #e2e8f0;
    color: #4a5568;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.btn-logout:hover {
    background: #cbd5e0;
}

.main-wrapper {
    display: flex;
    min-height: calc(100vh - 70px);
}

.sidebar {
    width: 180px;
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.02);
    padding: 2rem 0;
}
.sidebar nav ul {
    list-style: none;
}
.sidebar nav ul li a {
    display: block;
    padding: 0.8rem 1.5rem;
    color: #4a5568;
    text-decoration: none;
    transition: background 0.2s, border-left 0.2s;
    border-left: 4px solid transparent;
}
.sidebar nav ul li a:hover,
.sidebar nav ul li a.active {
    background: #f0f5ff;
    border-left-color: #4f8bc9;
    color: #2c3e50;
}

.content {
    flex: 1;
    padding: 0.5rem 1rem;
    background: #f5f7fa;
}

/* 表格與表單樣式 */
.data-table {
	width: 100%;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.02);
    background: white;
    overflow: hidden;
	border-collapse: collapse;
}
.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ecf0f3;
}
.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #334155;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}
.data-table tbody tr {
    transition: background 0.15s;
}
.data-table tbody tr:hover {
    background: #f1f5f9;
}
.parent-row td:first-child {
    font-weight: 600;
}
.child-row td:first-child {
    padding-left: 2.5rem;
    color: #5a6978;
}

/* 操作按鈕微調 */
.btn-edit, .btn-delete, .btn-view, .btn-approve, .btn-reject {
    padding: 0.4rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
}
.btn-edit {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}
.btn-edit:hover {
    background: #bae6fd;
    color: #075985;
}
.btn-delete {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
.btn-delete:hover {
    background: #fecaca;
    color: #991b1b;
}
/* 操作按鈕補充 */
.btn-view {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}
.btn-approve {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}
.btn-reject {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}
/* 響應式優化 */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .page-header .actions {
        width: 100%;
    }
    .page-header .btn-primary {
        width: 100%;
        justify-content: center;
    }
    /* 表格卡片樣式已存在，此處可保留原有 .data-table td:before 等 */
}
.actions {
    margin-bottom: 1.5rem;
}

/* 表單 */
.form {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.02);
    max-width: 100%;
}
.form-group {
    margin-bottom: 0.5rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    color: #2d3748;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid #dce5ec;
    border-radius: 8px;
    font-size: 1rem;
    transition: border 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #4f8bc9;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79,139,201,0.1);
}
.checkbox label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
}
.checkbox input {
    width: auto;
}
.required {
    color: #e53e3e;
}
.form-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}
.btn-cancel {
    background: #e2e8f0;
    color: #4a5568;
    padding: 0.7rem 2rem;
    border-radius: 30px;
    text-decoration: none;
    font-size: 1rem;
}
.success {
    background: #d4edda;
    color: #155724;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* 響應式 */
@media (max-width: 768px) {
    .main-wrapper {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        padding: 1rem 0;
    }
    .sidebar nav ul {
        display: flex;
        flex-wrap: wrap;
    }
    .sidebar nav ul li {
        flex: 1 1 auto;
    }
    .sidebar nav ul li a {
        padding: 0.6rem 1rem;
        border-left: none;
        border-bottom: 3px solid transparent;
        text-align: center;
    }
    .sidebar nav ul li a:hover {
        border-bottom-color: #4f8bc9;
        background: none;
    }
    .content {
        padding: 1.5rem;
    }
    .data-table thead {
        display: none; /* 簡易作法：表格變卡片，可再強化作業 */
    }
    .data-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #ecf0f3;
        border-radius: 12px;
        padding: 0.5rem;
    }
    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed #ecf0f3;
        padding: 0.75rem;
    }
    .data-table td:last-child {
        border-bottom: none;
    }
    .data-table td:before {
        content: attr(data-label);
        font-weight: 600;
        width: 40%;
        color: #2d3748;
    }
    .child-row td:first-child {
        padding-left: 1rem;
    }
}
/* transactions */
/* 金額靠右對齊 */
.amount {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

/* 狀態標籤 */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
}
.status-草稿 {
    background: #f1f5f9;
    color: #475569;
}
.status-已核准 {
    background: #dcfce7;
    color: #166534;
}
.status-已結帳 {
    background: #cffafe;
    color: #0891b2;
}
.status-已取消 {
    background: #fee2e2;
    color: #b91c1c;
}

/* 表格行交替背景 */
.data-table tbody tr:nth-child(odd) {
	background-color: #e6f3ff; /* 淺藍色 */
}
.data-table tbody tr:nth-child(even) {
	background-color: #ffffff; /* 白色 */
}
/* 選中行高亮 */
.data-table tbody tr.selected {
	background-color: #fff9c4 !important; /* 淡黃色 */
}
/* 批次操作列 */
.batch-actions {
	display: flex;
	gap: 0.5rem;
	align-items: center;
	margin-bottom: 1rem;
	flex-wrap: wrap;
}
.batch-actions .btn {
	padding: 0.4rem 1rem;
	border-radius: 30px;
	font-size: 0.9rem;
	text-decoration: none;
	border: none;
	cursor: pointer;
	transition: background 0.2s;
}
.btn-view { background: #f1f5f9; color: #334155; border: 1px solid #cbd5e1; }
.btn-edit { background: #e6f7ff; color: #0099cc; border: 1px solid #b3e6ff; }
.btn-approve { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.btn-reject { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.btn-delete { background: #ffe6e6; color: #cc0000; border: 1px solid #ffb3b3; }
.btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
/* 分頁 */
.pagination {
	margin-top: 1.5rem;
	display: flex;
	justify-content: center;
	gap: 0.5rem;
}
.pagination a, .pagination span {
	padding: 0.4rem 0.8rem;
	border-radius: 8px;
	background: white;
	border: 1px solid #dce5ec;
	color: #2d3748;
	text-decoration: none;
}
.pagination .active {
	background: #4f8bc9;
	color: white;
	border-color: #4f8bc9;
}
/*查詢*/
.search-form {
	background: white;
	padding: 0.5rem 1rem;
	border-radius: 16px;
	box-shadow: 0 5px 15px rgba(0,0,0,0.03);
	/*margin-bottom: 2rem;*/
}
.form-row {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	/*margin-bottom: 1rem;*/
}
.form-group {
	flex: 1 1 200px;
}
.form-group label {
	display: block;
	margin-bottom: 0.3rem;
	font-weight: 500;
}
.form-group input, .form-group select {
	/*width: 100%;*/
	padding: 0.5rem;
	border: 1px solid #dce5ec;
	border-radius: 8px;
}
.checkbox-group {
	display: flex;
	gap: 1rem;
	align-items: center;
	flex-wrap: wrap;
}
.checkbox-group label {
	margin-right: 0.5rem;
}
.btn {
	padding: 0.5rem 1.5rem;
	border-radius: 30px;
	border: none;
	cursor: pointer;
	font-size: 1rem;
}
.btn-primary {
	background: #4f8bc9;
	color: white;
}
.btn-secondary {
	background: #e2e8f0;
	color: #2d3748;
}
.export-buttons {
	margin-top: 1rem;
	display: flex;
	gap: 0.5rem;
}
.summary-section {
	margin-top: 1rem;
	background: white;
	border-radius: 16px;
	padding: 0.8rem;
	box-shadow: 0 5px 15px rgba(0,0,0,0.03);
}
.summary-section h3 {
	margin-top: 0;
	margin-bottom: 1rem;
	color: #2d3748;
}
table {
	width: 100%;
	border-collapse: collapse;
}
th {
	background: #f8fafc;
	padding: 0.75rem;
	text-align: left;
}
td {
	padding: 0.75rem;
	border-bottom: 1px solid #ecf0f3;
}
.amount {
	text-align: right;
}
.nav-tabs {
	display: flex;
	gap: 1rem;
	margin-bottom: 1rem;
	border-bottom: 1px solid #dce5ec;
}
.nav-tabs a {
	padding: 0.5rem 1rem;
	text-decoration: none;
	color: #4a5568;
	border-bottom: 2px solid transparent;
}
.nav-tabs a.active {
	border-bottom-color: #4f8bc9;
	color: #2c3e50;
	font-weight: 600;
}
/* 交替背景色 */
.data-table tbody tr:nth-child(odd) {
	background-color: #e6f3ff; /* 淺藍色 */
}
.data-table tbody tr:nth-child(even) {
	background-color: #ffffff; /* 白色 */
}