/**
 * LinkedIn Post Formatter - Styles
 * Version 3.0
 * 
 * Clean, discoverable UI with highlighted features
 */

:root {
    --primary: #C62E2E;
    --primary-dark: #a02525;
    --primary-light: #fee2e2;
    --secondary: #1e1e1e;
    --accent: #C1E172;
    --accent-dark: #a8c960;
    --linkedin: #0A66C2;
    
    --bg: #f5f5f5;
    --surface: #ffffff;
    --surface-alt: #fafafa;
    
    --text: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;
    
    --shadow-sm: 0 1px 2px 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);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --transition: 150ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* =====================================
   EDITOR SECTION
===================================== */
.editor-section {
    min-height: 100vh;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.editor-container {
    width: 100%;
    max-width: 1400px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2rem);
}

/* =====================================
   PROBLEM BANNER
===================================== */
.problem-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, #fef3c7 100%);
    border-bottom: 1px solid var(--border);
}

.problem-icon {
    font-size: 1.25rem;
}

.problem-text {
    flex: 1;
    font-size: 0.875rem;
}

.problem-text strong {
    color: var(--primary);
    display: block;
    font-size: 0.9rem;
}

.problem-text span {
    color: var(--text-secondary);
}

.banner-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.banner-close:hover {
    color: var(--text);
}

/* =====================================
   EDITOR HEADER
===================================== */
.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.editor-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
}

.linkedin-icon {
    flex-shrink: 0;
}

.editor-actions-top {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.action-btn-small {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.action-btn-small:hover:not(:disabled) {
    background: var(--border-light);
    color: var(--text);
}

.action-btn-small:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.divider-v {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 0.25rem;
}

.autosave-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: var(--success);
    background: none;
    border: none;
}

.autosave-indicator.saved svg {
    color: var(--success);
}

.help-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.help-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* =====================================
   MAIN LAYOUT
===================================== */
.editor-main {
    display: grid;
    grid-template-columns: 55% 45%; /* Editor 55%, Preview 45% */
    flex: 1;
    overflow: hidden;
    min-height: 500px;
}

/* =====================================
   LEFT PANEL - EDITOR
===================================== */
.editor-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: visible;
}

/* =====================================
   AI FIX TOOLBAR - MAIN FEATURE
===================================== */
.ai-fix-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #fef3c7 0%, #d1fae5 100%);
    border-bottom: 2px solid var(--accent);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fix-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.fix-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.fix-icon {
    font-size: 1rem;
}

.fix-buttons {
    display: flex;
    gap: 0.5rem;
}

.fix-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    background: white;
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.fix-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.fix-btn.main-fix {
    background: var(--primary);
    color: white;
    padding: 0.625rem 1rem;
}

.fix-btn.main-fix:hover {
    background: var(--primary-dark);
}

.btn-icon {
    font-size: 1rem;
}

.btn-text {
    font-weight: 600;
}

.btn-badge {
    background: rgba(255,255,255,0.3);
    padding: 0.125rem 0.375rem;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
}

