/* Dualese Draft Writer Styles */

.dualese-draft-writer {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans CJK TC', 'Noto Sans CJK SC', sans-serif;
    position: relative;
}

/* Global T/S Switch */
.dw-global-switch {
    position: sticky;
    top: 32px;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.dw-ts-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 40px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.dw-ts-btn:hover {
    transform: translateY(-2px);
    border-color: #dc2626;
}

.dw-ts-btn.active {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    border-color: #dc2626;
    color: white;
}

.dw-ts-icon {
    font-size: 18px;
}

/* Options Row */
.dw-options-row {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.dw-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    background: #f8fafc;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
}

.dw-option-label:hover {
    background: #f1f5f9;
}

.dw-option-label input {
    width: auto;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

/* Title Row */
.dw-title-row {
    margin-bottom: 20px;
}

.dw-title-wrapper {
    background: #f8fafc;
    border: 2px dashed #94a3b8;
    border-radius: 12px;
    padding: 16px 20px;
    transition: border-color 0.3s ease;
}

.dw-title-wrapper:focus-within {
    border-color: #4f46e5;
    background: #f0f4ff;
}

.dw-title-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 8px;
}

.dw-title-icon {
    font-size: 18px;
}

.dw-title-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 500;
    font-family: inherit;
    background: white;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    outline: none;
}

.dw-title-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.dw-title-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
    font-size: 16px;
}

.dw-title-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #94a3b8;
}

