/* ═══════════════════════════════════════════
   components.css — 共用 UI 元件
   ═══════════════════════════════════════════ */

/* ── Buttons ── */
.analyze-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    transition: all .2s;
}

.analyze-btn:hover {
    background: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(176, 141, 87, .3);
}

.analyze-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ── Modal (upgrade/generic) ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: var(--radius);
    padding: 32px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .15);
}

.modal h3 {
    margin-bottom: 12px;
}

.modal p {
    color: var(--text-dim);
    margin-bottom: 20px;
    font-size: 14px;
}

.modal-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    border: none;
}

.modal-btn.primary {
    background: var(--primary);
    color: #fff;
}

.modal-btn.secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

/* ── Login Modal ── */
.login-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.login-modal.show {
    display: flex;
}

.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 40px 32px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .15);
}

.login-box h2 {
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--primary-dark);
}

.login-box p {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 24px;
}

.login-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    font-family: inherit;
    font-weight: 600;
    transition: all .2s;
}

.login-google-btn:hover {
    border-color: var(--primary);
    background: #faf8f5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

.login-google-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.login-google-btn img {
    width: 20px;
    height: 20px;
}

.login-close {
    margin-top: 16px;
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

.login-close:hover {
    color: var(--text);
}

/* ── User menu (header) ── */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-light);
    cursor: pointer;
}

.user-name {
    font-size: 13px;
    color: var(--primary-dark);
    font-weight: 600;
    cursor: pointer;
}

.user-menu {
    position: relative;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 40px;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 0;
    min-width: 180px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
    z-index: 200;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a,
.user-dropdown button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: var(--surface);
}

/* ── Role badges ── */
.user-role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

.role-free {
    background: #f0ece6;
    color: var(--text-dim);
}

.role-premium {
    background: linear-gradient(135deg, #d4b87c, #b08d57);
    color: #fff;
}

.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.role-OWNER {
    background: #e8d5b7;
    color: #6b4e2a;
}

.role-TRAINER {
    background: #d5e8d5;
    color: #2a6b3e;
}

.role-USER_PREMIUM {
    background: #d5d5e8;
    color: #3e2a6b;
}

.role-USER_STUDENT {
    background: #d5d5e8;
    color: #3e2a6b;
}

.role-USER_TEACHER {
    background: #e0d5f0;
    color: #4a2a6b;
}

.role-USER_FREE {
    background: #f0ece6;
    color: var(--text-dim);
}

/* ── Payment plan cards ── */
.payment-plan-card {
    flex: 1;
    min-width: 200px;
    max-width: 220px;
    padding: 20px 16px;
    border: 2px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all .25s ease;
    text-align: center;
    background: #fff;
}

.payment-plan-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(176, 141, 87, .18);
}

.payment-plan-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, #faf8f4, #f5f0e6);
    box-shadow: 0 4px 16px rgba(176, 141, 87, .2);
}

.payment-plan-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.payment-plan-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.payment-plan-price {
    font-size: 28px;
    font-weight: 900;
    color: var(--primary-dark);
    margin-bottom: 12px;
}

.payment-plan-price span {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-dim);
}

.payment-plan-features {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
    font-size: 13px;
    line-height: 1.9;
    color: var(--text-dim);
}

/* ── Toast notification ── */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    opacity: 0;
    transition: opacity .3s;
    z-index: 9999;
}

.toast.show {
    opacity: 1;
}

.toast.success {
    background: var(--green);
}

.toast.error {
    background: var(--red);
}

/* ── Form elements (admin/trainer) ── */
.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-body {
    margin-bottom: 24px;
}

.btn {
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    border: none;
}

.btn-cancel {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-submit {
    background: var(--primary);
    color: #fff;
}

.btn-submit:hover {
    background: var(--primary-dark);
}

.btn-add {
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
}

.btn-add:hover {
    background: var(--primary-dark);
}

/* ── 阿卡學院 footer CTA ── */
.aka-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 24px 20px;
    text-align: center;
}

.aka-footer-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 14px;
}

.aka-footer-btns {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.aka-footer-btns a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all .2s;
}

.aka-footer-btns a:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
    transform: translateY(-1px);
}

/* ── Hamburger Menu ── */
.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text);
    line-height: 1;
}

@media (max-width: 768px) {
    .hamburger {
        display: block;
    }

    .header .header-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        padding: 8px 16px;
        flex-direction: column;
        gap: 4px;
        z-index: 100;
    }

    .header .header-nav.open {
        display: flex;
    }

    .header-nav .btn-nav {
        display: block;
        text-align: center;
        padding: 10px 16px;
        border-radius: 6px;
    }

    .header {
        position: relative;
    }
}