/* style.css — Main stylesheet */

:root {
    --bg-page:        linear-gradient(135deg, #dbeafe 0%, #ede9fe 55%, #fce7f3 100%);
    --bg-primary:     #ffffff;
    --bg-secondary:   #f9f9f9;
    --text-primary:   #1a1a1a;
    --text-secondary: #555555;
    --text-muted:     #999999;
    --border:         #e0e0e0;
    --accent:         #2563eb;
    --accent-hover:   #1d4ed8;
    --toolbar-bg:     #f8f8f8;
    --header-height:  56px;
    --footer-height:  42px;
    --container-w:    900px;
    --shadow:         0 2px 16px rgba(0,0,0,0.10);
}

body.dark-mode {
    --bg-page:        linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --bg-primary:     #1e1e1e;
    --bg-secondary:   #2a2a2a;
    --text-primary:   #f0f0f0;
    --text-secondary: #aaaaaa;
    --text-muted:     #666666;
    --border:         #383838;
    --toolbar-bg:     #252525;
    --shadow:         0 2px 16px rgba(0,0,0,0.5);
}

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

body {
    background: linear-gradient(135deg, #dbeafe 0%, #ede9fe 55%, #fce7f3 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    transition: color 0.2s;
    min-height: 100vh;
}

body.dark-mode {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    background-attachment: fixed;
}

/* ── Site Header ─────────────────────────────── */
.wn-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.wn-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    flex-shrink: 0;
}

.wn-logo img { height: 34px; width: auto; display: block; border-radius: 2px; }

.wn-header-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

/* ── Workspace container ─────────────────────── */
.wn-workspace {
    max-width: var(--container-w);
    margin: 1.5rem auto;
    background: var(--bg-primary);
    border-radius: 10px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

body.wn-fullscreen .wn-workspace {
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.wn-minimized .wn-workspace {
    max-width: var(--container-w);
    margin: 1.5rem auto;
}

/* ── Formatting Toolbar ───────────────────────── */
.wn-toolbar {
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.4rem 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.wn-toolbar-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 0.2rem;
    flex-shrink: 0;
}

/* Font family select */
.wn-font-select {
    height: 28px;
    font-size: 0.78rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0 0.4rem;
    cursor: pointer;
    max-width: 150px;
}

/* Font size controls */
.wn-font-size-group {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.wn-font-size-input {
    width: 42px;
    height: 28px;
    text-align: center;
    font-size: 0.78rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Toolbar buttons */
.wn-tbtn {
    height: 28px;
    min-width: 28px;
    padding: 0 0.4rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    user-select: none;
}

.wn-tbtn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    color: var(--accent);
}

.wn-tbtn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.wn-tbtn.danger:hover {
    border-color: #dc2626;
    color: #dc2626;
}

/* View control buttons in header */
.wn-btn {
    height: 30px;
    padding: 0 0.65rem;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.78rem;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.wn-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.wn-btn.wn-recording {
    border-color: #dc2626;
    color: #dc2626;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ── Dropdown ────────────────────────────────── */
.wn-dropdown { position: relative; }

.wn-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 7px;
    min-width: 160px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.14);
    z-index: 300;
    overflow: hidden;
}

.wn-dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.83rem;
    cursor: pointer;
    transition: background 0.1s;
}

/* ── Share dropdown items ────────────────────── */
.wn-share-item {
    display: flex !important;
    align-items: center;
    gap: 0.65rem;
}

.wn-share-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: block;
}

.wn-dropdown-menu button:hover { background: var(--bg-secondary); }

.hidden { display: none !important; }

/* ── Title field (hidden per design) ─────────── */
.wn-title-bar {
    display: none;
}

#wn-title {
    width: 100%;
    border: none;
    outline: none;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    background: transparent;
    font-family: inherit;
    border-bottom: 2px solid transparent;
    padding-bottom: 0.5rem;
    transition: border-color 0.2s;
}

#wn-title:focus { border-bottom-color: var(--accent); }
#wn-title::placeholder { color: var(--text-muted); font-weight: 400; }

/* ── Editor ─────────────────────────────────── */
.wn-editor-wrap {
    padding: 0 1.5rem;
}

#wn-editor {
    width: 100%;
    min-height: 480px;
    padding: 1rem 0 2rem;
    font-size: 16px;
    line-height: 1.85;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-family: 'Georgia', 'Times New Roman', serif;
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#wn-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
    pointer-events: none;
}

#wn-editor h1 { font-size: 2rem;   line-height: 1.3; margin-bottom: 0.5rem; }
#wn-editor h2 { font-size: 1.5rem; line-height: 1.35; margin-bottom: 0.4rem; }
#wn-editor h3 { font-size: 1.2rem; line-height: 1.4; margin-bottom: 0.35rem; }

body.wn-fullscreen #wn-editor { min-height: calc(100vh - 260px); }
body.wn-minimized  #wn-editor { min-height: 120px; max-height: 120px; overflow: hidden; }

/* ── Footer bar ─────────────────────────────── */
.wn-footer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 1rem;
    height: var(--footer-height);
    border-top: 1px solid var(--border);
    background: var(--toolbar-bg);
    font-size: 0.75rem;
    color: var(--text-muted);
    gap: 1rem;
    flex-wrap: wrap;
}