/* Big Red Button */
.dw-big-red-button {
    width: 100%;
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: white;
    border: none;
    padding: 24px;
    font-size: 28px;
    font-weight: bold;
    border-radius: 16px;
    cursor: pointer;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(220, 38, 38, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.dw-big-red-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(220, 38, 38, 0.4);
}

.dw-big-red-button:active {
    transform: translateY(0);
}

.dw-btn-icon {
    font-size: 32px;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Button Container */
.dw-button-container {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.dw-button-container .dw-big-red-button {
    flex: 1;
    min-width: 300px;
    margin-bottom: 0;
}

.dw-big-red-button.dw-blank-button {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    box-shadow: 0 10px 30px rgba(107, 114, 128, 0.3);
}

.dw-big-red-button.dw-blank-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(107, 114, 128, 0.4);
}

.dw-big-red-button.dw-blank-button:active {
    transform: translateY(0);
}

/* Text Blocks */
.dw-text-blocks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.dw-text-block {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.dw-text-block:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.dw-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.dw-block-header h3 {
    margin: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dw-block-icon {
    font-size: 20px;
}

.dw-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.dw-badge.traditional {
    background: #3b82f6;
    color: white;
}

.dw-badge.simplified {
    background: #10b981;
    color: white;
}

.dw-textarea {
    width: 100%;
    min-height: 300px;
    padding: 20px;
    border: none;
    font-size: 16px;
    font-family: 'Noto Sans CJK TC', 'Noto Sans CJK SC', monospace;
    resize: vertical;
    line-height: 1.6;
}

.dw-textarea:focus {
    outline: none;
    background: #fefce8;
}

.dw-auto-save-status {
    padding: 8px 15px;
    background: #f0fdf4;
    border-top: 1px solid #dcfce7;
    font-size: 12px;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Preview Area */
.dw-preview-area {
    background: #f9fafb;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid #e5e7eb;
}

.dw-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.dw-preview-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dw-preview-badge {
    padding: 4px 16px;
    background: #dc2626;
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.dw-preview-content {
    min-height: 150px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 10px;
    font-size: 16px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.dw-preview-placeholder {
    color: #9ca3af;
    text-align: center;
    padding: 40px;
}

.dw-preview-stats {
    text-align: right;
    font-size: 12px;
    color: #6b7280;
}

/* Action Buttons */
.dw-action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.dw-action-btn {
    padding: 12px 24px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dw-action-btn:hover {
    background: #4f46e5;
    border-color: #4f46e5;
    color: white;
    transform: translateY(-2px);
}

/* Status Message */
.dw-status-message {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    animation: slideIn 0.3s ease;
    font-weight: 500;
}

.dw-status-message.success {
    background: #10b981;
    color: white;
}

.dw-status-message.error {
    background: #ef4444;
    color: white;
}

.dw-status-message.info {
    background: #3b82f6;
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading State */
.dw-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.dw-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================ */
/* AUDIO WORD STYLES */
/* ============================================ */

.dualese-audio-word {
    background-color: #e1ffe5;
    font-weight: bold;
    font-size: 16px;
    font-family: Arial, 'Noto Sans CJK TC', 'Noto Sans CJK SC', sans-serif;
    display: inline-block;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 2px 2px;
}

.dualese-audio-word.dualese-audio-blue {
    background-color: #AFF1FF;
}

.dualese-audio-word:hover {
    background-color: #ffff00;
    cursor: pointer;
}

.dualese-audio-word img {
    height: 15px;
    width: auto;
    vertical-align: middle;
    display: inline-block;
    margin: 0 1px;
}

.dualese-audio-word.playing {
    background-color: #ffcc00;
    animation: audioPulse 0.3s ease;
}

@keyframes audioPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.dualese-audio-loading {
    opacity: 0.6;
    cursor: wait;
}

/* Page ID Input */
.dw-page-id-row {
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.dw-page-id-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    background: #eef2ff;
    padding: 6px 15px;
    border-radius: 20px;
    border: 2px solid #4f46e5;
}

.dw-page-id-label input {
    width: 100px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.dw-page-id-label .dw-hint {
    font-size: 12px;
    color: #6b7280;
    margin-left: 5px;
}

/* Info Box */
.dw-info-box {
    background: #e0f2fe;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 4px solid #dc2626;
}

.dw-info-box strong {
    color: #1e40af;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dualese-draft-writer {
        padding: 10px;
    }
    
    .dw-text-blocks {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .dw-global-switch {
        position: relative;
        top: 0;
        justify-content: center;
        margin-bottom: 20px;
    }
    
    .dw-big-red-button {
        font-size: 20px;
        padding: 18px;
    }
    
    .dw-btn-icon {
        font-size: 24px;
    }
    
    .dw-action-buttons {
        flex-direction: column;
    }
    
    .dw-action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .dw-status-message {
        bottom: 20px;
        right: 20px;
        left: 20px;
        text-align: center;
    }
    
    .dw-options-row {
        justify-content: center;
    }
    
    .dw-title-input {
        font-size: 16px;
        padding: 10px 14px;
    }
    
    .dw-button-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .dw-button-container .dw-big-red-button {
        min-width: 100%;
        font-size: 18px;
        padding: 16px;
    }
    
    .dw-page-id-label {
        width: 100%;
        justify-content: center;
    }
    
    .dw-page-id-label input {
        width: 80px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .dw-text-block,
    .dw-preview-area {
        background: #1f2937;
        border-color: #374151;
    }
    
    .dw-block-header {
        background: #111827;
        border-color: #374151;
    }
    
    .dw-textarea {
        background: #1f2937;
        color: #f3f4f6;
    }
    
    .dw-textarea:focus {
        background: #111827;
    }
    
    .dw-preview-content {
        background: #111827;
        color: #f3f4f6;
    }
    
    .dw-action-btn {
        background: #1f2937;
        border-color: #374151;
        color: #f3f4f6;
    }
    
    .dw-auto-save-status {
        background: #064e3b;
        color: #a7f3d0;
    }
    
    .dw-option-label {
        background: #1f2937;
        border-color: #374151;
        color: #f3f4f6;
    }
    
    .dw-title-wrapper {
        background: #1e293b;
        border-color: #475569;
    }
    
    .dw-title-wrapper:focus-within {
        border-color: #6366f1;
        background: #1e293b;
    }
    
    .dw-title-label {
        color: #e2e8f0;
    }
    
    .dw-title-input {
        background: #0f172a;
        border-color: #334155;
        color: #f1f5f9;
    }
    
    .dw-title-input:focus {
        border-color: #6366f1;
    }
    
    .dw-title-input::placeholder {
        color: #64748b;
    }
    
    .dw-title-hint {
        color: #64748b;
    }
}

/* Print Styles */
@media print {
    .dw-global-switch,
    .dw-big-red-button,
    .dw-action-buttons,
    .dw-status-message,
    .dw-options-row,
    .dw-title-row {
        display: none;
    }
    
    .dw-text-blocks {
        display: block;
    }
    
    .dw-text-block {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Admin Pages */
.dualese-admin-info {
    background: #f0f9ff;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

/* Generated Pages Table */
.wp-list-table .dualese-page-link {
    text-decoration: none;
}

.wp-list-table .dualese-page-link:hover {
    text-decoration: underline;
}

/* Success Message with Link */
.dw-status-message a {
    color: white;
    text-decoration: underline;
}

.dw-status-message a:hover {
    color: #fef08a;
}

/* ============================================ */
/* INDEX BUTTON FIX - Make sure it's visible */
/* ============================================ */

.dualese-index-trigger {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    z-index: 99999 !important;
    display: block !important;
}

.dualese-index-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 14px 22px !important;
    background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 50px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    box-shadow: 0 8px 30px rgba(79, 70, 229, 0.4) !important;
}

/* Character Size Selector */
.dw-size-label {
    gap: 6px;
}

.dw-size-select {
    padding: 4px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    background: white;
    cursor: pointer;
    outline: none;
}

.dw-size-select:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Dualese Draft Writer Styles */

.dualese-draft-writer {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans CJK TC', 'Noto Sans CJK SC', sans-serif;
    position: relative;
}

/* Global T/S Switch */
.dw-global-switch {
    position: sticky;
    top: 32px;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.dw-ts-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 40px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.dw-ts-btn:hover {
    transform: translateY(-2px);
    border-color: #dc2626;
}

.dw-ts-btn.active {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    border-color: #dc2626;
    color: white;
}

.dw-ts-icon {
    font-size: 18px;
}

/* Options Row */
.dw-options-row {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.dw-option-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    background: #f8fafc;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
}

.dw-option-label:hover {
    background: #f1f5f9;
}

.dw-option-label input {
    width: auto;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

/* ============================================ */
/* CHARACTER SIZE SELECTOR - Blue themed        */
/* ============================================ */
.dw-size-label {
    gap: 8px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border: 2px solid #0ea5e9;
    padding: 8px 16px;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.dw-size-label:hover {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    border-color: #0284c7;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.dw-size-select {
    padding: 8px 32px 8px 12px;
    border: 2px solid #0284c7;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    background: white;
    cursor: pointer;
    outline: none;
    color: #0c4a6e;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%230284c7' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 90px;
    transition: all 0.2s ease;
}

.dw-size-select:hover {
    background-color: #f0f9ff;
    border-color: #0369a1;
}

.dw-size-select:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
    background-color: #fefce8;
}

/* Title Row */
.dw-title-row {
    margin-bottom: 20px;
}

.dw-title-wrapper {
    background: #f8fafc;
    border: 2px dashed #94a3b8;
    border-radius: 12px;
    padding: 16px 20px;
    transition: border-color 0.3s ease;
}

.dw-title-wrapper:focus-within {
    border-color: #4f46e5;
    background: #f0f4ff;
}

.dw-title-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #1e293b;
    margin-bottom: 8px;
}

.dw-title-icon {
    font-size: 18px;
}

.dw-title-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 500;
    font-family: inherit;
    background: white;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    outline: none;
}

.dw-title-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.dw-title-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
    font-size: 16px;
}

.dw-title-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #94a3b8;
}

/* Big Red Button */
.dw-big-red-button {
    width: 100%;
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: white;
    border: none;
    padding: 24px;
    font-size: 28px;
    font-weight: bold;
    border-radius: 16px;
    cursor: pointer;
    margin-bottom: 30px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(220, 38, 38, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.dw-big-red-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(220, 38, 38, 0.4);
}

.dw-big-red-button:active {
    transform: translateY(0);
}

.dw-btn-icon {
    font-size: 32px;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Button Container */
.dw-button-container {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.dw-button-container .dw-big-red-button {
    flex: 1;
    min-width: 300px;
    margin-bottom: 0;
}

.dw-big-red-button.dw-blank-button {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    box-shadow: 0 10px 30px rgba(107, 114, 128, 0.3);
}

.dw-big-red-button.dw-blank-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(107, 114, 128, 0.4);
}

.dw-big-red-button.dw-blank-button:active {
    transform: translateY(0);
}

/* Text Blocks */
.dw-text-blocks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.dw-text-block {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
}

.dw-text-block:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.dw-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.dw-block-header h3 {
    margin: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dw-block-icon {
    font-size: 20px;
}

.dw-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.dw-badge.traditional {
    background: #3b82f6;
    color: white;
}

.dw-badge.simplified {
    background: #10b981;
    color: white;
}

.dw-textarea {
    width: 100%;
    min-height: 300px;
    padding: 20px;
    border: none;
    font-size: 16px;
    font-family: 'Noto Sans CJK TC', 'Noto Sans CJK SC', monospace;
    resize: vertical;
    line-height: 1.6;
}

.dw-textarea:focus {
    outline: none;
    background: #fefce8;
}

.dw-auto-save-status {
    padding: 8px 15px;
    background: #f0fdf4;
    border-top: 1px solid #dcfce7;
    font-size: 12px;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Preview Area */
.dw-preview-area {
    background: #f9fafb;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid #e5e7eb;
}

.dw-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.dw-preview-header h4 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dw-preview-badge {
    padding: 4px 16px;
    background: #dc2626;
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.dw-preview-content {
    min-height: 150px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 10px;
    font-size: 16px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.dw-preview-placeholder {
    color: #9ca3af;
    text-align: center;
    padding: 40px;
}

.dw-preview-stats {
    text-align: right;
    font-size: 12px;
    color: #6b7280;
}

/* Action Buttons */
.dw-action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.dw-action-btn {
    padding: 12px 24px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dw-action-btn:hover {
    background: #4f46e5;
    border-color: #4f46e5;
    color: white;
    transform: translateY(-2px);
}

/* Status Message */
.dw-status-message {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    animation: slideIn 0.3s ease;
    font-weight: 500;
}

.dw-status-message.success {
    background: #10b981;
    color: white;
}

.dw-status-message.error {
    background: #ef4444;
    color: white;
}

.dw-status-message.info {
    background: #3b82f6;
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading State */
.dw-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.dw-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================ */
/* AUDIO WORD STYLES */
/* ============================================ */

.dualese-audio-word {
    background-color: #e1ffe5;
    font-weight: bold;
    font-size: 16px;
    font-family: Arial, 'Noto Sans CJK TC', 'Noto Sans CJK SC', sans-serif;
    display: inline-block;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 2px 2px;
}

.dualese-audio-word.dualese-audio-blue {
    background-color: #AFF1FF;
}

.dualese-audio-word:hover {
    background-color: #ffff00;
    cursor: pointer;
}

.dualese-audio-word img {
    height: 15px;
    width: auto;
    vertical-align: middle;
    display: inline-block;
    margin: 0 1px;
}

.dualese-audio-word.playing {
    background-color: #ffcc00;
    animation: audioPulse 0.3s ease;
}

@keyframes audioPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.dualese-audio-loading {
    opacity: 0.6;
    cursor: wait;
}

/* Page ID Input */
.dw-page-id-row {
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.dw-page-id-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    background: #eef2ff;
    padding: 6px 15px;
    border-radius: 20px;
    border: 2px solid #4f46e5;
}

.dw-page-id-label input {
    width: 100px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.dw-page-id-label .dw-hint {
    font-size: 12px;
    color: #6b7280;
    margin-left: 5px;
}

/* Info Box */
.dw-info-box {
    background: #e0f2fe;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    border-left: 4px solid #dc2626;
}

.dw-info-box strong {
    color: #1e40af;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dualese-draft-writer {
        padding: 10px;
    }
    
    .dw-text-blocks {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .dw-global-switch {
        position: relative;
        top: 0;
        justify-content: center;
        margin-bottom: 20px;
    }
    
    .dw-big-red-button {
        font-size: 20px;
        padding: 18px;
    }
    
    .dw-btn-icon {
        font-size: 24px;
    }
    
    .dw-action-buttons {
        flex-direction: column;
    }
    
    .dw-action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .dw-status-message {
        bottom: 20px;
        right: 20px;
        left: 20px;
        text-align: center;
    }
    
    .dw-options-row {
        justify-content: center;
    }
    
    .dw-title-input {
        font-size: 16px;
        padding: 10px 14px;
    }
    
    .dw-button-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .dw-button-container .dw-big-red-button {
        min-width: 100%;
        font-size: 18px;
        padding: 16px;
    }
    
    .dw-page-id-label {
        width: 100%;
        justify-content: center;
    }
    
    .dw-page-id-label input {
        width: 80px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .dw-text-block,
    .dw-preview-area {
        background: #1f2937;
        border-color: #374151;
    }
    
    .dw-block-header {
        background: #111827;
        border-color: #374151;
    }
    
    .dw-textarea {
        background: #1f2937;
        color: #f3f4f6;
    }
    
    .dw-textarea:focus {
        background: #111827;
    }
    
    .dw-preview-content {
        background: #111827;
        color: #f3f4f6;
    }
    
    .dw-action-btn {
        background: #1f2937;
        border-color: #374151;
        color: #f3f4f6;
    }
    
    .dw-auto-save-status {
        background: #064e3b;
        color: #a7f3d0;
    }
    
    .dw-option-label {
        background: #1f2937;
        border-color: #374151;
        color: #f3f4f6;
    }
    
    .dw-title-wrapper {
        background: #1e293b;
        border-color: #475569;
    }
    
    .dw-title-wrapper:focus-within {
        border-color: #6366f1;
        background: #1e293b;
    }
    
    .dw-title-label {
        color: #e2e8f0;
    }
    
    .dw-title-input {
        background: #0f172a;
        border-color: #334155;
        color: #f1f5f9;
    }
    
    .dw-title-input:focus {
        border-color: #6366f1;
    }
    
    .dw-title-input::placeholder {
        color: #64748b;
    }
    
    .dw-title-hint {
        color: #64748b;
    }
    
    /* Dark mode for size selector */
    .dw-size-label {
        background: linear-gradient(135deg, #1e3a5f, #0c4a6e);
        border-color: #38bdf8;
        color: #e0f2fe;
    }
    
    .dw-size-label:hover {
        background: linear-gradient(135deg, #0c4a6e, #082f49);
        border-color: #7dd3fc;
    }
    
    .dw-size-select {
        background-color: #0f172a;
        border-color: #38bdf8;
        color: #e0f2fe;
    }
    
    .dw-size-select:hover {
        background-color: #1e293b;
        border-color: #7dd3fc;
    }
    
    .dw-size-select option {
        background-color: #1e293b;
        color: #e0f2fe;
    }
}

/* Print Styles */
@media print {
    .dw-global-switch,
    .dw-big-red-button,
    .dw-action-buttons,
    .dw-status-message,
    .dw-options-row,
    .dw-title-row {
        display: none;
    }
    
    .dw-text-blocks {
        display: block;
    }
    
    .dw-text-block {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Admin Pages */
.dualese-admin-info {
    background: #f0f9ff;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

/* Generated Pages Table */
.wp-list-table .dualese-page-link {
    text-decoration: none;
}

.wp-list-table .dualese-page-link:hover {
    text-decoration: underline;
}

/* Success Message with Link */
.dw-status-message a {
    color: white;
    text-decoration: underline;
}

.dw-status-message a:hover {
    color: #fef08a;
}

/* ============================================ */
/* INDEX BUTTON FIX - Make sure it's visible */
/* ============================================ */

.dualese-index-trigger {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    z-index: 99999 !important;
    display: block !important;
}

.dualese-index-btn {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 14px 22px !important;
    background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 50px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    box-shadow: 0 8px 30px rgba(79, 70, 229, 0.4) !important;
}

/* Character Size Selector */
.dw-size-label {
    gap: 6px;
}

.dw-size-select {
    padding: 4px 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    background: white;
    cursor: pointer;
    outline: none;
}

.dw-size-select:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}