.spacing-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spacing-control label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.spacing-buttons {
    display: flex;
    background: white;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.spacing-btn {
    width: 32px;
    height: 28px;
    border: none;
    background: white;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.spacing-btn:hover {
    background: var(--border-light);
}

.spacing-btn.active {
    background: var(--primary);
    color: white;
}

/* =====================================
   FORMATTING TOOLBAR
===================================== */
.formatting-toolbar {
    display: flex;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.625rem 0.75rem;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    overflow-x: visible;
    flex-shrink: 0;
}

.toolbar-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.toolbar-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: 0.25rem;
}

.toolbar-group {
    display: flex;
    gap: 0.125rem;
}

.toolbar-divider {
    width: 1px;
    height: 52px;
    background: var(--border);
    margin: 0 0.5rem;
    align-self: center;
}

.toolbar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0.25rem;
    border: 1px solid transparent;
    background: var(--surface);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.toolbar-btn:hover {
    border-color: var(--border);
    background: white;
    box-shadow: var(--shadow-sm);
}

.toolbar-btn.featured {
    background: var(--accent);
    border-color: var(--accent-dark);
}

.toolbar-btn.featured:hover {
    background: var(--accent-dark);
}

.btn-hint {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.toolbar-btn.featured .btn-hint {
    color: var(--text-secondary);
}

/* Tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.375rem 0.625rem;
    background: var(--secondary);
    color: white;
    font-size: 0.7rem;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    z-index: 100;
    pointer-events: none;
}


/* =====================================
   PREVIEW - BROKEN STATE (Before Fix)
===================================== */
.preview-broken {
    background: #fef2f2;
    border: 1px dashed #fca5a5;
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    position: relative;
}

.preview-broken::before {
    content: "⚠️ Without formatting (how LinkedIn shows it)";
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #fecaca;
}

/* The text inside looks like a wall of text */
.preview-broken {
    font-size: 0.825rem;
    line-height: 1.4;
    color: var(--text);
    word-wrap: break-word;
}

/* After fix - show success state */
.preview-content:not(:has(.preview-broken)):not(:has(.preview-placeholder)) {
    position: relative;
}

/* Optional: Add a "fixed" indicator after applying fix */
.preview-fixed-badge {
    display: inline-block;
    background: #d1fae5;
    color: #059669;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    margin-bottom: 0.5rem;
}

/* =====================================
   DROPDOWNS
===================================== */
.dropdown-container {
    position: relative;
    z-index: 1000;
}

/* When dropdown is open, increase z-index even more */
.dropdown-container:has(.dropdown-menu.show) {
    z-index: 9999;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--surface-alt);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.picker-tip {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Emoji Picker */
.emoji-picker {
    width: 280px;
    max-height: 320px;
    overflow-y: auto;
}

.emoji-category {
    padding: 0.5rem 0.75rem;
}

.emoji-cat-title {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.25rem;
}

.emoji-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
}

.emoji-btn:hover {
    background: var(--border-light);
    transform: scale(1.15);
}

/* Hook & CTA Pickers */
.hook-picker,
.cta-picker {
    width: 300px;
    max-height: 350px;
    overflow-y: auto;
}

.hook-list,
.cta-list {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.hook-btn,
.cta-btn {
    padding: 0.75rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    text-align: left;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.hook-btn:hover,
.cta-btn:hover {
    background: var(--accent);
    border-color: var(--accent-dark);
}
/* =====================================
   TEXT EDITOR
===================================== */
.text-editor-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.editor-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
}

.editor-placeholder.hidden {
    display: none;
}

.placeholder-content {
    text-align: center;
    padding: 2rem;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.placeholder-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.placeholder-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.placeholder-steps {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.placeholder-steps .step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
}

.post-editor {
    width: 100%;
    height: 100%;
    padding: 1rem;
    border: none;
    resize: none;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
    background: transparent;
    font-family: inherit;
    position: relative;
    z-index: 2;
}

.post-editor:focus {
    outline: none;
}

/* =====================================
   EDITOR FOOTER
===================================== */
.editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
    flex-shrink: 0;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.char-counter {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.char-separator {
    color: var(--text-muted);
}

.char-limit {
    color: var(--text-muted);
}

.char-progress {
    width: 50px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-left: 0.5rem;
    overflow: hidden;
}

.char-progress-bar {
    height: 100%;
    background: var(--success);
    border-radius: 2px;
    transition: width var(--transition), background var(--transition);
}

.word-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-right {
    display: flex;
    gap: 0.5rem;
}

.footer-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
}

.footer-btn:hover {
    border-color: var(--text-muted);
}

.footer-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.footer-btn.primary:hover {
    background: var(--primary-dark);
}

/* =====================================
   RIGHT PANEL - PREVIEW
===================================== */
.preview-panel {
    display: flex;
    flex-direction: column;
    background: var(--surface-alt);
    overflow: hidden;
}

/* Tabs */
.preview-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
}

.preview-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.75rem 0.5rem;
    border: none;
    background: transparent;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}

.preview-tab:hover {
    color: var(--text);
    background: var(--border-light);
}

.preview-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-icon {
    font-size: 0.9rem;
}

/* Tab Content */
.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}

.tab-content.active {
    display: block;
}

/* Preview */
.preview-wrapper {
    margin-bottom: 0.75rem;
}

.preview-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.preview-note {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
}

.linkedin-preview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem;
}

.preview-avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    flex-shrink: 0;
}

.preview-user-info {
    flex: 1;
    min-width: 0;
}

.preview-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
}

