/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        sans-serif;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.2rem;
    color: #000000;
}

.nav-logo img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.language-switcher {
    margin-left: 1rem;
}

.lang-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
    color: #64748b;
}

.lang-btn:hover {
    background: #e2e8f0;
    color: #2563eb;
}

.lang-text {
    display: block;
}

.nav-link {
    text-decoration: none;
    color: #64748b;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: #2563eb;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: #2563eb;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="white" opacity="0.1"/><circle cx="80" cy="40" r="1" fill="white" opacity="0.1"/><circle cx="40" cy="80" r="1" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 1;
    min-height: 80vh; /* 確保有足夠高度 */
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.highlight {
    background: linear-gradient(45deg, #ff6b6b, #ffd93d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
    align-items: center;
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: white;
    color: #2563eb;
    height: 42px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn-outline {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-outline:hover {
    background: white;
    color: #2563eb;
}

.hero-stats {
    display: flex;
    gap: 2rem;
}

.stat {
    text-align: center;
}

.stat h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.stat h3.counter {
    color: inherit;
}

.stat h3.counter.animating {
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.stat:hover h3 {
    transform: scale(1.05);
}

.stat p {
    opacity: 0.8;
    font-size: 0.9rem;
}

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%; /* 占滿容器高度 */
    min-height: 70vh; /* 最小高度確保垂直置中效果 */
}

.phone-mockup {
    width: 300px;
    height: 600px;
    background: #1f2937;
    border-radius: 40px;
    padding: 20px;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    margin: auto; /* 確保在容器中置中 */
}

.phone-screen {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 30px;
    overflow: hidden;
    position: relative;
}

.phone-screen img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.5s ease-in-out; /* 添加淡入淡出效果 */
}

/* Apps Section */
.apps-section {
    padding: 100px 0;
    background: #f8fafc;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1rem;
}

.section-header p {
    font-size: 1.1rem;
    color: #64748b;
    max-width: 600px;
    margin: 0 auto;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.app-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.app-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.app-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-info h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.app-tagline {
    color: #2563eb;
    font-weight: 500;
    margin-bottom: 1rem;
}

.app-description {
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.app-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.feature-tag {
    background: #eff6ff;
    color: #2563eb;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* App Screenshots Preview in Cards */
.app-screenshots-preview {
    margin: 1.5rem 0;
    overflow: hidden;
    border-radius: 12px;
    position: relative;
}

/* Add a subtle gradient fade on the right to indicate scrollable content */
.app-screenshots-preview::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(255, 255, 255, 0.8)
    );
    pointer-events: none;
    z-index: 1;
}

.screenshots-slider {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding: 1rem 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    scroll-behavior: smooth;
    /* Enable smooth scrolling for touch devices */
    -webkit-overflow-scrolling: touch;
    /* Add scroll snap for better UX */
    scroll-snap-type: x mandatory;
}

.screenshots-slider::-webkit-scrollbar {
    height: 6px;
}

.screenshots-slider::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.screenshots-slider::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
    transition: background 0.3s ease;
}

.screenshots-slider::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.screenshot-preview-item {
    flex: 0 0 auto;
    width: 120px;
    height: 260px; /* 保持手機截圖比例 (約 1:2.17) */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    /* Add scroll snap align */
    scroll-snap-align: start;
}

.screenshot-preview-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.screenshot-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 改為 contain 以保持完整圖片 */
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
    background: #f8fafc; /* 添加背景色填充空白部分 */
}

.screenshot-preview-item:hover img {
    transform: scale(1.05);
}

.no-screenshots-preview {
    color: #94a3b8;
    font-size: 0.9rem;
    text-align: center;
    padding: 2rem 1rem;
    font-style: italic;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px dashed #e2e8f0;
}

.app-actions {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    gap: 1rem;
}

.btn-download img {
    width: auto;
}

.btn-preview {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    height: 42px;
}

.btn-preview:hover {
    background: #e2e8f0;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    color: #64748b;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.close:hover {
    color: #ef4444;
}

/* App Detail Modal Content */
.app-detail-header {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    border-bottom: 1px solid #e2e8f0;
}

.app-detail-icon {
    flex-shrink: 0;
}

.app-detail-icon img {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.app-detail-info h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1rem;
}

.app-detail-description {
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.app-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.stat-label {
    display: block;
    color: #64748b;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-weight: 600;
    color: #1e293b;
}

.app-detail-content {
    padding: 2rem;
}

.app-features-section,
.app-screenshots-section {
    margin-bottom: 2rem;
    position: relative;
}

/* Add a subtle gradient fade on the right for modal screenshots */
.app-screenshots-section::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50px; /* 調整位置避開標題 */
    bottom: 0;
    width: 40px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(255, 255, 255, 0.9)
    );
    pointer-events: none;
    z-index: 1;
}

.app-features-section h3,
.app-screenshots-section h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
}

