/* Custom Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInFromRight {
    from { opacity: 0; transform: translateX(2.5rem); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInFromTop {
    from { opacity: 0; transform: translateY(-0.25rem); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Animation Classes */
.animate-fade-in { animation: fadeIn 0.5s ease-out forwards; }
.animate-fade-slide-in { animation: slideInFromBottom 0.7s ease-out forwards; } /* Note: slideInFromBottom not defined in old CSS, using fade-in as fallback if needed */
.animate-slide-in-right { animation: slideInFromRight 0.5s ease-out forwards; }
.animate-slide-in { animation: slideInFromTop 0.3s ease-out forwards; }
.animate-zoom-in { animation: zoomIn 1s ease-out forwards; }
.animate-spin { animation: spin 1s linear infinite; }

/* Line Clamp Utilities */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Prose-like styling for generated content */
.prose-content {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.25rem; /* 調整回舊版大小 */
    line-height: 1.75;
    color: #334155; /* slate-700 */
}

/* Hidden utility */
.hidden { display: none !important; }
.d-none { display: none !important; }

:root {
    --knsh-teal: #2bb8ad;
    --knsh-teal-dark: #16998f;
    --knsh-ink: #163047;
    --knsh-surface: rgba(255, 255, 255, 0.92);
    --knsh-border: rgba(176, 216, 223, 0.9);
    --knsh-footer: #20b2ac;
}

html,
body.knsh-page {
    min-height: 100%;
}

body.knsh-page {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: #1e293b;
    background-color: #eff8f7;
    background-image:
        linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.9)),
        url('background.png');
    background-position: center top;
    background-repeat: no-repeat;
    background-size: cover;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.knsh-header-surface {
    min-height: 72px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.06)),
        url('menu_bg.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    box-shadow: 0 10px 24px rgba(22, 48, 71, 0.08);
}

.page-container {
    position: relative;
    z-index: 1;
    flex: 1 0 auto;
    width: 100%;
}

.hero-banner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 0 0.75rem;
}

.hero-banner-image {
    display: block;
    width: min(100%, 1240px);
    height: auto;
    filter: drop-shadow(0 10px 18px rgba(22, 48, 71, 0.08));
}

.site-footer {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-top: auto;
    padding: 1rem 1.5rem;
    background: var(--knsh-footer);
    color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 -8px 24px rgba(22, 48, 71, 0.08);
}

.site-footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1rem;
    font-size: 0.95rem;
}

.site-footer-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.site-footer-link {
    color: #ffffff;
    text-decoration: none;
}

.site-footer-link:hover {
    text-decoration: underline;
}

.site-footer-divider {
    opacity: 0.8;
}

.site-footer-disclaimer {
    max-width: 1280px;
    margin: 0 auto 0.5rem;
    font-size: 0.75rem;
    opacity: 0.7;
    text-align: center;
}

/* Card hover effects (舊版) */
.news-card { transition: all 0.3s ease; }
.news-card:hover { box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25); }
.news-card .thumbnail { transition: background-color 0.3s ease; }
.news-card:hover .thumbnail { background-color: #e2e8f0; }

/* Button disabled state */
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Generate button hover state (舊版) */
.generate-btn:hover .icon-container { background-color: rgba(255, 255, 255, 0.2); }

/* Focus styles */
button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .text-6xl { font-size: 2.5rem; }
    .text-4xl { font-size: 1.75rem; }
    .p-12 { padding: 2rem; }
    .rounded-\[3rem\], .rounded-\[2\.5rem\] { border-radius: 2rem; }
}

/* 生成內容樣式（淺色版） */
.gen-light {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid #e2e8f0;
}

.gen-light #genResultBody h3 {
    color: #0f172a;
    font-size: 1.5rem;
    font-weight: 900;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-left: 4px solid #6366f1;
    padding-left: 1rem;
}

.gen-light #genResultBody p {
    color: #334155;
    margin-bottom: 1rem;
    line-height: 1.8;
}

.gen-light #genResultBody ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    color: #334155;
    margin-bottom: 1.5rem;
}

.gen-light #genResultBody li {
    margin-bottom: 0.5rem;
}

.gen-light #genResultBody strong {
    color: #0f172a;
    font-weight: 800;
}

/* 針對劇本角色的特殊顏色 */
.gen-light #genResultBody .text-indigo-600 { color: #4f46e5 !important; }
.gen-light #genResultBody .text-emerald-600 { color: #059669 !important; }

/* 針對閱讀測驗的卡片背景覆蓋 */
.gen-light #genResultBody .bg-slate-50 {
    background-color: #f8fafc !important;
    border-color: #e2e8f0 !important;
}

/* 針對閱讀測驗的解析區塊 */
.gen-light #genResultBody .bg-white {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #475569 !important;
}

/* Tab Active State Glow */
.gen-tab.active {
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

/* ===== NAV HEADER ===== */
/* .knsh-navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 24px;
    gap: 12px;
} */
.knsh-navbar {
  align-items: center;
  padding: 10px 18px;
  position: relative;
  overflow: visible;
  z-index: 1000;
}
.logo-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.navLogo {
    height: 38px;
    width: auto;
    display: block;
}

.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
}

.user-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
}

.user-name {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
}

.user-account {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
}

.navbar_user_hover {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(6px);
}

#user {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    padding: 6px;
    cursor: pointer;
}

.btn-login {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.btn-logout:hover {
    color: #f87171;
    background: rgba(248, 113, 113, 0.12);
    transform: translateY(-1px);
}

.btn-logout .logout-tip {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translate(-50%, -4px);
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    background: #f87171;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}

.btn-logout:hover .logout-tip {
    opacity: 1;
    transform: translate(-50%, 0);
}

.btn-logout .logout-tip::after {
    content: "";
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 5px solid #f87171;
}

.btn-login:hover {
    background: rgba(255, 255, 255, 0.28);
    border-color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(22, 48, 71, 0.16);
}

.login-avatar {
    width: 20px;
    height: 20px;
    border-radius: 999px;
}

.nav-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.knsh-nav-menu {
    position: absolute;
    right: 16px;
    top: 64px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(176, 216, 223, 0.9);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
    padding: 8px;
    min-width: 160px;
    display: none;
}

.knsh-nav-menu.show {
    display: block;
}

.menu-item {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 600;
    color: var(--knsh-ink);
    cursor: pointer;
}

.menu-item:hover {
    background: #f1f5f9;
}

/* RWD */
@media (max-width: 768px) {
    .hero-banner {
        padding-top: 0;
    }

    .hero-banner-image {
        width: min(100%, 960px);
    }

    .knsh-navbar {
        padding: 10px 16px;
    }
    .navLogo {
        height: 34px;
    }
    .btn-login {
        padding: 8px 14px;
        font-size: 13px;
    }
}

@media (max-width: 640px) {
    body.knsh-page {
        background-size: auto 100%, cover;
    }

    .nav-menu-toggle {
        display: inline-flex;
    }
    .knsh-nav-menu {
        top: 56px;
    }
    .user-text {
        align-items: flex-start;
    }
    .btn-login {
        padding: 8px 12px;
        font-size: 12px;
    }
    .navbar_user_hover {
        width: 34px;
        height: 34px;
    }
    .site-footer {
        padding: 0.9rem 1rem;
    }
    .site-footer-inner {
        flex-direction: column;
        text-align: center;
        font-size: 0.875rem;
    }
    .site-footer-links {
        gap: 0.5rem;
    }
}
