* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, 'Microsoft JhengHei', 微軟正黑體, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 2rem 1rem;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

/* Main Menu Styles */
.main-menu {
    background-color: #34495e;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: nowrap;
}

.main-menu-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 2.5rem 3rem;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    min-width: 200px;
}

.main-menu-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.main-menu-btn.active {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.main-menu-btn:nth-child(1) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.main-menu-btn:nth-child(2) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.main-menu-btn:nth-child(3) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.menu-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.menu-title {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
}

.menu-subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Material Days Navigation (Hidden by default) */
.weekday-nav {
    background-color: #34495e;
    padding: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.day-btn {
    background-color: #ecf0f1;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    text-align: center;
    line-height: 1.4;
}

.day-btn:hover {
    background-color: #3498db;
    color: white;
    transform: translateY(-2px);
}

.day-btn.active {
    background-color: #e74c3c;
    color: white;
}

.date-label {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.9;
    margin-top: 0.2rem;
    display: inline-block;
}

/* Worksheet buttons - distinct styling */
.worksheet-btn {
    background-color: #e8f5e9;
    border: 2px solid #4caf50;
}

.worksheet-btn:hover {
    background-color: #4caf50;
    color: white;
}

.worksheet-btn.active {
    background-color: #2e7d32;
    color: white;
}

.worksheet-btn .date-label {
    color: #2e7d32;
    font-size: 0.75rem;
}

.worksheet-btn:hover .date-label,
.worksheet-btn.active .date-label {
    color: white;
}

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

#search-input {
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    font-size: 1rem;
    border: 2px solid #34495e;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.3s ease;
    font-family: 'Segoe UI', Tahoma, 'Microsoft JhengHei', 微軟正黑體, sans-serif;
}

#search-input:focus {
    border-color: #3498db;
}

#clear-search {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: none;
    font-size: 1.2rem;
    line-height: 1;
    transition: background-color 0.3s ease;
}

#clear-search:hover {
    background-color: #c0392b;
}

.vocab-day-label {
    background-color: #3498db;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: inline-block;
}

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

.day-section {
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.day-title {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    border-bottom: 3px solid #e74c3c;
    padding-bottom: 0.5rem;
}

.whiteboard-photo {
    width: 100%;
    max-width: 800px;
    margin: 1.5rem auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.whiteboard-container {
    text-align: center;
    margin: 1.5rem 0;
}

.whiteboard-container h3 {
    color: #34495e;
    margin-bottom: 1rem;
}

.vocabulary-section {
    margin-top: 2rem;
}

.vocabulary-section h3 {
    font-size: 1.4rem;
    color: #34495e;
    margin-bottom: 1.5rem;
}

.vocab-item {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.vocab-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.vocab-table th,
.vocab-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.vocab-table th {
    background-color: #34495e;
    color: white;
    font-weight: 600;
}

.vocab-table td {
    background-color: white;
}

.hanzi-cell {
    font-size: 2.5rem;
    font-weight: bold;
    color: #e74c3c;
}

.stroke-animation {
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.hanzi-writer-container {
    display: inline-block;
}

.pinyin-cell {
    font-size: 1.1rem;
}

.pinyin {
    display: block;
    color: #3498db;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.zhuyin {
    display: block;
    color: #27ae60;
    font-size: 1.2rem;
    font-weight: 600;
}

footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
}

/* Whiteboard toggle button styles */
.whiteboard-toggle-section {
    margin: 1.5rem 0;
}

.toggle-whiteboard-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto 1rem auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.toggle-whiteboard-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.toggle-whiteboard-btn:active {
    transform: translateY(0);
}

.toggle-icon {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

/* Lazy loading styles */
img.lazy-load {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img.loaded {
    opacity: 1;
}

/* Smooth animation for whiteboard container */
.whiteboard-container {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .weekday-nav {
        flex-direction: column;
    }

    .day-btn {
        width: 100%;
    }

    .toggle-whiteboard-btn {
        width: 100%;
        justify-content: center;
    }

    .vocab-item {
        padding: 1rem;
    }

    /* Hide table, use card layout on mobile */
    .vocab-table {
        display: block;
        border: none;
    }

    .vocab-table thead {
        display: none;
    }

    .vocab-table tbody {
        display: block;
    }

    .vocab-table tr {
        display: block;
        margin-bottom: 0;
    }

    .vocab-table td {
        display: block;
        text-align: left;
        padding: 0.75rem 0;
        border: none;
        border-bottom: 1px solid #eee;
    }

    .vocab-table td:last-child {
        border-bottom: none;
    }

    /* Add labels before each data on mobile */
    .vocab-table td:before {
        content: attr(data-label);
        font-weight: bold;
        color: #34495e;
        display: block;
        margin-bottom: 0.3rem;
        font-size: 0.85rem;
    }

    .vocab-table td:first-child:before {
        content: "Bahasa Indonesia:";
    }

    .vocab-table td:nth-child(2):before {
        content: "漢字 (Hanzi):";
    }

    .vocab-table td:nth-child(3):before {
        content: "拼音 / 注音:";
    }

    .vocab-table td:nth-child(4):before {
        content: "Urutan Goresan:";
    }

    .hanzi-cell {
        font-size: 2.5rem;
        padding: 1rem 0;
    }

    .stroke-animation {
        min-height: 150px;
        justify-content: flex-start;
        padding: 1rem 0;
    }

    .pinyin-cell {
        font-size: 1rem;
    }

    .pinyin {
        font-size: 1rem;
        display: block;
        margin-bottom: 0.5rem;
    }

    .zhuyin {
        font-size: 1.2rem;
        display: block;
    }

    .main-menu {
        gap: 0.5rem;
        padding: 1rem 0.5rem;
    }

    .main-menu-btn {
        padding: 1rem 0.8rem;
        min-width: auto;
        flex: 1;
        max-width: 120px;
    }

    .menu-icon {
        font-size: 2rem;
        margin-bottom: 0.3rem;
    }

    .menu-title {
        font-size: 1rem;
        margin-bottom: 0.2rem;
    }

    .menu-subtitle {
        font-size: 0.75rem;
    }
}

/* Welcome Screen Styles */
.welcome-screen {
    max-width: 800px;
    margin: 3rem auto;
    padding: 2rem;
}

.welcome-content {
    background: white;
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.welcome-title {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.welcome-subtitle {
    font-size: 1.2rem;
    color: #7f8c8d;
    margin-bottom: 2rem;
}

.welcome-instructions {
    text-align: left;
    margin: 2rem 0;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.instruction-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.instruction-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.instruction-item p {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.8;
}

.welcome-footer {
    font-size: 1.5rem;
    color: #3498db;
    font-weight: bold;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .welcome-content {
        padding: 2rem 1.5rem;
    }

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

    .instruction-item p {
        font-size: 1rem;
    }
}
