* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
    background-color: #f5f5f5;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1 {
    color: #333;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 3px solid #4CAF50;
}

h2 {
    color: #555;
    margin: 25px 0 15px;
}

/* 導覽選單 */
.nav {
    background: #333;
    padding: 0;
    margin: -30px -30px 30px -30px;
    border-radius: 8px 8px 0 0;
    position: relative;
}

.nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

.nav li {
    flex: 1;
    min-width: 150px;
}

.nav a, .nav span {
    display: block;
    color: white;
    text-decoration: none;
    padding: 15px 20px;
    text-align: center;
    transition: background 0.3s;
}

.nav a:hover, .nav a.active {
    background: #4CAF50;
}

/* 漢堡選單按鈕 */
.menu-toggle {
    display: none;
    background: #333;
    border: none;
    color: white;
    font-size: 24px;
    padding: 15px 20px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    border-radius: 8px 8px 0 0;
}

.menu-toggle:hover {
    background: #444;
}

/* 表單樣式 */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

label.required::after {
    content: ' *';
    color: red;
}

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 5px rgba(76,175,80,0.3);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* 按鈕樣式 */
button, .btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    text-decoration: none;
    display: inline-block;
}

button:hover, .btn:hover {
    background: #45a049;
}

.btn-danger {
    background: #f44336;
}

.btn-danger:hover {
    background: #da190b;
}

.btn-secondary {
    background: #757575;
}

.btn-secondary:hover {
    background: #616161;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

/* 表格樣式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background: #f8f8f8;
    font-weight: bold;
    color: #555;
}

tr:hover {
    background: #f5f5f5;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

/* 訊息提示 */
.message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 查詢輸出區 */
.output-box {
    background: #f9f9f9;
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 4px;
    margin-top: 20px;
}

.output-box h3 {
    color: #333;
    margin-bottom: 10px;
}

.output-box textarea {
    width: 100%;
    min-height: 100px;
    font-family: 'Courier New', monospace;
    background: white;
}

/* 報表樣式 */
.report-table {
    overflow-x: auto;
}

.report-table table {
    min-width: 800px;
}

.report-table th {
    background: #4CAF50;
    color: white;
}

.report-table .total-col {
    background: #fff3cd;
    font-weight: bold;
}

/* 排序按鈕 */
.sort-buttons {
    display: inline-block;
    margin-left: 10px;
}

.sort-buttons a {
    display: inline-block;
    padding: 2px 6px;
    background: #e0e0e0;
    color: #333;
    text-decoration: none;
    border-radius: 3px;
    font-size: 12px;
    margin: 0 2px;
}

.sort-buttons a:hover {
    background: #bdbdbd;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .nav {
        margin: -15px -15px 15px -15px;
    }

    /* 顯示漢堡選單按鈕 */
    .menu-toggle {
        display: block;
    }

    /* 預設隱藏選單 */
    .nav ul {
        display: none;
        flex-direction: column;
        width: 100%;
    }

    /* 展開時顯示選單 */
    .nav ul.show {
        display: flex;
    }

    .nav li {
        min-width: 100%;
        flex: none;
    }

    .nav a, .nav span {
        text-align: left;
        border-top: 1px solid #444;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px;
    }
}
