/* App 整體樣式 - 底部導航和頁面結構 */

/* App 容器 */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8fafb;
}

/* 主內容區域 */
.app-content {
    flex: 1;
    padding-bottom: 70px; /* 為底部導航留空間 */
    overflow-y: auto;
}

/* Tab 頁面 */
.tab-page {
    display: none;
    min-height: calc(100vh - 70px);
}

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

/* ========== 底部導航列 ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 0;
    text-decoration: none;
    color: #999;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: none;
}

.nav-item:hover {
    color: #5f7a73;
}

.nav-item.active {
    color: #5f7a73;
}

.nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.nav-label {
    font-size: 11px;
}

/* ========== 封面頁 ========== */
.cover-page {
    background: linear-gradient(180deg, #f9f7f4 0%, #ffffff 100%);
    padding: 0;
}

.cover-header {
    text-align: center;
    padding: 60px 20px 40px;
    background: linear-gradient(180deg, #5f7a73 0%, #4a635d 100%);
    border-radius: 0 0 40px 40px;
    margin-bottom: 30px;
}

.brand-logo {
    width: 90px;
    height: 90px;
    margin: 0 auto 25px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.brand-logo svg {
    width: 50px;
    height: 50px;
    fill: white;
}

.cover-title {
    font-size: 30px;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.cover-subtitle {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.7;
}

/* 開始檢測按鈕 */
.start-btn-wrapper {
    padding: 0 30px 30px;
    margin-top: -25px;
}

.start-analysis-btn {
    width: 100%;
    padding: 20px 30px;
    background: linear-gradient(135deg, #c9ba96 0%, #b8a882 100%);
    border: none;
    border-radius: 16px;
    color: #3d3d3d;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 25px rgba(201, 186, 150, 0.4);
    transition: all 0.3s;
}

.start-analysis-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(201, 186, 150, 0.5);
}

.start-analysis-btn:active {
    transform: translateY(0);
}

.start-analysis-btn svg {
    width: 22px;
    height: 22px;
    fill: #3d3d3d;
}

/* 快捷入口 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 0 20px 30px;
}

.quick-action-card {
    background: white;
    border-radius: 16px;
    padding: 20px 12px;
    text-align: center;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #f0f0f0;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    border-color: #c9ba96;
}

.quick-action-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    background: linear-gradient(135deg, #f5f3ef 0%, #ebe7df 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-action-icon svg {
    width: 22px;
    height: 22px;
    fill: #5f7a73;
}

.quick-action-label {
    font-size: 12px;
    color: #333;
    font-weight: 500;
}

/* 最新文章區塊 */
.latest-articles {
    padding: 0 20px 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.section-more {
    font-size: 13px;
    color: #5f7a73;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}

.article-preview-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #f0f0f0;
}

.article-preview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.article-preview-image {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #f7f5f0 0%, #e0f2fe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-preview-image svg {
    width: 50px;
    height: 50px;
    fill: #5f7a73;
    opacity: 0.5;
}

.article-preview-content {
    padding: 15px;
}

.article-preview-tag {
    display: inline-block;
    padding: 4px 10px;
    background: #f7f5f0;
    color: #5f7a73;
    font-size: 11px;
    font-weight: 500;
    border-radius: 10px;
    margin-bottom: 8px;
}

.article-preview-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    margin-bottom: 5px;
}

.article-preview-desc {
    font-size: 12px;
    color: #888;
    line-height: 1.5;
}

/* ========== 肌膚小教室頁面 ========== */
.education-page {
    background: #f8fafb;
}

.education-header {
    background: white;
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.education-header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.education-header p {
    font-size: 13px;
    color: #888;
}

/* 分類標籤 */
.category-tabs {
    display: flex;
    gap: 8px;
    padding: 15px 20px;
    overflow-x: auto;
    background: white;
    -webkit-overflow-scrolling: touch;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.category-tab {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    background: #f5f5f5;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.category-tab.active {
    background: linear-gradient(135deg, #5f7a73 0%, #4a635d 100%);
    color: white;
}

/* 影片區塊 */
.video-section {
    padding: 20px;
}

.video-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.video-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 15px;
}

.video-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 */
    background: #000;
}

.video-thumbnail iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-btn {
    width: 60px;
    height: 60px;
    background: rgba(45, 212, 191, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
    margin-left: 4px;
}

.video-info {
    padding: 15px;
}

.video-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.video-duration {
    font-size: 12px;
    color: #888;
}

/* Instagram 影片區塊 */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ig-follow-btn {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.ig-follow-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(225, 48, 108, 0.4);
}

.ig-videos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.ig-video-card {
    display: block;
    text-decoration: none;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.2s;
}

.ig-video-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.ig-video-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 正方形 */
    background: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
}

.ig-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.ig-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
}

.ig-video-info {
    padding: 10px;
}

.ig-username {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #e1306c;
    margin-bottom: 3px;
}

.ig-caption {
    display: block;
    font-size: 12px;
    color: #333;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .ig-videos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ig-follow-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* 文章列表 */
.articles-section {
    padding: 0 20px 30px;
}

.articles-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.article-card {
    display: flex;
    gap: 15px;
    background: white;
    border-radius: 14px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    transition: all 0.2s;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.article-thumb {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f7f5f0 0%, #ebe7df 100%);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.article-thumb svg {
    width: 30px;
    height: 30px;
    fill: #5f7a73;
    opacity: 0.6;
}

.article-content {
    flex: 1;
    min-width: 0;
}

.article-tag {
    display: inline-block;
    padding: 3px 8px;
    background: #f7f5f0;
    color: #5f7a73;
    font-size: 10px;
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 6px;
}

.article-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-meta {
    font-size: 11px;
    color: #999;
}

/* ========== 諮詢頁面 ========== */
.consult-page {
    background: linear-gradient(180deg, #f7f5f0 0%, #ffffff 30%);
    padding: 30px 20px;
    text-align: center;
}

.consult-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 25px;
    background: linear-gradient(135deg, #06c755 0%, #00b900 100%);
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(6, 199, 85, 0.3);
}

.consult-icon svg {
    width: 55px;
    height: 55px;
    fill: white;
}

.consult-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.consult-subtitle {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 30px;
}

.line-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 40px;
    background: linear-gradient(135deg, #06c755 0%, #00b900 100%);
    border: none;
    border-radius: 30px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 6px 25px rgba(6, 199, 85, 0.35);
    transition: all 0.3s;
}

.line-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 35px rgba(6, 199, 85, 0.45);
}

.line-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
}

/* FAQ 區塊 */
.faq-section {
    margin-top: 40px;
    text-align: left;
}

.faq-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.faq-item {
    background: white;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.faq-question {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.faq-question::before {
    content: 'Q';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #5f7a73;
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 5px;
    flex-shrink: 0;
}

.faq-answer {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    padding-left: 28px;
}

/* ========== 個人中心頁面 ========== */
.profile-page {
    background: #f8fafb;
}

.profile-header {
    background: linear-gradient(135deg, #5f7a73 0%, #4a635d 100%);
    padding: 40px 20px 30px;
    text-align: center;
    color: white;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar svg {
    width: 40px;
    height: 40px;
    fill: white;
}

.profile-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
}

.profile-status {
    font-size: 13px;
    opacity: 0.9;
}

.login-prompt-btn {
    display: inline-block;
    margin-top: 15px;
    padding: 14px 30px;
    background: linear-gradient(135deg, #c9ba96 0%, #b8a882 100%);
    color: #3d3d3d;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(201, 186, 150, 0.4);
}

.login-prompt-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 186, 150, 0.5);
}

/* 功能選單 */
.profile-menu {
    padding: 20px;
}

.menu-section {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 18px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

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

.menu-item:hover {
    background: #fafafa;
}

.menu-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #f7f5f0 0%, #ebe7df 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-icon svg {
    width: 18px;
    height: 18px;
    fill: #5f7a73;
}

.menu-icon.pink {
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
}

.menu-icon.pink svg {
    fill: #f472b6;
}

.menu-text {
    flex: 1;
}

.menu-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.menu-subtitle {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.menu-arrow {
    color: #ccc;
    font-size: 18px;
}

/* 歷史紀錄卡片 */
.history-section {
    padding: 0 20px 30px;
}

.history-section h2 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    background: white;
    border-radius: 16px;
    color: #999;
}

.history-empty svg {
    width: 50px;
    height: 50px;
    fill: #ddd;
    margin-bottom: 15px;
}

.history-empty p {
    font-size: 14px;
}

.history-card {
    background: white;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.history-score {
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, #f7f5f0 0%, #ebe7df 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #5f7a73;
}

.history-info {
    flex: 1;
}

.history-date {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.history-concerns {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.history-concern-tag {
    padding: 3px 8px;
    background: #f5f5f5;
    color: #666;
    font-size: 11px;
    border-radius: 8px;
}

/* ========== 響應式調整 ========== */
@media (max-width: 480px) {
    .cover-header {
        padding: 40px 20px 25px;
    }

    .cover-title {
        font-size: 24px;
    }

    .quick-actions {
        gap: 10px;
    }

    .quick-action-card {
        padding: 15px 10px;
    }

    .bottom-nav {
        height: 65px;
    }

    .app-content {
        padding-bottom: 65px;
    }

    .nav-icon svg {
        width: 22px;
        height: 22px;
    }
}

/* iOS 安全區域 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(70px + env(safe-area-inset-bottom));
    }

    .app-content {
        padding-bottom: calc(70px + env(safe-area-inset-bottom));
    }
}

/* ========== 登入提示彈窗 ========== */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-modal.active {
    display: flex;
}

.login-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.login-modal-content {
    position: relative;
    background: white;
    border-radius: 24px;
    padding: 40px 30px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalSlideUp 0.3s ease;
}

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

.login-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.login-modal-close:hover {
    background: #eee;
}

.login-modal-close svg {
    color: #666;
}

.login-modal-icon {
    margin-bottom: 20px;
}

.login-modal-title {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    margin-bottom: 10px;
}

.login-modal-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 30px;
}

.login-modal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.login-modal-btn:last-child {
    margin-bottom: 0;
}

.login-modal-btn.primary {
    background: linear-gradient(135deg, #5f7a73 0%, #4a635d 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(95, 122, 115, 0.35);
}

.login-modal-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(95, 122, 115, 0.45);
}

.login-modal-btn.secondary {
    background: #f5f5f5;
    color: #333;
}

.login-modal-btn.secondary:hover {
    background: #eee;
}

.login-modal-note {
    font-size: 13px;
    color: #888;
    margin-top: 5px;
}

.login-modal-note a {
    color: #5f7a73;
    font-weight: 600;
    text-decoration: none;
}

.login-modal-note a:hover {
    text-decoration: underline;
}
