:root {
    --primary-blue: #4A90E2;
    --primary-orange: #FF8C42;
    --bg-color: #FFF9F2;
    --card-bg: #FFFFFF;
    --text-dark: #333333;
    --text-light: #666666;
    --accent-green: #4CAF50;
    --accent-purple: #9C27B0;
    --accent-red: #E91E63;
    --border-color: #E0E0E0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

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

body {
    font-family: "Helvetica Neue", Helvetica, Arial, "Microsoft JhengHei", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* 導航欄 */
.navbar {
    background: linear-gradient(135deg, var(--primary-blue), #2c3e50);
    color: white;
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.navbar-link {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.navbar-link:hover {
    opacity: 0.8;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    background: rgba(255,255,255,0.2);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

/* 容器 */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.container-small {
    max-width: 500px;
    margin: 3rem auto;
    padding: 0 2rem;
}

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.card-header {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: var(--primary-blue);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    margin-top: 1rem;
}

/* 表單 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.form-label.required::after {
    content: ' *';
    color: var(--accent-red);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-checkbox {
    width: auto;
    margin-right: 0.5rem;
}

.form-file {
    border: 2px dashed var(--border-color);
    padding: 2rem;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.3s;
}

.form-file:hover {
    border-color: var(--primary-blue);
}

.form-help {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.form-error {
    color: var(--accent-red);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* 按鈕 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background: #3a7bc8;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

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

.btn-warning {
    background: var(--primary-orange);
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--text-dark);
}

.table tr:hover {
    background: #f8f9fa;
}

.table tr:last-child td {
    border-bottom: none;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 0.35rem 0.65rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
}

.badge-primary {
    background: var(--primary-blue);
}

.badge-success {
    background: var(--accent-green);
}

.badge-danger {
    background: var(--accent-red);
}

.badge-warning {
    background: var(--primary-orange);
}

.badge-info {
    background: var(--accent-purple);
}

.badge-secondary {
    background: #6c757d;
}

/* Flash消息 */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--accent-green);
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--accent-red);
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid var(--primary-orange);
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid var(--primary-blue);
}

/* 統計卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-blue), #2c3e50);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.stat-card.orange {
    background: linear-gradient(135deg, var(--primary-orange), #e67e22);
}

.stat-card.green {
    background: linear-gradient(135deg, var(--accent-green), #45a049);
}

.stat-card.purple {
    background: linear-gradient(135deg, var(--accent-purple), #7b1fa2);
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
}

/* 模態對話框 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-header {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state-text {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .navbar-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .navbar-menu {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* 登入頁面特殊樣式 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-blue), #2c3e50);
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-title {
    font-size: 1.8rem;
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* 動畫 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* 工具類 */
.text-center {
    text-align: center;
}

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

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

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

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