.features-list {
    list-style: none;
    padding: 0;
}

.features-list li {
    padding: 0.5rem 0;
    color: #64748b;
    position: relative;
    padding-left: 1.5rem;
}

.features-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #22c55e;
    font-weight: bold;
}

.screenshots-gallery {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 0;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}

.screenshots-gallery::-webkit-scrollbar {
    height: 8px;
}

.screenshots-gallery::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.screenshots-gallery::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.screenshots-gallery::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.screenshot-item {
    flex: 0 0 auto;
    width: 200px; /* 固定寬度 */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    scroll-snap-align: start;
}

.screenshot-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.screenshot-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain; /* 保持圖片比例 */
    max-height: 400px; /* 限制最大高度 */
}

.no-screenshots {
    text-align: center;
    padding: 2rem;
    color: #64748b;
    grid-column: 1 / -1;
}

.no-screenshots p {
    font-style: italic;
}

/* About Section */
.about-section {
    padding: 100px 0;
    background: white;
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-text h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1.5rem;
}

.about-text p {
    color: #64748b;
    margin-bottom: 1.5rem;
    line-height: 1.7;
    font-size: 1.1rem;
}

.about-features {
    margin-top: 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    text-align: center;
}

.feature {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.feature:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.feature h4 {
    color: #1e293b;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.feature p {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

.feature p {
    color: #64748b;
    font-size: 0.95rem;
}

.about-image img {
    width: 100%;
    height: auto;
}

/* Contact Section */
.contact-section {
    padding: 100px 0;
    background: #1e293b;
    color: white;
    text-align: center;
}

.contact-section h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.contact-section > p {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-bottom: 3rem;
}

.contact-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.contact-item h4 {
    margin-bottom: 1rem;
    color: #60a5fa;
}

.contact-item a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-item a:hover {
    color: #60a5fa;
}

.social-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Footer */
.footer {
    background: #0f172a;
    color: white;
    padding: 60px 0 20px;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-brand img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.footer-brand p {
    opacity: 0.7;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
}

.link-group h4 {
    margin-bottom: 1rem;
    color: #60a5fa;
}

.link-group a {
    display: block;
    color: #94a3b8;
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.link-group a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid #334155;
    padding-top: 2rem;
    text-align: center;
    opacity: 0.7;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 2rem 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .language-switcher {
        margin: 1rem 0 0 0;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .nav-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
        min-height: 90vh; /* 手機版本也要有足夠高度 */
        padding: 40px 20px; /* 增加上下padding */
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-cta {
        justify-content: center;
        flex-wrap: wrap;
    }

    .hero-stats {
        justify-content: center;
    }

    .phone-mockup {
        width: 250px;
        height: 500px;
        margin: 20px auto; /* 確保垂直和水平置中 */
    }

    .apps-grid {
        grid-template-columns: 1fr;
    }

    .about-content {
        padding: 0 20px;
    }

    .about-features {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-top: 2rem;
    }

    .feature {
        padding: 1.2rem;
    }

    .contact-info {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .app-actions {
        flex-direction: column;
    }

    .screenshot-preview-item {
        width: 100px; /* 手機版稍小一些 */
        height: 217px; /* 保持正確比例 (100 * 2.17) */
    }

    .screenshots-slider {
        gap: 0.8rem;
        padding: 0.8rem 0;
    }

    .app-screenshots-preview {
        margin: 1rem 0;
    }

    /* Modal screenshots responsive */
    .screenshot-item {
        width: 150px; /* 手機版稍小 */
    }

    .screenshots-gallery {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .app-card {
        padding: 1.5rem;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* Hover effects */
.app-card {
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(37, 99, 235, 0.1),
        transparent
    );
    transition: left 0.5s;
}

.app-card:hover::before {
    left: 100%;
}
