/* BNI 組聚報名系統 - 樣式 */

:root {
    --primary: #c41230;      /* BNI 紅 */
    --primary-dark: #9e0f27;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-500: #6c757d;
    --gray-800: #343a40;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

/* Card */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}

.card h1, .card h2 {
    color: var(--primary);
    margin-bottom: 16px;
}

.card h1 { font-size: 1.5rem; }
.card h2 { font-size: 1.25rem; }

/* 活動資訊 */
.event-header {
    border-bottom: 2px solid var(--primary);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.event-title {
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.event-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--gray-500);
}

.event-meta-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.event-meta-item .icon {
    width: 20px;
    text-align: center;
}

.event-note {
    background: var(--gray-100);
    padding: 12px;
    border-radius: var(--radius);
    margin-top: 12px;
    font-style: italic;
}

/* 表單 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--gray-800);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 16px;
    transition: border-color 0.2s;
    -webkit-appearance: menulist;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* 狀態按鈕 */
.status-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.status-btn {
    padding: 16px 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.status-btn:hover {
    border-color: var(--gray-500);
}

.status-btn.selected {
    color: var(--white);
}

.status-btn.yes.selected {
    background: var(--success);
    border-color: var(--success);
}

.status-btn.no.selected {
    background: var(--danger);
    border-color: var(--danger);
}

.status-btn.maybe.selected {
    background: var(--warning);
    border-color: var(--warning);
    color: var(--gray-800);
}

/* 按鈕 */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    background: var(--gray-500);
    cursor: not-allowed;
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--gray-200);
    color: var(--gray-800);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--gray-500);
    color: var(--white);
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 14px;
}

.btn-text:hover {
    text-decoration: underline;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.badge.yes {
    background: #d4edda;
    color: #155724;
}

.badge.no {
    background: #f8d7da;
    color: #721c24;
}

.badge.maybe {
    background: #fff3cd;
    color: #856404;
}

.rsvp-summary {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

/* 報名列表 */
.rsvp-group {
    margin-bottom: 12px;
}

.rsvp-group-title {
    font-weight: 600;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--gray-200);
}

.rsvp-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}

.rsvp-item:last-child {
    border-bottom: none;
}

.rsvp-name {
    font-weight: 500;
}

.rsvp-note {
    color: var(--gray-500);
    font-size: 14px;
}

/* Loading & Error */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: var(--radius);
    margin-top: 12px;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: var(--radius);
    margin-top: 12px;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: var(--gray-500);
}

footer a {
    color: var(--gray-500);
    text-decoration: none;
}

footer a:hover {
    color: var(--primary);
}

/* ===== Admin 後台 ===== */

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 2px solid var(--primary);
    margin-bottom: 16px;
}

.admin-header h1 {
    color: var(--primary);
    font-size: 1.25rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: var(--white);
    color: var(--gray-500);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover {
    background: var(--gray-100);
}

.tab.active {
    background: var(--primary);
    color: var(--white);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h2 {
    margin: 0;
    color: var(--gray-800);
}

.section-header .btn-primary {
    width: auto;
    padding: 10px 16px;
    font-size: 14px;
}

/* List */
.list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.list-item-meta {
    font-size: 14px;
    color: var(--gray-500);
}

.list-item-actions {
    display: flex;
    gap: 8px;
}

.list-item-actions button {
    padding: 6px 12px;
    font-size: 13px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    margin: 0;
    color: var(--primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-500);
    cursor: pointer;
}

.modal-content form {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
}

.modal-footer .btn-primary {
    width: auto;
}

/* Calendar */
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

#current-month {
    font-weight: 600;
    font-size: 1.1rem;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px;
}

.calendar-header {
    text-align: center;
    font-weight: 600;
    padding: 8px 4px;
    color: var(--gray-500);
    font-size: 12px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 4px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.calendar-day:hover {
    background: var(--gray-100);
}

.calendar-day.other-month {
    color: var(--gray-500);
    opacity: 0.5;
}

.calendar-day.today {
    background: var(--primary);
    color: var(--white);
}

.calendar-day.has-event {
    background: #fce4ec;
}

.calendar-day.has-event.today {
    background: var(--primary);
}

.event-dot {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    margin-top: 2px;
}

.calendar-day.today .event-dot {
    background: var(--white);
}

/* Login */
.login-card {
    max-width: 320px;
    margin: 100px auto;
}

.login-card h1 {
    text-align: center;
}

/* 響應式 */
@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .status-buttons {
        grid-template-columns: 1fr;
    }

    .list-item {
        flex-direction: column;
        gap: 12px;
    }

    .list-item-actions {
        width: 100%;
    }

    .list-item-actions button {
        flex: 1;
    }
}
