/* ============================================
   全局樣式和重置
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
}

/* ============================================
   容器和佈局
   ============================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.col-md-1 { flex: 0 0 calc(8.333% - 16px); }
.col-md-2 { flex: 0 0 calc(16.666% - 16px); }
.col-md-3 { flex: 0 0 calc(25% - 16px); }
.col-md-4 { flex: 0 0 calc(33.333% - 16px); }
.col-md-5 { flex: 0 0 calc(41.666% - 16px); }
.col-md-6 { flex: 0 0 calc(50% - 16px); }
.col-md-7 { flex: 0 0 calc(58.333% - 16px); }
.col-md-8 { flex: 0 0 calc(66.666% - 16px); }
.col-md-9 { flex: 0 0 calc(75% - 16px); }
.col-md-10 { flex: 0 0 calc(83.333% - 16px); }
.col-md-11 { flex: 0 0 calc(91.666% - 16px); }
.col-md-12 { flex: 0 0 calc(100% - 16px); }

/* ============================================
   導航欄
   ============================================ */

.navbar {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 1rem;
    align-items: center;
}

.navbar-link {
    color: #333;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s;
}

.navbar-link:hover,
.navbar-link.active {
    background: #667eea;
    color: white;
}

/* ============================================
   卡片組件
   ============================================ */

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.card h1,
.card h2,
.card h3,
.card h4,
.card h5,
.card h6 {
    margin-bottom: 1rem;
    color: #333;
}

/* ============================================
   按鈕
   ============================================ */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

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

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

.btn-warning {
    background: #ffc107;
    color: #333;
}

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

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   表單
   ============================================ */

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control.is-invalid {
    border-color: #dc3545;
}

.form-control.is-valid {
    border-color: #28a745;
}

.invalid-feedback,
.valid-feedback {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.invalid-feedback {
    color: #dc3545;
}

.valid-feedback {
    color: #28a745;
}

/* ============================================
   表格
   ============================================ */

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

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

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

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

.table-striped tbody tr:nth-child(odd) {
    background: #f8f9fa;
}

/* ============================================
   提示和警告
   ============================================ */

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

/* ============================================
   徽章
   ============================================ */

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-primary {
    background: #667eea;
    color: white;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-danger {
    background: #dc3545;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #333;
}

.badge-info {
    background: #17a2b8;
    color: white;
}

/* ============================================
   動畫
   ============================================ */

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bounce {
    animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* ============================================
   頁腳
   ============================================ */

.footer {
    background: #2c3e50;
    color: white;
    padding: 40px 20px;
    margin-top: 60px;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
    text-align: left;
}

.footer-section h4 {
    margin-bottom: 15px;
    font-size: 16px;
}

.footer-section a {
    display: block;
    color: #bbb;
    text-decoration: none;
    margin-bottom: 8px;
    transition: color 0.3s;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #444;
    padding-top: 20px;
    color: #bbb;
    font-size: 14px;
}

/* ============================================
   響應式設計
   ============================================ */

@media (max-width: 768px) {
    .navbar-menu {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .row {
        flex-direction: column;
    }
    
    .col-md-1,
    .col-md-2,
    .col-md-3,
    .col-md-4,
    .col-md-5,
    .col-md-6,
    .col-md-7,
    .col-md-8,
    .col-md-9,
    .col-md-10,
    .col-md-11,
    .col-md-12 {
        flex: 0 0 100%;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 8px;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.875rem;
    }
}

/* ============================================
   工具類
   ============================================ */

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

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

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

.text-muted {
    color: #999;
}

.text-danger {
    color: #dc3545;
}

.text-success {
    color: #28a745;
}

.text-warning {
    color: #ffc107;
}

.text-info {
    color: #17a2b8;
}

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

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

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
.p-5 { padding: 3rem; }

.d-none {
    display: none;
}

.d-block {
    display: block;
}

.d-inline {
    display: inline;
}

.d-inline-block {
    display: inline-block;
}

.d-flex {
    display: flex;
}

.justify-content-center {
    justify-content: center;
}

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

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

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