* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f4f5f7;
    margin: 0;
    color: #333;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 80px;
    /* 修改：底部留空間給懸浮按鈕，避免擋住內容 */
}

/* 上方固定區 */
.sticky-header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: 0 15px 15px 15px;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

/* 狀態顯示區 */
.status-wrapper {
    padding-top: 20px;
    padding-bottom: 10px;
}

.status-box {
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.status-box.empty {
    color: #888;
    padding: 10px;
    font-size: 0.95rem;
}

.status-box h3 {
    margin: 0 0 5px 0;
    color: #1f2937;
}

.highlight {
    font-size: 1.6rem;
    font-weight: 800;
    color: #2563eb;
    margin: 8px 0;
    letter-spacing: 0.5px;
}

.compare-row {
    font-size: 1rem;
    color: #4b5563;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vs {
    background: #e5e7eb;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: bold;
}

/* --- 篩選與搜尋控制區 --- */
.controls-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
}

/* 搜尋框樣式 */
.search-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    width: 18px;
    height: 18px;
}

.search-input {
    width: 100%;
    padding: 10px 10px 10px 36px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 下拉選單樣式 */
.category-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.95rem;
    color: #1f2937;
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%231F2937%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 10px auto;
    transition: border-color 0.2s;
}

.category-select:focus {
    border-color: #2563eb;
    background-color: #fff;
}

/* 列表區 */
.event-list {
    padding: 15px;
    margin-top: 10px;
}

.event-card {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
}

.event-card:active {
    transform: scale(0.98);
}

.event-card.selected {
    border-color: #2563eb;
    background-color: #eff6ff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.event-card.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background-color: #2563eb;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.category-tag {
    background: #e0e7ff;
    color: #4338ca;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.event-date {
    font-size: 1.1rem;
    color: #4e5057;
    font-family: monospace;
}

.card-main h4 {
    margin: 0;
    font-size: 1.2rem;
    color: #111827;
    font-weight: 600;
}

.note {
    margin: 6px 0 0 0;
    font-size: 0.9rem;
    color: #6b7280;
    line-height: 1.4;
}

.card-footer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e5e7eb;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #9ca3af;
}

.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 80vh;
    color: #6b7280;
    flex-direction: column;
    gap: 15px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.empty-filter-msg {
    text-align: center;
    color: #9ca3af;
    padding: 40px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 以下是新增的樣式 (FAB 按鈕與 Modal 彈窗) --- */

/* 新增資料按鈕 (Floating Action Button) */
.fab-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: #2563eb;
    color: white;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background-color 0.2s;
    z-index: 500;
}

.fab-btn:hover {
    transform: scale(1.1);
    background-color: #1d4ed8;
}

.fab-btn:active {
    transform: scale(0.95);
}

/* 彈窗 (Modal) 背景 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
    animation: fadeIn 0.2s ease;
}

/* 彈窗內容區塊 */
.modal-content {
    background: white;
    padding: 25px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-title {
    margin: 0 0 20px 0;
    font-size: 1.25rem;
    color: #1f2937;
    text-align: center;
    font-weight: 700;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #4b5563;
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus {
    border-color: #2563eb;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}