.wn-counts { display: flex; gap: 0.75rem; }

.wn-footer-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.wn-btn-sm {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.72rem;
    cursor: pointer;
    padding: 0.18rem 0.5rem;
    border-radius: 4px;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.wn-btn-sm:hover { color: var(--accent); border-color: var(--accent); }

#wn-saved-indicator {
    opacity: 0;
    transition: opacity 0.3s;
    color: #16a34a;
    font-size: 0.72rem;
}
#wn-saved-indicator.visible { opacity: 1; }

/* ── Homepage content ────────────────────────── */
.wn-content {
    max-width: var(--container-w);
    margin: 2.5rem auto;
    padding: 0 1.5rem 4rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.wn-content a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.15s;
}

.wn-content a:hover {
    text-decoration-color: currentColor;
}

.wn-content h1 { font-size: 1.75rem; color: var(--text-primary); margin-bottom: 1rem; }
.wn-content h2 { font-size: 1.25rem; color: var(--text-primary); margin: 2rem 0 0.75rem; }
.wn-content h3 { font-size: 1.05rem; color: var(--text-primary); margin: 1.5rem 0 0.5rem; }
.wn-content p  { margin-bottom: 1rem; }
.wn-content ul,
.wn-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.wn-content li { margin-bottom: 0.4rem; }
.wn-content table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; font-size: 0.88rem; }
.wn-content th,
.wn-content td { padding: 0.5rem 0.75rem; border: 1px solid var(--border); text-align: left; }
.wn-content th { background: var(--bg-secondary); color: var(--text-primary); font-weight: 600; }

/* ── Site Footer ─────────────────────────────── */
.wn-footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 2.2;
}

.wn-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.wn-footer a:hover { color: var(--accent); }

.wn-footer-pages { margin-top: 0.4rem; }
.wn-footer-pages a { margin: 0 0.5rem; }

/* ── Ads ─────────────────────────────────────── */
.wn-ad-container {
    max-width: var(--container-w);
    margin: 0 auto 1.5rem;
    padding: 0 1.5rem;
}

/* ── Static pages ────────────────────────────── */
.wn-static-page {
    max-width: 780px;
    margin: 2.5rem auto;
    background: var(--bg-primary);
    border-radius: 10px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 3rem;
    color: var(--text-secondary);
    line-height: 1.85;
}

.wn-static-page h1 { font-size: 1.9rem; color: var(--text-primary); margin-bottom: 0.5rem; }
.wn-static-page .wn-static-date { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 2rem; display: block; }
.wn-static-page h2 { font-size: 1.2rem; color: var(--text-primary); margin: 2rem 0 0.6rem; }
.wn-static-page p  { margin-bottom: 1rem; }
.wn-static-page ul { padding-left: 1.5rem; margin-bottom: 1rem; }
.wn-static-page li { margin-bottom: 0.35rem; }
.wn-static-page a  { color: var(--accent); text-decoration: none; }
.wn-static-page a:hover { text-decoration: underline; }

/* ── Print ───────────────────────────────────── */
@media print {
    .wn-header, .wn-toolbar, .wn-footer-bar,
    .wn-footer, .wn-content, .wn-ad-container { display: none; }
    .wn-workspace { box-shadow: none; border: none; border-radius: 0; }
    #wn-editor { min-height: auto; }
}

/* ── Mobile ──────────────────────────────────── */
@media (max-width: 940px) {
    .wn-workspace { margin: 0.75rem; border-radius: 8px; }
    .wn-content { padding: 0 1rem 3rem; }
}

@media (max-width: 768px) {
    .wn-header { padding: 0 0.75rem; }
    .wn-header-actions { gap: 0.2rem; }
    .wn-btn { font-size: 0.72rem; padding: 0 0.45rem; }
    .wn-toolbar { padding: 0.35rem 0.5rem; gap: 0.2rem; }
    .wn-font-select { max-width: 110px; }
    .wn-editor-wrap { padding: 0 1rem; }
    #wn-editor { font-size: 16px; min-height: 360px; }
    .wn-footer-bar { padding: 0.3rem 0.75rem; font-size: 0.7rem; }
    .wn-static-page { margin: 1rem; padding: 1.5rem; }
}

/* ── FAQ Accordion ───────────────────────────── */
.wn-faq-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
    background: var(--bg-primary);
}

.wn-faq-question {
    width: 100%;
    text-align: left;
    background: var(--bg-secondary);
    border: none;
    padding: 0.9rem 1.1rem;
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}

.wn-faq-question::after {
    content: '+';
    font-size: 1.3rem;
    font-weight: 300;
    color: var(--accent);
    flex-shrink: 0;
    transition: transform 0.2s;
}

.wn-faq-question[aria-expanded="true"] {
    background: var(--bg-primary);
    color: var(--accent);
}

.wn-faq-question[aria-expanded="true"]::after {
    content: '−';
}

.wn-faq-question:hover {
    background: var(--bg-primary);
    color: var(--accent);
}

.wn-faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.28s ease, padding 0.28s ease;
    padding: 0 1.1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.75;
    border-top: 0px solid var(--border);
}

.wn-faq-answer.open {
    max-height: 400px;
    padding: 0.85rem 1.1rem 1rem;
    border-top-width: 1px;
}