.preview-headline {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-time {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.preview-more {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
}

.preview-content {
    padding: 0 0.75rem 0.75rem;
    font-size: 0.825rem;
    line-height: 1.5;
    color: var(--text);
    max-height: 200px;
    overflow-y: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.preview-placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.preview-content .hashtag {
    color: var(--linkedin);
    font-weight: 500;
}

.preview-content .mention {
    color: var(--linkedin);
    font-weight: 500;
}

.preview-engagement {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.preview-reactions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.reaction-icons {
    font-size: 0.85rem;
}

.preview-actions {
    display: flex;
    justify-content: space-around;
    padding: 0.375rem;
    border-top: 1px solid var(--border);
}

.preview-action-btn {
    flex: 1;
    padding: 0.375rem;
    border: none;
    background: transparent;
    font-size: 0.7rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.preview-action-btn:hover {
    background: var(--border-light);
}

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.stat-icon {
    font-size: 1rem;
}

.stat-label {
    flex: 1;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

/* =====================================
   ANALYTICS TAB
===================================== */
.analytics-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.score-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
}

.score-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-circle {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 0.5rem;
}

.score-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 4;
}

.score-fill {
    fill: none;
    stroke: var(--success);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease, stroke 0.3s ease;
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.score-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.625rem;
}

.metric-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.375rem;
}

.metric-icon {
    font-size: 0.9rem;
}

.metric-name {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.metric-bar-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.metric-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.metric-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.metric-percent {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text);
    min-width: 28px;
    text-align: right;
}

/* Tips */
.tips-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.tips-header {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.tips-list {
    padding: 0.5rem 0.75rem;
}

.tip-item {
    display: flex;
    gap: 0.5rem;
    padding: 0.375rem 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.tip-bullet {
    color: var(--primary);
    flex-shrink: 0;
}

/* =====================================
   TEMPLATES TAB
===================================== */
.templates-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.templates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.save-template-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.625rem;
    border: 1px dashed var(--primary);
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
}

.save-template-btn:hover {
    background: var(--primary);
    color: white;
    border-style: solid;
}

.template-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.template-cat {
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.template-cat:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.template-cat.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.templates-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.template-item {
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.template-item:hover {
    border-color: var(--primary);
}

.template-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.template-preview {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Saved Templates */
.saved-section {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.saved-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.saved-list {
    max-height: 120px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.saved-template-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.625rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.375rem;
}

.saved-template-item .template-name {
    cursor: pointer;
    margin-bottom: 0;
    font-size: 0.8rem;
}

.saved-template-item .template-name:hover {
    color: var(--primary);
}

.delete-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: var(--error);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.delete-btn:hover {
    opacity: 0.8;
}

/* =====================================
   TOAST
===================================== */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: var(--secondary);
    color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
    z-index: 9999;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--success);
    border-radius: 50%;
    font-size: 0.7rem;
}

.toast-message {
    font-size: 0.9rem;
    font-weight: 500;
}

/* =====================================
   MODALS
===================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 9999;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 420px;
    box-shadow: var(--shadow-xl);
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--border-light);
    color: var(--text);
}

.modal-body {
    padding: 1.25rem;
}

.modal-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.modal-input,
.modal-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    transition: var(--transition);

}

.modal-input:focus,
.modal-select:focus {
    outline: none;
    border-color: var(--primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

.modal-btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.modal-btn.secondary {
    background: var(--border-light);
    color: var(--text);
}

.modal-btn.secondary:hover {
    background: var(--border);
}

.modal-btn.primary {
    background: var(--primary);
    color: white;
}

.modal-btn.primary:hover {
    background: var(--primary-dark);
}

/* Help Modal */
.help-modal {
    max-width: 500px;
}

.help-section {
    margin-bottom: 1.5rem;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.help-section p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.help-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.help-step {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.help-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.shortcut {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.shortcut kbd {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background: var(--border-light);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.7rem;
    color: var(--text);
}

/* =====================================
   FEATURES SECTION
===================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.features-section {
    padding: 4rem 0;
    background: var(--surface);
}

.features-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
    color: var(--text);
}

.problem-solution {
    display: flex;
    align-items: stretch;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.problem-card {
    flex: 1;
    min-width: 300px;
    max-width: 450px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    font-weight: 600;
}

.card-header.bad {
    background: var(--primary-light);
    color: var(--primary);
}

.card-header.good {
    background: #d1fae5;
    color: #059669;
}

.card-icon {
    font-size: 1.25rem;
}

.card-body {
    padding: 1.25rem;
}

.card-body p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.example-box {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.example-box.bad {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.example-box.good {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.example-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.example-text {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text);
}

.problem-reason {
    color: var(--error) !important;
    font-weight: 500;
}

.solution-benefit {
    color: #059669 !important;
}

.arrow-connector {
    display: flex;
    align-items: center;
    font-size: 2rem;
    color: var(--text-muted);
}

/* Highlights Section */
.highlights-section {
    padding: 4rem 0;
    background: var(--bg);
}

.highlights-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
    color: var(--text);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    position: relative;
}

.feature-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.feature-card.highlight {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.feature-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.25rem 0.75rem;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* How To Section */
.how-to-section {
    padding: 4rem 0;
    background: var(--surface);
}

.how-to-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
    color: var(--text);
}

.steps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.step-card {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    position: relative;
}

.step-card.featured {
    background: linear-gradient(135deg, #fef3c7 0%, #d1fae5 100%);
    border: 2px solid var(--accent);
}

.step-number {
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

.step-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.step-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* CTA Section */
.cta-section {
    background: linear-gradient(135deg, var(--secondary) 0%, #2d2d2d 100%);
    padding: 4rem 0;
    text-align: center;
}

.cta-content h2 {
    color: white;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cta-content p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-cta-primary,
.btn-cta-secondary {
    padding: 0.875rem 2rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.btn-cta-primary {
    background: var(--primary);
    color: white;
}

.btn-cta-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-cta-secondary {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-cta-secondary:hover {
    background: white;
    color: var(--text);
}

/* FAQ Section */
.faq-section {
    padding: 4rem 0;
    background: var(--bg);
}

.faq-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
    color: var(--text);
}


.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    transition: var(--transition);
}

.faq-question:hover {
    color: var(--primary);
}

.faq-icon {
    font-size: 1.5rem;
    color: var(--primary);
    transition: var(--transition);
}

.faq-item.active .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-answer p {
    padding: 0 1.25rem 1.25rem;
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 0.9rem;
}

/* Content Section */
.content-section {
    padding: 4rem 0;
    background: var(--surface);
}

.content-card {
    background: var(--bg);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    max-width: 900px;
    margin: 0 auto;
}

.content-card h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.content-card h3 {
    font-size: 1.25rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.content-card p {
    margin-bottom: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* =====================================
   RESPONSIVE
===================================== */
@media (max-width: 1024px) {
    .editor-main {
        grid-template-columns: 1fr 320px;
    }
}

@media (max-width: 900px) {
    .editor-section {
        padding: 0.5rem;
    }

    .editor-container {
        max-height: none;
        border-radius: var(--radius-md);
    }

    .editor-main {
        grid-template-columns: 1fr;
    }

    .editor-panel {
        border-right: none;
        min-height: 450px;
    }

    .preview-panel {
        border-top: 1px solid var(--border);
        max-height: 400px;
    }

    .ai-fix-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .fix-section {
        justify-content: center;
    }

    .spacing-control {
        justify-content: center;
    }

    .formatting-toolbar {
        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .toolbar-section {
        flex-shrink: 0;
    }

    .problem-solution {
        flex-direction: column;
    }

    .arrow-connector {
        transform: rotate(90deg);
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .editor-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .editor-footer {
        flex-direction: column;
        gap: 0.75rem;
    }

    .footer-left, .footer-right {
        width: 100%;
        justify-content: center;
    }

    .placeholder-steps {
        flex-direction: column;
        gap: 0.75rem;
    }

    .fix-buttons {
        flex-direction: column;
        width: 100%;
    }

    .fix-btn {
        justify-content: center;
    }

    .quick-stats {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .shortcuts-grid {
        grid-template-columns: 1fr;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .steps-container {
        grid-template-columns: 1fr;
    }
}

/* =====================================
   SCROLLBAR
===================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--border-light);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* =====================================
   ACCESSIBILITY
===================================== */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Print */
@media print {
    .editor-section, .problem-banner {
        display: none;
    }
}


/* =====================================
   RESPONSIVE
===================================== */

/* Large tablets and small desktops */
@media (max-width: 1200px) {
    .editor-main {
        grid-template-columns: 1fr 380px;
    }
    
    .formatting-toolbar {
        padding: 0.5rem;
        gap: 0.5rem;
        overflow-x: auto;
    }
    
    .toolbar-section {
        min-width: fit-content;
    }
}

/* Tablets */
@media (max-width: 1024px) {
    .editor-main {
        grid-template-columns: 1fr 320px;
    }
    
    .ai-fix-toolbar {
        padding: 0.625rem !important;
        gap: 0.75rem;
    }
    
    .fix-btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.75rem !important;
    }
    
    .fix-btn.main-fix {
        padding: 0.5rem 0.875rem !important;
    }
}

/* Small tablets and large phones */
@media (max-width: 900px) {
    .editor-section {
        padding: 0.5rem;
    }

    .editor-container {
        max-height: none;
        border-radius: var(--radius-md);
    }

    /* Stack editor and preview vertically */
    .editor-main {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .editor-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
        min-height: 450px;
        max-height: none;
    }

    .preview-panel {
        border-top: none;
        max-height: none;
        min-height: 350px;
    }

    /* AI Fix Toolbar - Stack vertically */
    .ai-fix-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem 0.875rem !important;
        gap: 0.875rem;
    }

    .fix-section {
        flex-direction: column;
        align-items: stretch;
        gap: 0.625rem;
    }
    
    .fix-section.primary-fix {
        width: 100%;
    }
    
    .fix-label {
        justify-content: center;
        font-size: 0.85rem !important;
    }

    /* Fix buttons in 2 columns */
    .fix-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.625rem;
        width: 100%;
    }
    
    .fix-btn {
        width: 100%;
        justify-content: center;
        white-space: nowrap;
        padding: 0.5rem 0.625rem !important;
        font-size: 0.75rem !important;
    }
    
    .fix-btn.main-fix {
        padding: 0.5rem 0.75rem !important;
    }
    
    .fix-btn .btn-text {
        display: inline;
        font-size: 0.75rem !important;
    }
    
    .fix-btn .btn-icon {
        font-size: 0.9rem !important;
    }
    
    .fix-btn .btn-badge {
        font-size: 0.6rem !important;
        padding: 0.125rem 0.35rem !important;
    }

    /* Spacing control centered */
    .spacing-control {
        justify-content: center;
        flex-direction: row;
        align-items: center;
        width: 100%;
    }
    
    .spacing-control label {
        margin-right: 0.5rem;
        font-size: 0.8rem;
    }
    
    .spacing-btn {
        width: 36px !important;
        height: 30px !important;
        padding: 0 !important;
        font-size: 0.75rem !important;
    }

    /* Formatting toolbar - horizontal scroll */
    .formatting-toolbar {
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        padding: 0.625rem 0.5rem !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .toolbar-section {
        flex-shrink: 0;
    }
    
    .toolbar-btn {
        min-width: 42px !important;
        height: 42px !important;
        padding: 0.25rem !important;
    }

    /* Text editor */
    .text-editor-wrapper {
        min-height: 300px;
    }

    .post-editor {
        padding: 1rem !important;
        font-size: 0.9rem;
        min-height: 300px;
    }

    /* Editor footer */
    .editor-footer {
        flex-wrap: wrap;
        padding: 0.75rem 1rem !important;
    }

    .footer-left {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .footer-btn {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    /* Problem solution section */
    .problem-solution {
        flex-direction: column;
    }

    .arrow-connector {
        transform: rotate(90deg);
        justify-content: center;
        margin: 1rem 0;
    }
    
    .problem-card {
        max-width: 100%;
    }
}

/* Medium phones */
@media (max-width: 768px) {
    .editor-section {
        padding: 0.25rem;
    }
    
    /* Problem banner */
    .problem-banner {
        flex-wrap: wrap;
        padding: 0.625rem 0.75rem !important;
    }
    
    .problem-text strong {
        font-size: 0.85rem;
    }
    
    .problem-text span {
        font-size: 0.8rem;
    }
    
    /* Editor header */
    .editor-header {
        flex-wrap: wrap;
        padding: 0.625rem 0.75rem !important;
        gap: 0.5rem;
    }
    
    .editor-actions-top {
        gap: 0.25rem;
    }
    
    .action-btn-small {
        width: 28px !important;
        height: 28px !important;
        padding: 0 !important;
    }
    
    /* Editor panel */
    .editor-panel {
        min-height: 400px;
    }
    
    .preview-panel {
        min-height: 300px;
    }
    
    /* AI Fix toolbar - stack all buttons */
    .ai-fix-toolbar {
        padding: 0.625rem 0.75rem !important;
        gap: 0.625rem;
    }
    
    .fix-buttons {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .fix-btn {
        padding: 0.5rem 0.625rem !important;
        font-size: 0.72rem !important;
    }
    
    .fix-btn.main-fix {
        padding: 0.5rem 0.75rem !important;
    }
    
    .fix-btn .btn-icon {
        font-size: 0.85rem !important;
    }
    
    .fix-btn .btn-text {
        font-size: 0.72rem !important;
    }
    
    .fix-btn .btn-badge {
        font-size: 0.58rem !important;
        padding: 0.1rem 0.3rem !important;
    }
    
    .spacing-btn {
        width: 34px !important;
        height: 28px !important;
        padding: 0 !important;
        font-size: 0.72rem !important;
    }
    
    /* Formatting toolbar */
    .toolbar-btn {
        min-width: 40px !important;
        height: 40px !important;
        padding: 0.2rem !important;
    }
    
    .btn-hint {
        font-size: 0.58rem;
        margin-top: 0.1rem;
    }
    
    .toolbar-label {
        font-size: 0.6rem;
    }
    
    /* Text editor */
    .text-editor-wrapper {
        min-height: 280px;
    }
    
    .post-editor {
        padding: 0.75rem !important;
        font-size: 0.875rem;
        line-height: 1.5;
        min-height: 280px;
    }
    
    /* Placeholder */
    .placeholder-content {
        padding: 1.5rem 1rem !important;
    }
    
    .placeholder-icon {
        font-size: 2.5rem;
    }
    
    .placeholder-title {
        font-size: 1rem;
    }
    
    .placeholder-subtitle {
        font-size: 0.85rem;
    }
    
    .placeholder-steps {
        flex-direction: column;
        gap: 0.625rem;
    }
    
    /* Preview tabs */
    .tab-content {
        padding: 0.625rem !important;
    }
    
    .preview-tab {
        font-size: 0.75rem;
        padding: 0.625rem 0.5rem !important;
    }
    
    /* LinkedIn preview */
    .linkedin-preview {
        font-size: 0.85rem;
    }
    
    .preview-content {
        font-size: 0.8rem;
        max-height: 200px;
        padding: 0 0.625rem 0.625rem !important;
    }
    
    .preview-header {
        padding: 0.625rem !important;
    }
    
    .preview-avatar {
        width: 40px;
        height: 40px;
    }
    
    /* Quick stats */
    .quick-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .stat-item {
        padding: 0.5rem !important;
    }
    
    .stat-icon {
        font-size: 0.9rem;
    }
    
    .stat-label {
        font-size: 0.65rem;
    }
    
    .stat-value {
        font-size: 0.85rem;
    }
}

/* Phones */
@media (max-width: 600px) {
    /* Header */
    .editor-header {
        padding: 0.5rem 0.625rem !important;
    }
    
    .editor-title {
        font-size: 0.875rem;
    }
    
    .linkedin-icon {
        width: 18px;
        height: 18px;
    }
    
    .help-btn {
        width: 28px !important;
        height: 28px !important;
        padding: 0 !important;
    }

    /* Editor footer - stack completely */
    .editor-footer {
        flex-direction: column;
        gap: 0.625rem;
        align-items: stretch;
        padding: 0.5rem 0.625rem !important;
    }

    .footer-left {
        width: 100%;
        justify-content: space-between;
        flex-wrap: nowrap;
    }
    
    .footer-right {
        width: 100%;
        justify-content: stretch;
        gap: 0.5rem;
        display: flex;
    }
    
    .footer-btn {
        flex: 1;
        justify-content: center;
        padding: 0.5rem 0.375rem !important;
        font-size: 0.72rem !important;
    }
    
    .footer-btn svg {
        width: 12px;
        height: 12px;
    }

    /* AI fix toolbar */
    .ai-fix-toolbar {
        padding: 0.5rem 0.625rem !important;
        gap: 0.5rem;
    }
    
    .fix-label {
        font-size: 0.8rem !important;
    }
    
    .fix-icon {
        font-size: 0.9rem !important;
    }
    
    .fix-btn {
        padding: 0.5rem !important;
        font-size: 0.7rem !important;
    }
    
    .fix-btn.main-fix {
        padding: 0.5rem 0.625rem !important;
    }
    
    .btn-icon {
        font-size: 0.8rem !important;
    }
    
    .btn-text {
        font-size: 0.7rem !important;
    }
    
    .btn-badge {
        font-size: 0.55rem !important;
        padding: 0.1rem 0.25rem !important;
    }
    
    .spacing-control {
        flex-direction: row;
        width: 100%;
        justify-content: center;
    }
    
    .spacing-control label {
        font-size: 0.72rem;
    }
    
    .spacing-btn {
        width: 32px !important;
        height: 26px !important;
        font-size: 0.7rem !important;
        padding: 0 !important;
    }

    /* Formatting toolbar */
    .formatting-toolbar {
        padding: 0.4rem 0.5rem !important;
        gap: 0.375rem;
    }
    
    .toolbar-btn {
        min-width: 36px !important;
        height: 36px !important;
        font-size: 0.95rem;
        padding: 0.2rem !important;
    }
    
    .btn-hint {
        font-size: 0.52rem;
    }
    
    .toolbar-divider {
        height: 40px;
        margin: 0 0.25rem;
    }

    /* Text editor */
    .text-editor-wrapper {
        min-height: 250px;
    }
    
    .post-editor {
        padding: 0.625rem !important;
        font-size: 0.85rem;
        min-height: 250px;
    }
    
    /* Placeholder */
    .placeholder-content {
        padding: 1rem !important;
    }
    
    .placeholder-icon {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .placeholder-title {
        font-size: 0.95rem;
    }
    
    .placeholder-subtitle {
        font-size: 0.8rem;
        margin-bottom: 1rem;
    }
    
    .step {
        font-size: 0.8rem;
    }
    
    .step-num {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
    }

    /* Character counter */
    .char-counter {
        font-size: 0.72rem;
    }
    
    .word-counter {
        font-size: 0.72rem;
    }
    
    .char-progress {
        width: 40px;
    }

    /* Preview */
    .preview-wrapper {
        margin-bottom: 0.625rem;
    }
    
    .preview-label {
        font-size: 0.75rem;
        margin-bottom: 0.375rem;
    }
    
    .preview-note {
        font-size: 0.65rem;
    }
    
    .linkedin-preview {
        border-radius: var(--radius-sm);
    }
    
    .preview-content {
        font-size: 0.78rem;
        max-height: 180px;
        padding: 0 0.5rem 0.5rem !important;
    }
    
    .preview-name {
        font-size: 0.8rem;
    }
    
    .preview-headline {
        font-size: 0.68rem;
    }
    
    .preview-time {
        font-size: 0.62rem;
    }
    
    .preview-action-btn {
        font-size: 0.68rem;
        padding: 0.3rem !important;
    }

    /* Quick stats - 2x2 grid */
    .quick-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.375rem;
    }
    
    .stat-item {
        padding: 0.4rem !important;
    }

    /* Analytics */
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .score-circle {
        width: 70px;
        height: 70px;
    }
    
    .score-value {
        font-size: 1.3rem;
    }

    /* Templates */
    .template-categories {
        gap: 0.25rem;
    }
    
    .template-cat {
        font-size: 0.68rem;
        padding: 0.3rem 0.5rem !important;
    }
    
    .template-item {
        padding: 0.625rem !important;
        margin-bottom: 0.375rem;
    }
    
    .template-name {
        font-size: 0.8rem;
    }
    
    .template-preview {
        font-size: 0.68rem;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 0 auto;
    }
    
    .modal-header {
        padding: 0.75rem 0.875rem !important;
    }
    
    .modal-header h3 {
        font-size: 0.95rem;
    }
    
    .modal-body {
        padding: 0.875rem !important;
    }
    
    .modal-label {
        font-size: 0.75rem;
    }
    
    .modal-input,
    .modal-select {
        font-size: 0.85rem;
        padding: 0.625rem !important;
    }
    
    .modal-footer {
        padding: 0.75rem 0.875rem !important;
    }
    
    .modal-btn {
        padding: 0.5rem 0.875rem !important;
        font-size: 0.8rem;
    }

    /* Dropdowns */
    .dropdown-menu {
        max-width: calc(100vw - 2rem);
        left: 50%;
        transform: translateX(-50%);
    }
    
    .emoji-picker {
        width: 260px;
    }
    
    .hook-picker,
    .cta-picker {
        width: 280px;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .emoji-btn {
        width: 32px;
        height: 32px;
        font-size: 1.1rem;
        padding: 0 !important;
    }
    
    .hook-btn,
    .cta-btn {
        padding: 0.5rem !important;
        font-size: 0.8rem;
    }

    /* Shortcuts grid */
    .shortcuts-grid {
        grid-template-columns: 1fr;
    }

    /* Features grid */
    .features-grid {
        grid-template-columns: 1fr;
    }

    /* Steps container */
    .steps-container {
        grid-template-columns: 1fr;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .editor-section {
        padding: 0;
    }
    
    .editor-container {
        border-radius: 0;
        box-shadow: none;
    }
    
    .problem-banner {
        border-radius: 0;
        padding: 0.4rem 0.5rem !important;
    }
    
    .ai-fix-toolbar {
        padding: 0.4rem 0.5rem !important;
        gap: 0.4rem;
    }
    
    .fix-label {
        font-size: 0.75rem !important;
    }
    
    .fix-btn {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.68rem !important;
        width: 90% !important;
    }
    
    .fix-btn.main-fix {
        padding: 0.4rem 0.5rem !important;
    }
    
    .btn-icon {
        font-size: 0.75rem !important;
    }
    
    .btn-text {
        font-size: 0.68rem !important;
    }
    
    .btn-badge {
        font-size: 0.5rem !important;
        padding: 0.08rem 0.2rem !important;
    }
    
    .formatting-toolbar {
        padding: 0.3rem 0.4rem !important;
    }
    
    .toolbar-btn {
        min-width: 34px !important;
        height: 34px !important;
        padding: 0.15rem !important;
    }
    
    .toolbar-label {
        font-size: 0.55rem;
    }
    
    .btn-hint {
        font-size: 0.48rem;
    }
    
    .post-editor {
        padding: 0.5rem !important;
        font-size: 0.82rem;
    }
    
    .footer-btn {
        padding: 0.4rem 0.3rem !important;
        font-size: 0.68rem !important;
        width: 50px !important;
    }
    
    .spacing-btn {
        width: 30px !important;
        height: 24px !important;
        font-size: 0.68rem !important;
    }
}

/* Very small phones */
@media (max-width: 375px) {
    .fix-section {
        font-size: 0.72rem;
    }
    
    .fix-btn {
        padding: 0.35rem 0.4rem !important;
        font-size: 0.65rem !important;
    }
    
    .spacing-control {
        flex-direction: column;
        gap: 0.4rem;
    }
    
    .spacing-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .spacing-btn {
        flex: 1;
        max-width: 50px;
        height: 24px !important;
        padding: 0 !important;
        font-size: 0.65rem !important;
    }
    
    .toolbar-btn {
        min-width: 32px !important;
        height: 32px !important;
        font-size: 0.85rem;
        padding: 0.1rem !important;
    }
    
    .btn-hint {
        font-size: 0.45rem;
    }
    
    .toolbar-divider {
        margin: 0 0.125rem;
        height: 36px;
    }
    
    .footer-btn {
        padding: 0.35rem 0.25rem !important;
        font-size: 0.65rem !important;
    }
}

/* Landscape orientation fixes */
@media (max-width: 900px) and (orientation: landscape) {
    .editor-panel {
        max-height: 75vh;
        min-height: 350px;
    }
    
    .preview-panel {
        max-height: 65vh;
    }
    
    .text-editor-wrapper {
        min-height: 200px;
    }
    
    .post-editor {
        min-height: 200px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .toolbar-btn,
    .action-btn-small,
    .footer-btn,
    .fix-btn,
    .spacing-btn {
        min-height: 40px !important;
    }
    
    .formatting-toolbar {
        -webkit-overflow-scrolling: touch;
    }
}