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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --transition: all 0.3s ease;
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #94a3b8;
    --text-dark: #f1f5f9;
    --text-light: #cbd5e1;
    --bg-light: #0f172a;
    --bg-white: #1e293b;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "微軟正黑體", sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

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

/* Header & Navigation */
header {
    background-color: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    padding: 1rem 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
    color: white;
    padding: 3rem 0;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero .subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
}

/* Word Counter Section */
.word-counter {
    padding: 3rem 0;
}

.counter-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-bottom: 3rem;
}

.input-section textarea {
    width: 100%;
    min-height: 300px;
    padding: 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.input-section textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    background-color: #475569;
    transform: translateY(-1px);
}

/* Stats Section */
.stats-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.stats-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    font-size: 1.5rem;
}

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

.stat-item {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Features Section */
.features {
    margin-top: 3rem;
}

.features h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-dark);
}

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

.feature-item {
    text-align: center;
    padding: 2rem;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-item h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
}

.feature-item p {
    color: var(--text-light);
    line-height: 1.6;
}

/* Blog Section */
.blog-preview {
    padding: 4rem 0;
    background: var(--bg-white);
}

.blog-preview h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-dark);
}

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

.blog-card {
    padding: 2rem;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.blog-card h3 {
    margin-bottom: 1rem;
}

.blog-card h3 a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-card h3 a:hover {
    color: var(--primary-color);
}

.blog-card p {
    color: var(--text-light);
    line-height: 1.6;
}

.text-center {
    text-align: center;
}

/* SEO Content Section */
.seo-content {
    padding: 4rem 0;
    background: var(--bg-light);
}

.seo-content h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-dark);
}

.seo-content h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.seo-text {
    max-width: 900px;
    margin: 0 auto;
}

.seo-text p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    color: var(--text-dark);
    font-size: 1.0625rem;
}

.seo-text strong {
    color: var(--text-dark);
    font-weight: 600;
}

/* Footer */
footer {
    background-color: var(--text-dark);
    color: white;
    padding: 3rem 0 1rem;
}

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

.footer-section h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: white;
}

.footer-section p {
    color: #cbd5e1;
    line-height: 1.6;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #475569;
    color: #cbd5e1;
}

/* Blog Listing Page */
.blog-listing {
    padding: 3rem 0;
}

.blog-listing h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.blog-listing .subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 3rem;
    font-size: 1.125rem;
}

.blog-list {
    display: grid;
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.blog-list-item {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

.blog-list-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.blog-list-item h2 {
    margin-bottom: 1rem;
}

.blog-list-item h2 a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.blog-list-item h2 a:hover {
    color: var(--primary-color);
}

.blog-list-item p {
    color: var(--text-light);
    line-height: 1.6;
}

/* Blog Post Page */
.blog-post {
    padding: 3rem 0;
}

.blog-post article {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-white);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.blog-post h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--text-dark);
    line-height: 1.3;
}

.blog-post h2 {
    font-size: 1.875rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.blog-post h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.blog-post p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    color: var(--text-dark);
}

.blog-post ul,
.blog-post ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.blog-post li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
    color: var(--text-dark);
}

.blog-post strong {
    font-weight: 600;
}

/* About & Contact Pages */
.page-content {
    padding: 3rem 0;
}

.page-content article {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-white);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.page-content h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--text-dark);
}

.page-content h2 {
    font-size: 1.875rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.page-content p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    color: var(--text-dark);
}

.contact-info {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: var(--radius-md);
    margin-top: 2rem;
}

.contact-info p {
    margin-bottom: 0.75rem;
}

.contact-info a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.contact-info a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

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

    .hero .subtitle {
        font-size: 1rem;
    }

    .button-group {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

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

    .blog-post article,
    .page-content article {
        padding: 2rem 1.5rem;
    }
}

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

    .counter-card {
        padding: 1.5rem;
    }

    .hero h1 {
        font-size: 1.75rem;
    }

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

    .stat-value {
        font-size: 2rem;
    }

    .blog-post h1,
    .page-content h1 {
        font-size: 2rem;
    }
}

/* Print Styles */
@media print {
    header,
    footer,
    .button-group,
    .blog-preview,
    .features {
        display: none;
    }

    body {
        background: white;
    }

    .counter-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* Enhanced Navigation Styles */
.logo a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.75rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
}

.dark-mode-toggle {
    background: none;
    border: 2px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition);
}

.dark-mode-toggle:hover {
    background: var(--bg-light);
    transform: rotate(20deg);
}

/* Enhanced Hero Section */
.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    text-align: left;
}

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

.hero-stat {
    text-align: center;
}

.hero-stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
}

.hero-stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-illustration {
    max-width: 100%;
    height: auto;
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.15));
}

[data-theme="dark"] .hero-illustration rect {
    fill: #1e293b;
}

[data-theme="dark"] .hero-illustration line {
    stroke: #475569;
}

/* Keyboard Hints */
.keyboard-hint {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-left: 0.5rem;
    padding: 0.125rem 0.375rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Copy Success Animation */
@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.btn.success {
    animation: successPulse 0.3s ease;
}

/* Improved Transitions */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.counter-card,
.feature-item,
.blog-card,
.stat-item {
    transition: var(--transition);
}

/* Social Sharing Buttons */
.share-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.share-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.share-btn-facebook {
    background: #1877f2;
    color: white;
}

.share-btn-twitter {
    background: #1da1f2;
    color: white;
}

.share-btn-linkedin {
    background: #0a66c2;
    color: white;
}

.share-btn-whatsapp {
    background: #25d366;
    color: white;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Key Takeaways Box */
.key-takeaways {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: var(--radius-md);
}

[data-theme="dark"] .key-takeaways {
    background: linear-gradient(135deg, #1e3a5f 0%, #1e293b 100%);
}

.key-takeaways h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.key-takeaways ul {
    list-style: none;
    padding-left: 0;
}

.key-takeaways li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.key-takeaways li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

/* Table of Contents */
.table-of-contents {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin: 2rem 0;
}

.table-of-contents h3 {
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.table-of-contents ul {
    list-style: none;
    padding-left: 0;
}

.table-of-contents li {
    margin-bottom: 0.5rem;
}

.table-of-contents a {
    color: var(--text-dark);
    text-decoration: none;
    transition: var(--transition);
    display: block;
    padding: 0.25rem 0;
}

.table-of-contents a:hover {
    color: var(--primary-color);
    padding-left: 0.5rem;
}

/* Hong Kong Specific Styling */
.hk-highlight {
    background: linear-gradient(120deg, #ff0000 0%, #ff0000 50%, transparent 50%);
    background-size: 200% 100%;
    background-position: 100% 0;
    padding: 0.125rem 0.25rem;
    transition: background-position 0.3s ease;
}

.hk-highlight:hover {
    background-position: 0 0;
    color: white;
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-text {
        order: 2;
    }

    .hero-visual {
        order: 1;
    }

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

    .dark-mode-toggle {
        font-size: 1rem;
        padding: 0.375rem 0.5rem;
    }

    .share-buttons {
        flex-wrap: wrap;
    }

    .keyboard-hint {
        display: none;
    }
}

/* Enhanced Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-light) 0%,
        var(--border-color) 50%,
        var(--bg-light) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Accessibility Improvements */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Styles */
a:focus,
button:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

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

/* Selection Color */
::selection {
    background-color: var(--primary-color);
    color: white;
}
