:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #0f172a;
    --accent: #06b6d4;
    --bg-light: #f8fafc;
    --surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --danger: #ef4444;
    --success: #10b981;
    --purple: #8b5cf6;
    --orange: #f97316;
    --sidebar-width: 280px;
    --header-height: 64px;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
    --shadow-md: 0 6px 16px -2px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 20px 40px -8px rgba(0, 0, 0, 0.18);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] {
    --bg-light: #0f172a;
    --surface: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --secondary: #000000;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s;
}

#app-container {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: white;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 100;
    box-shadow: var(--shadow-xl);
}

.brand {
    padding: 28px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(37, 99, 235, 0.05);
}

.logo-img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.brand h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.nav-menu {
    padding: 28px 16px;
    flex: 1;
    overflow-y: auto; /* Allow scrolling if menu items overflow */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

/* Custom scrollbar for webkit */
.nav-menu::-webkit-scrollbar {
    width: 4px;
}
.nav-menu::-webkit-scrollbar-track {
    background: transparent;
}
.nav-menu::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-family: inherit;
    font-size: 1.05rem;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: right;
    margin-bottom: 8px;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #2563eb 0%, #06b6d4 100%);
    transform: scaleY(0);
    transition: transform 0.3s;
}

.nav-item svg {
    width: 22px;
    height: 22px;
    transition: transform 0.3s;
}

.nav-item:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
    transform: translateX(-4px);
}

.nav-item:hover svg {
    transform: scale(1.1);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.9) 0%, rgba(6, 182, 212, 0.9) 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.5);
}

.nav-item.active::before {
    transform: scaleY(1);
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0, 0, 0, 0.2);
}

.theme-toggle-wrapper {
    margin-bottom: 20px;
}

.theme-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
}

.theme-btn:hover {
    background: rgba(255,255,255,0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}

.avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.top-bar {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auto-save-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: var(--success);
    opacity: 0;
    transition: opacity 0.3s;
    padding: 10px 16px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.auto-save-indicator.visible {
    opacity: 1;
}

.auto-save-indicator.saving {
    color: var(--accent);
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.2);
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px;
    border-radius: 10px;
    color: var(--text-muted);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.icon-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    background: var(--bg-light);
    opacity: 0;
    transition: opacity 0.3s;
}

.icon-btn:hover::before {
    opacity: 1;
}

.icon-btn:hover {
    color: var(--primary);
    transform: translateY(-2px);
}

.icon-btn svg {
    width: 22px;
    height: 22px;
    position: relative;
    z-index: 1;
}

#page-title {
    font-size: 1.4rem;
    margin: 0;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-main) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Views */
.view {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    animation: fadeIn 0.4s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Search Bar */
.search-bar {
    position: relative;
    margin-bottom: 32px;
}

.search-bar i {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 20px;
    height: 20px;
}

.search-bar input {
    width: 100%;
    padding: 16px 56px 16px 20px;
    border: 2px solid var(--border);
    border-radius: 14px;
    font-family: inherit;
    font-size: 1.05rem;
    background: var(--surface);
    color: var(--text-main);
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), var(--shadow-md);
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--surface);
    padding: 28px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid var(--border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    position: relative;
    z-index: 1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.bg-blue { background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%); }
.bg-green { background: linear-gradient(135deg, #10b981 0%, #34d399 100%); }
.bg-purple { background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%); }
.bg-orange { background: linear-gradient(135deg, #f97316 0%, #fb923c 100%); }

.stat-info {
    position: relative;
    z-index: 1;
}

.stat-info h3 { 
    margin: 0 0 8px 0; 
    font-size: 0.95rem; 
    color: var(--text-muted); 
    font-weight: 600;
    letter-spacing: 0.3px;
}

.stat-info p { 
    margin: 0; 
    font-size: 1.8rem; 
    font-weight: 800; 
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.secondary-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: none;
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
    font-weight: 500;
}

.secondary-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
    transform: translateY(-2px);
}

.documents-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.doc-item {
    background: var(--surface);
    padding: 22px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.doc-item::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #2563eb 0%, #06b6d4 100%);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.doc-item:hover {
    transform: translateX(-8px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.doc-item:hover::before {
    transform: scaleX(1);
}

.doc-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    cursor: pointer;
}

.doc-title { 
    font-weight: 700; 
    font-size: 1.1rem;
}

.doc-date { 
    font-size: 0.9rem; 
    color: var(--text-muted);
}

.doc-stats {
    display: flex;
    gap: 20px;
    font-size: 0.95rem;
}

.doc-words {
    color: var(--primary);
    font-weight: 700;
}

.doc-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s;
}

.doc-item:hover .doc-actions {
    opacity: 1;
}

.doc-action-btn {
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s;
}

.doc-action-btn.danger:hover {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.empty-state {
    text-align: center;
    padding: 100px 20px;
    color: var(--text-muted);
}

.empty-state i {
    width: 96px;
    height: 96px;
    margin-bottom: 24px;
    opacity: 0.4;
}

/* Recorder */
.recorder-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 40px;
}

.visualizer-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 240px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 28px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 12px 48px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
}

canvas {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.7;
}

.timer {
    font-size: 4rem;
    font-weight: 800;
    z-index: 2;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.status-text {
    z-index: 2;
    color: var(--accent);
    margin-top: 16px;
    font-size: 1.1rem;
    font-weight: 500;
}

.controls {
    display: flex;
    gap: 28px;
    align-items: center;
}

.record-btn, .stop-btn, .pause-btn {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.record-btn svg, .stop-btn svg, .pause-btn svg {
    width: 36px;
    height: 36px;
}

.record-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 12px 32px rgba(239, 68, 68, 0.5);
}

.record-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 16px 40px rgba(239, 68, 68, 0.6);
}

.record-btn.recording {
    animation: pulse 1.8s infinite;
}

.stop-btn, .pause-btn {
    background: var(--text-muted);
    color: white;
}

.stop-btn:not(:disabled), .pause-btn:not(:disabled) {
    background: var(--text-main);
}

.pause-btn:not(:disabled) {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
}

.stop-btn:not(:disabled):hover, .pause-btn:not(:disabled):hover {
    transform: scale(1.08);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8); }
    70% { box-shadow: 0 0 0 24px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.live-preview-box {
    width: 100%;
    max-width: 700px;
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    border: 2px solid var(--border);
    min-height: 120px;
    max-height: 180px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.streaming-text {
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.8;
    font-size: 1.05rem;
}

/* Settings Toggles */
.settings-toggles {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle input { display: none; }
.slider {
    width: 52px;
    height: 28px;
    background: #cbd5e1;
    border-radius: 14px;
    position: relative;
    transition: .4s;
}

.slider:before {
    content: "";
    position: absolute;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: .4s;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
}

.toggle input:checked + .slider { background: var(--primary); }
.toggle input:checked + .slider:before { transform: translateX(24px); }

.label-text {
    font-weight: 600;
    font-size: 1.05rem;
}

/* Upload */
.upload-zone {
    border: 3px dashed var(--border);
    border-radius: 28px;
    height: 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    cursor: pointer;
    transition: all 0.4s;
    position: relative;
    overflow: hidden;
}

.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.03) 0%, rgba(6, 182, 212, 0.03) 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.upload-zone:hover::before {
    opacity: 1;
}

[data-theme="dark"] .upload-zone:hover {
    background: rgba(37, 99, 235, 0.12);
}

.upload-icon {
    width: 84px;
    height: 84px;
    color: var(--primary);
    margin-bottom: 28px;
    position: relative;
    z-index: 1;
}

.processing-ui {
    margin-top: 40px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    max-width: 450px;
    height: 12px;
    background: var(--border);
    border-radius: 6px;
    margin: 24px auto;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb 0%, #06b6d4 100%);
    width: 0%;
    transition: width 0.4s;
    border-radius: 6px;
    box-shadow: 0 0 12px rgba(37, 99, 235, 0.5);
}

.loader-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid var(--bg-light);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Editor */
.editor-toolbar {
    background: var(--surface);
    padding: 18px;
    border-radius: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 24px;
    justify-content: space-between;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-md);
}

.ai-actions, .export-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.ai-btn {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    color: var(--primary-dark);
    border: 2px solid #bae6fd;
    padding: 12px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    transition: all 0.3s;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.ai-btn svg {
    width: 20px;
    height: 20px;
}

[data-theme="dark"] .ai-btn {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.25) 0%, rgba(37, 99, 235, 0.15) 100%);
    color: var(--accent);
    border-color: rgba(37, 99, 235, 0.4);
}

.ai-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.ai-btn.outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-main);
}

.ai-btn.outline:hover {
    background: var(--bg-light);
    border-color: var(--primary);
}

.editor-wrapper {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    padding: 28px;
    border-radius: 16px;
    min-height: 520px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.08);
}

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

.paper {
    background: white;
    min-height: 520px;
    padding: 56px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
    outline: none;
    line-height: 2;
    font-size: 1.15rem;
    color: #1e293b;
    border-radius: 12px;
}

[data-theme="dark"] .paper {
    background: var(--surface);
    color: var(--text-main);
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--surface);
    min-width: 200px;
    box-shadow: var(--shadow-xl);
    z-index: 1;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--border);
    top: 100%;
    margin-top: 6px;
    max-height: 400px;
    overflow-y: auto;
}

.dropdown:hover .dropdown-content,
.dropdown:focus-within .dropdown-content,
.dropdown-content:hover { 
    display: block; 
}

.dropdown-content a {
    color: var(--text-main);
    padding: 16px 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
    font-weight: 500;
}

.dropdown-content a:hover { 
    background-color: var(--bg-light); 
    color: var(--primary);
}

/* AI Overlay */
.ai-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.97);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    backdrop-filter: blur(8px);
}

[data-theme="dark"] .ai-overlay {
    background: rgba(15, 23, 42, 0.97);
}

.ai-spinner {
    width: 64px;
    height: 64px;
    border: 5px solid var(--border);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.modal-content {
    background: var(--surface);
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,0.4);
    border: 1px solid var(--border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px;
    border-bottom: 2px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 8px;
    display: flex;
    border-radius: 8px;
    transition: all 0.3s;
}

.close-modal:hover {
    color: var(--text-main);
    background: var(--bg-light);
    transform: scale(1.1);
}

.shortcuts-list {
    padding: 28px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}

.shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-key {
    background: var(--bg-light);
    padding: 10px 18px;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    border: 2px solid var(--border);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.hidden { display: none !important; }

/* Editor Stats */
.editor-stats {
    background: var(--surface);
    padding: 14px 28px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.word-count {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Export Menu Modal */
.export-menu {
    padding: 28px;
}

.export-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.export-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: var(--surface);
    border: 3px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.export-option:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.export-option svg {
    width: 36px;
    height: 36px;
    color: var(--primary);
}

.export-option span {
    font-weight: 600;
    font-size: 1rem;
}

/* Share Modal Styles */
.share-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: var(--surface);
    border: 3px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
}

.share-btn:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(6, 182, 212, 0.08) 100%);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.share-btn svg {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.share-link-box {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid var(--border);
}

.share-link-box input {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text-main);
}

.share-link-box input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Find & Replace Modal */
.find-replace-inputs {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group label {
    font-weight: 600;
    font-size: 1rem;
}

.input-group input {
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 1.05rem;
    background: var(--surface);
    color: var(--text-main);
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.find-replace-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.primary-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
    font-weight: 600;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.primary-btn svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    max-height: 62vh;
    overflow-y: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        height: 100%;
        transform: translateX(100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    #mobile-menu-btn { display: block; }

    .paper { padding: 28px; }
    .editor-toolbar { flex-direction: column; }
    .ai-actions { flex-wrap: wrap; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .auto-save-indicator span { display: none; }
    
    .notification {
        left: 15px;
        right: 15px;
        bottom: 15px;
    }
    
    .doc-stats {
        flex-direction: column;
        gap: 5px;
    }
    
    .export-options {
        grid-template-columns: 1fr;
    }
    
    .doc-actions {
        opacity: 1;
    }
    
    .doc-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .doc-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .share-options {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) {
    #mobile-menu-btn { display: none; }
    .sidebar { transform: translateX(0); }
}

/* Version History */
.version-list {
    padding: 28px;
    max-height: 480px;
    overflow-y: auto;
}

.version-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    border-radius: 10px;
}

.version-item:hover {
    background: var(--bg-light);
}

.version-item:last-child {
    border-bottom: none;
}

.version-item div {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.version-item span {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.restore-btn {
    padding: 12px 22px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
    font-weight: 600;
}

.restore-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Notifications */
.notification {
    position: fixed;
    bottom: 32px;
    left: 32px;
    background: var(--surface);
    padding: 18px 26px;
    border-radius: 14px;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 2000;
    transform: translateY(120px);
    opacity: 0;
    transition: all 0.4s ease;
    border: 2px solid var(--border);
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification-success {
    border-left: 5px solid var(--success);
}

.notification-info {
    border-left: 5px solid var(--primary);
}

.notification i {
    color: var(--success);
}

.notification-info i {
    color: var(--primary);
}

.notification svg {
    width: 22px;
    height: 22px;
}

/* Settings Modal Styles */
.settings-content {
    padding: 28px;
    max-height: 68vh;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 2px solid var(--border);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h4 {
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
}

.settings-section h4 svg {
    width: 22px;
    height: 22px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
}

.setting-item span {
    font-weight: 600;
}

.setting-item select {
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    min-width: 180px;
    font-weight: 500;
}

.setting-item select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.toggle-setting {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    cursor: pointer;
    user-select: none;
}

.danger-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 22px;
    background: rgba(239, 68, 68, 0.12);
    border: 2px solid rgba(239, 68, 68, 0.4);
    border-radius: 10px;
    color: var(--danger);
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
    font-weight: 600;
    width: 100%;
    justify-content: center;
}

.danger-btn:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.danger-btn svg {
    width: 20px;
    height: 20px;
}

.faq-item:last-child {
    border-bottom: none;
}

/* Help View Styles */
.help-container {
    max-width: 1100px;
    margin: 0 auto;
}

.help-header {
    text-align: center;
    margin-bottom: 4rem;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
    border-radius: 24px;
    border: 2px solid var(--border);
}

.help-icon-large {
    width: 96px;
    height: 96px;
    background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.4);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.help-icon-large svg {
    width: 48px;
    height: 48px;
    color: white;
}

.help-header h1 {
    font-size: 3rem;
    margin: 0 0 1rem 0;
    background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.help-subtitle {
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1.8;
    max-width: 700px;
    margin: 0 auto;
}

.help-sections {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.help-section {
    background: var(--surface);
    border-radius: 24px;
    padding: 3rem;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.help-section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.help-section:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
    border-color: var(--primary);
}

.help-section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 3px solid var(--bg-light);
    position: relative;
}

.help-section-header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    right: 0;
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
}

.help-section-header svg {
    width: 36px;
    height: 36px;
    color: var(--primary);
    flex-shrink: 0;
}

.help-section-header h2 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--text-main);
    font-weight: 900;
}

.help-content {
    color: var(--text-main);
    line-height: 2;
    position: relative;
}

.help-content > p {
    margin-bottom: 2rem;
    font-size: 1.15rem;
    color: var(--text-muted);
}

.help-steps {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.help-step {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    padding: 2rem;
    background: var(--bg-light);
    border-radius: 18px;
    transition: all 0.3s;
}

.help-step:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(6, 182, 212, 0.05) 100%);
    transform: translateX(-8px);
}

.step-number {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 900;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.step-content {
    flex: 1;
}

.step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(37, 99, 235, 0.12);
    border-radius: 14px;
    margin-bottom: 1rem;
}

.step-icon svg {
    width: 26px;
    height: 26px;
    color: var(--primary);
}

.step-content h3 {
    margin: 0 0 1rem 0;
    font-size: 1.4rem;
    color: var(--text-main);
    font-weight: 800;
}

.step-content p {
    margin: 0;
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1.9;
}

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

.help-feature {
    padding: 2.5rem;
    background: var(--bg-light);
    border-radius: 18px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.help-feature::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.1) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.4s;
    border-radius: 50%;
}

.help-feature:hover::before {
    transform: translate(-50%, -50%) scale(1.5);
}

.help-feature:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    background: white;
}

.help-feature svg {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.help-feature h3 {
    margin: 0 0 0.8rem 0;
    font-size: 1.15rem;
    font-weight: 800;
    position: relative;
    z-index: 1;
}

.help-feature p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.8;
    position: relative;
    z-index: 1;
}

.ai-tools-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ai-tool-item {
    display: flex;
    gap: 1.5rem;
    padding: 2rem;
    background: var(--bg-light);
    border-radius: 16px;
    border-right: 4px solid var(--primary);
    transition: all 0.3s;
}

.ai-tool-item:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(6, 182, 212, 0.05) 100%);
    transform: translateX(-6px);
    box-shadow: var(--shadow-md);
}

.ai-tool-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    background: white;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.ai-tool-icon svg {
    width: 26px;
    height: 26px;
    color: var(--primary);
}

.ai-tool-info {
    flex: 1;
}

.ai-tool-info h3 {
    margin: 0 0 0.8rem 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
}

.ai-tool-info p {
    margin: 0 0 0.6rem 0;
    font-size: 1.05rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.shortcut-hint {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.template-card {
    padding: 2rem 1.5rem;
    background: var(--bg-light);
    border-radius: 16px;
    text-align: center;
    transition: all 0.3s;
    border: 2px solid transparent;
    cursor: pointer;
}

.template-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    background: white;
}

.template-card svg {
    width: 40px;
    height: 40px;
    color: var(--primary);
    margin-bottom: 1rem;
}

.template-card h3 {
    margin: 0 0 0.6rem 0;
    font-size: 1.1rem;
    font-weight: 800;
}

.template-card p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.export-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.export-format {
    display: flex;
    gap: 1.5rem;
    padding: 1.8rem;
    background: var(--bg-light);
    border-radius: 14px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.export-format:hover {
    border-color: var(--primary);
    transform: translateX(-6px);
    background: white;
    box-shadow: var(--shadow-md);
}

.export-format svg {
    width: 40px;
    height: 40px;
    color: var(--primary);
    flex-shrink: 0;
}

.export-format h3 {
    margin: 0 0 0.6rem 0;
    font-size: 1.15rem;
    font-weight: 800;
}

.export-format p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.share-options-help {
    padding: 2.5rem;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(37, 99, 235, 0.08) 100%);
    border-radius: 18px;
    border-right: 6px solid var(--accent);
}

.share-options-help h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
}

.share-options-help h3 svg {
    width: 24px;
    height: 24px;
    color: var(--accent);
}

.share-options-help ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.share-options-help li {
    padding: 1rem 0;
    padding-right: 2.5rem;
    position: relative;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(6, 182, 212, 0.15);
}

.share-options-help li:last-child {
    border-bottom: none;
}

.share-options-help li:before {
    content: "✓";
    position: absolute;
    right: 0;
    color: var(--accent);
    font-weight: bold;
    font-size: 1.3rem;
}

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

.tip-item {
    display: flex;
    gap: 1.5rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.06) 0%, rgba(6, 182, 212, 0.06) 100%);
    border-radius: 16px;
    border-right: 5px solid var(--success);
    transition: all 0.3s;
}

.tip-item:hover {
    transform: translateX(-6px);
    box-shadow: var(--shadow-md);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(6, 182, 212, 0.1) 100%);
}

.tip-item svg {
    width: 28px;
    height: 28px;
    color: var(--success);
    flex-shrink: 0;
    margin-top: 4px;
}

.tip-item h4 {
    margin: 0 0 0.8rem 0;
    font-size: 1.15rem;
    color: var(--text-main);
    font-weight: 800;
}

.tip-item p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.faq-item {
    padding: 2.5rem;
    background: var(--bg-light);
    border-radius: 18px;
    border-right: 6px solid var(--purple);
    transition: all 0.3s;
}

.faq-item:hover {
    transform: translateX(-6px);
    box-shadow: var(--shadow-md);
    background: white;
}

.faq-item h4 {
    margin: 0 0 1.2rem 0;
    font-size: 1.2rem;
    color: var(--text-main);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-weight: 800;
    line-height: 1.6;
}

.faq-item h4:before {
    content: "س:";
    color: var(--purple);
    font-weight: 900;
    flex-shrink: 0;
    font-size: 1.3rem;
}

.faq-item p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.9;
    padding-right: 2.5rem;
    font-size: 1.1rem;
}

/* YouTube Limitation Notice */
.youtube-limitation-notice {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, rgba(245, 158, 11, 0.1) 100%);
    border: 2px solid rgba(245, 158, 11, 0.3);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.notice-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: rgba(245, 158, 11, 0.2);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notice-icon svg {
    width: 26px;
    height: 26px;
    color: #f59e0b;
}

.notice-content h4 {
    margin: 0 0 0.8rem 0;
    color: #f59e0b;
    font-size: 1.15rem;
    font-weight: 800;
}

.notice-content p {
    margin: 0;
    color: var(--text-main);
    line-height: 1.9;
    font-size: 1.05rem;
}

/* Help Footer / Copyright Section */
.help-footer {
    margin-top: 5rem;
    padding-top: 3rem;
    border-top: 3px solid var(--border);
}

.copyright-section {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
    border-radius: 24px;
    border: 2px solid var(--border);
}

.brand-large {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 2.5rem;
}

.footer-logo-large {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.3);
}

.brand-large h2 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.copyright-info {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.copyright-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.developer-credit,
.contact-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1.05rem;
    color: var(--text-muted);
    margin: 0;
}

.developer-credit svg,
.contact-info svg {
    width: 22px;
    height: 22px;
    color: var(--primary);
}

.contact-info a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.contact-info a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Zen Mode */
body.zen-active .sidebar,
body.zen-active .top-bar,
body.zen-active .editor-toolbar,
body.zen-active .editor-stats {
    display: none !important;
}

body.zen-active .main-content {
    height: 100vh;
}

body.zen-active #view-editor {
    padding: 0;
    height: 100vh;
}

body.zen-active .editor-wrapper {
    height: 100vh;
    border-radius: 0;
    padding: 0;
    background: var(--bg-light);
    display: flex;
    justify-content: center;
    overflow-y: auto;
}

body.zen-active .paper {
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 60px 40px;
}

body.zen-active #btn-zen-exit {
    display: block;
}

/* Screen Capture Styles */
.screen-capture-container {
    max-width: 1200px;
    margin: 0 auto;
}

.screen-capture-header {
    text-align: center;
    margin-bottom: 3rem;
}

.screen-capture-icon-large {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.3);
}

.screen-capture-icon-large svg {
    width: 44px;
    height: 44px;
    color: white;
}

.screen-capture-header h2 {
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.screen-capture-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

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

.capture-option-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.capture-option-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

.capture-option-card:hover {
    transform: translateY(-8px);
    border-color: #6366f1;
    box-shadow: var(--shadow-xl);
}

.capture-option-card:hover::before {
    opacity: 1;
}

.capture-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #eff6ff 0%, #e0e7ff 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    position: relative;
    z-index: 1;
}

.capture-icon svg {
    width: 40px;
    height: 40px;
    color: #6366f1;
}

.capture-option-card h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 0 0.8rem 0;
    color: var(--text-main);
    position: relative;
    z-index: 1;
}

.capture-option-card p {
    color: var(--text-muted);
    margin: 0 0 1.5rem 0;
    line-height: 1.7;
    position: relative;
    z-index: 1;
}

.capture-option-card .primary-btn {
    width: 100%;
    position: relative;
    z-index: 1;
}

.screen-capture-preview {
    margin-top: 3rem;
}

.screen-capture-preview.hidden {
    display: none;
}

.preview-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--primary);
}

.capture-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.capture-preview-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.capture-preview-card.full-width {
    grid-column: 1 / -1;
}

.capture-preview-card h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 1.5rem 0;
    color: var(--text-main);
}

.capture-preview-card h4 svg {
    width: 22px;
    height: 22px;
    color: #6366f1;
}

.screen-capture-image-box {
    background: var(--bg-light);
    border-radius: 12px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.screen-capture-image-box img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
}

.screen-capture-text-box {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 1.5rem;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-main);
    white-space: pre-wrap;
}

.screen-capture-analysis-box {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-radius: 12px;
    padding: 2rem;
    line-height: 1.9;
    color: var(--text-main);
}

.screen-capture-analysis-box h5 {
    color: #6366f1;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 1.5rem 0 0.8rem 0;
}

.screen-capture-analysis-box h5:first-child {
    margin-top: 0;
}

.screen-capture-analysis-box ul {
    margin: 0.5rem 0;
    padding-right: 1.5rem;
}

.screen-capture-analysis-box li {
    margin-bottom: 0.5rem;
}

.screen-capture-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .capture-options {
        grid-template-columns: 1fr;
    }
    
    .capture-preview-grid {
        grid-template-columns: 1fr;
    }
    
    .screen-capture-actions {
        flex-direction: column;
    }
}

/* Chat Panel Styles */
.chat-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-float-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.5);
}

.chat-float-btn svg {
    width: 28px;
    height: 28px;
}

.chat-panel {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 99;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chat-panel.hidden {
    display: none;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn-small {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: 0.2s;
}

.icon-btn-small:hover {
    background: rgba(255,255,255,0.3);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--bg-light);
}

.message {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    max-width: 90%;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.ai {
    align-self: flex-start;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    font-size: 0.9rem;
}

.message.ai .msg-avatar {
    background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
}

.message.user .msg-avatar {
    background: linear-gradient(135deg, #475569 0%, #1e293b 100%);
}

.msg-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.message.ai .msg-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    color: var(--text-main);
}

.message.user .msg-content {
    background: #2563eb;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    padding: 16px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-input-area textarea {
    flex: 1;
    border: 2px solid var(--border);
    border-radius: 20px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 0.95rem;
    background: var(--bg-light);
    color: var(--text-main);
    resize: none;
    max-height: 100px;
    min-height: 44px;
    line-height: 20px;
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.chat-input-area button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    flex-shrink: 0;
}

.chat-input-area button:disabled {
    background: var(--text-muted);
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-input-area button:not(:disabled):hover {
    transform: scale(1.1);
}

@media (max-width: 480px) {
    .chat-panel {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}

/* Teleprompter Styles */
.teleprompter-modal {
    background: #000;
    z-index: 9999;
}

.teleprompter-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.teleprompter-scroll-area {
    flex: 1;
    overflow-y: hidden; /* Hidden to prevent manual scroll interfering with auto scroll, or use auto */
    position: relative;
    height: 100%;
    cursor: pointer;
}

.teleprompter-content {
    color: white;
    font-size: 48px;
    font-weight: 700;
    line-height: 1.6;
    text-align: center;
    padding: 50vh 10% 50vh 10%; /* Padding to allow start/end in middle */
    direction: rtl;
    transform-origin: center;
}

.teleprompter-content.mirrored {
    transform: scaleX(-1);
}

.teleprompter-guide {
    position: absolute;
    top: 40%; /* Professional reading line usually around 35-40% down */
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
    opacity: 0.3;
}

.guide-line {
    height: 2px;
    background: red;
    flex: 1;
    margin: 0 10px;
    box-shadow: 0 0 10px red;
}

.guide-arrow-right, .guide-arrow-left {
    color: red;
}

.teleprompter-controls {
    height: 80px;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 0 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transition: opacity 0.3s;
}

.teleprompter-container:hover .teleprompter-controls {
    opacity: 1;
}

.control-icon-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s;
}

.control-icon-btn:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.play-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
    transition: all 0.2s;
}

.play-btn:hover {
    transform: scale(1.1);
}

.play-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.7);
}

.control-group input[type="range"] {
    width: 100px;
    accent-color: var(--primary);
}

/* Responsive for help view */
@media (max-width: 768px) {
    .help-header {
        padding: 2rem 1.5rem;
    }
    
    .help-header h1 {
        font-size: 2.2rem;
    }
    
    .help-subtitle {
        font-size: 1.2rem;
    }
    
    .help-section {
        padding: 2rem 1.5rem;
    }
    
    .help-section-header h2 {
        font-size: 1.5rem;
    }
    
    .help-steps {
        gap: 2rem;
    }
    
    .help-step {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem;
    }
    
    .help-feature-grid,
    .templates-grid,
    .tips-list {
        grid-template-columns: 1fr;
    }
    
    .step-number {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }
    
    .youtube-limitation-notice {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .brand-large {
        flex-direction: column;
        gap: 1rem;
    }
    
    .brand-large h2 {
        font-size: 2rem;
    }
    
    .developer-credit,
    .contact-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .ai-tool-item {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }
    
    .faq-item h4 {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Selection Toolbar */
.selection-toolbar {
    position: fixed;
    z-index: 1000;
    background: var(--secondary);
    color: white;
    padding: 8px;
    border-radius: 12px;
    display: flex;
    gap: 8px;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.2s ease;
}

.sel-btn {
    background: transparent;
    border: none;
    color: white;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
}

.sel-btn:hover {
    background: rgba(255,255,255,0.15);
    color: var(--accent);
}

.sel-btn svg { width: 18px; height: 18px; }

/* Flashcards Styles */
.flashcards-container { max-width: 800px; margin: 0 auto; }
.flashcards-header { text-align: center; margin-bottom: 3rem; }
.flashcards-icon-large {
    width: 80px; height: 80px; background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 20px; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.5rem; box-shadow: 0 12px 32px rgba(245, 158, 11, 0.3); color: white;
}
.flashcards-icon-large svg { width: 44px; height: 44px; }

.flashcard-wrapper {
    perspective: 1000px;
    height: 400px;
    margin-bottom: 32px;
}

.flashcard {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    cursor: pointer;
}

.flashcard.flipped { transform: rotateY(180deg); }

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    text-align: center;
    border-radius: 28px;
    box-shadow: var(--shadow-xl);
    border: 2px solid var(--border);
}

.flashcard-front { background: white; color: var(--text-main); }
.flashcard-back { background: var(--primary); color: white; transform: rotateY(180deg); }

.card-label { font-size: 0.9rem; font-weight: 800; text-transform: uppercase; margin-bottom: 24px; opacity: 0.6; letter-spacing: 1px; }
.card-content { font-size: 1.6rem; font-weight: 700; line-height: 1.6; }

.flashcard-controls { display: flex; align-items: center; justify-content: center; gap: 40px; margin-bottom: 32px; }
.card-counter { font-weight: 800; font-size: 1.2rem; color: var(--text-muted); }
.flashcard-actions { display: flex; justify-content: center; gap: 16px; }

/* Compare Styles */
.compare-container { max-width: 1200px; margin: 0 auto; }
.compare-header { text-align: center; margin-bottom: 3rem; }
.compare-icon-large {
    width: 80px; height: 80px; background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 20px; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.5rem; box-shadow: 0 12px 32px rgba(16, 185, 129, 0.3); color: white;
}
.compare-icon-large svg { width: 44px; height: 44px; }

.compare-selectors {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 20px;
    background: var(--surface);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
    align-items: flex-end;
    margin-bottom: 40px;
}

.select-group label { display: block; margin-bottom: 8px; font-weight: 700; color: var(--text-muted); font-size: 0.9rem; }
.select-group select {
    width: 100%; padding: 12px; border-radius: 10px; border: 2px solid var(--border);
    font-family: inherit; font-size: 1rem; background: var(--bg-light); color: var(--text-main);
}

.compare-results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; animation: fadeIn 0.4s ease; }
.compare-pane { background: var(--surface); border-radius: 16px; border: 1px solid var(--border); overflow: hidden; display: flex; flex-direction: column; }
.pane-header { padding: 16px 24px; background: var(--bg-light); border-bottom: 1px solid var(--border); font-weight: 800; color: var(--primary); }
.pane-content { padding: 24px; font-size: 1.1rem; line-height: 1.8; white-space: pre-wrap; height: 500px; overflow-y: auto; }

.diff-added { background-color: rgba(16, 185, 129, 0.15); color: #065f46; padding: 0 4px; border-radius: 2px; }
.diff-removed { background-color: rgba(239, 68, 68, 0.15); color: #991b1b; text-decoration: line-through; padding: 0 4px; border-radius: 2px; }

@media (max-width: 768px) {
    .compare-selectors { grid-template-columns: 1fr; }
    .compare-results-grid { grid-template-columns: 1fr; }
}

/* Infographic Styles */
.infographic-options-container {
    padding: 40px;
    width: 100%;
    max-width: 900px;
    text-align: center;
    overflow-y: auto;
    max-height: 100%;
}

.styles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.style-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.style-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.style-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(37, 99, 235, 0.1) 100%);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.style-preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.style-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

.style-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* New Additions */
.large-modal {
    max-width: 900px;
    width: 95%;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

.mermaid-wrapper {
    width: 100%;
    height: 100%;
    overflow: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: var(--bg-light);
    border-radius: 12px;
    padding: 40px;
    min-height: 400px;
    /* Technical grid background */
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 20px 20px;
}

[data-theme="dark"] .mermaid-wrapper {
    background-image: radial-gradient(#334155 1px, transparent 1px);
}

.modal-footer {
    padding: 20px 28px;
    border-top: 2px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.custom-textarea {
    width: 100%;
    min-height: 120px;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1.05rem;
    background: var(--surface);
    color: var(--text-main);
    resize: vertical;
}

.custom-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Repurpose Modal Styles */
.repurpose-grid {
    margin-top: 10px;
}

.repurpose-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.repurpose-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.rep-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.rep-icon svg {
    width: 24px;
    height: 24px;
}

.repurpose-card h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.tone-btn {
    padding: 10px;
    border: 2px solid var(--border);
    background: var(--surface);
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
    color: var(--text-muted);
}

.tone-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

.ai-btn#btn-dictation.active {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.repurpose-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Analysis Grid */
.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
}

.analysis-card {
    background: var(--surface);
    padding: 20px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid var(--border);
}

.analysis-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.analysis-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.analysis-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
}

.analysis-full-row {
    grid-column: 1 / -1;
    background: var(--bg-light);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.analysis-full-row h4 {
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag {
    background: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--primary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .tag {
    background: var(--surface);
}

.highlight-box {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
    border-color: rgba(37, 99, 235, 0.2);
}

.progress-bar.small {
    height: 6px;
    margin-top: 10px;
    width: 100%;
}

.shortcut-key {
    background: var(--bg-light);
    padding: 10px 18px;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    border: 2px solid var(--border);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

/* YouTube Import View */
.youtube-import-container {
    max-width: 800px;
    margin: 0 auto;
}

.youtube-header {
    text-align: center;
    margin-bottom: 3rem;
}

.youtube-icon-large {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 12px 32px rgba(255, 0, 0, 0.3);
}

.youtube-icon-large svg {
    width: 44px;
    height: 44px;
    color: white;
}

.youtube-header h2 {
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.youtube-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.youtube-input-section {
    background: var(--surface);
    padding: 2rem;
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.youtube-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 10px;
}

.youtube-input-wrapper i {
    position: absolute;
    left: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

.youtube-input-wrapper input {
    flex: 1;
    padding: 16px 20px 16px 50px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1.05rem;
    background: var(--bg-light);
    color: var(--text-main);
    transition: all 0.3s;
}

.youtube-input-wrapper input:focus {
    outline: none;
    border-color: #ff0000;
    box-shadow: 0 0 0 4px rgba(255, 0, 0, 0.1);
}

.youtube-preview {
    background: var(--surface);
    padding: 2rem;
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.preview-card {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.thumbnail-placeholder {
    width: 320px;
    height: 180px;
    background: var(--bg-light);
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.thumbnail-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.video-details h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.4;
}

.video-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 1rem;
}

.video-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.video-meta svg {
    width: 18px;
    height: 18px;
}

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

.large-btn {
    padding: 18px 32px;
    font-size: 1.15rem;
}

@media (max-width: 768px) {
    .preview-card {
        flex-direction: column;
    }
    
    .thumbnail-placeholder {
        width: 100%;
    }
    
    .youtube-input-wrapper {
        flex-direction: column;
    }
    
    .youtube-input-wrapper input {
        padding: 16px 20px;
    }
    
    .youtube-input-wrapper i {
        display: none;
    }
}

/* File & Image Import Styles */
.file-image-import-container {
    max-width: 1100px;
    margin: 0 auto;
}

.file-image-header {
    text-align: center;
    margin-bottom: 3rem;
}

.file-image-icon-large {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.3);
}

.file-image-icon-large svg {
    width: 44px;
    height: 44px;
    color: white;
}

.file-image-header h2 {
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}

.file-image-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.file-image-upload-zone {
    border: 3px dashed var(--border);
    border-radius: 28px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    cursor: pointer;
    transition: all 0.4s;
    position: relative;
    overflow: hidden;
    padding: 3rem;
}

.file-image-upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.03) 0%, rgba(99, 102, 241, 0.03) 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

.file-image-upload-zone:hover {
    border-color: #8b5cf6;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.file-image-upload-zone:hover::before {
    opacity: 1;
}

.upload-icon-large {
    width: 84px;
    height: 84px;
    color: #8b5cf6;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.file-image-upload-zone h3 {
    font-size: 1.5rem;
    margin: 0 0 0.5rem 0;
    color: var(--text-main);
    position: relative;
    z-index: 1;
}

.file-image-upload-zone p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin: 0.5rem 0;
    position: relative;
    z-index: 1;
}

.supported-formats {
    font-size: 0.95rem !important;
    color: var(--text-muted) !important;
    margin-top: 1rem !important;
}

.file-image-analysis {
    margin-top: 3rem;
}

.analysis-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--primary);
}

.analysis-preview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.analysis-preview-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.analysis-preview-card.full-width {
    grid-column: 1 / -1;
}

.analysis-preview-card h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 1.5rem 0;
    color: var(--text-main);
}

.analysis-preview-card h4 svg {
    width: 22px;
    height: 22px;
    color: #8b5cf6;
}

.file-preview-box {
    background: var(--bg-light);
    border-radius: 12px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.file-preview-box img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
}

.extracted-text-box {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 1.5rem;
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-main);
    white-space: pre-wrap;
}

.ai-analysis-box {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-radius: 12px;
    padding: 2rem;
    line-height: 1.9;
    color: var(--text-main);
}

.ai-analysis-box h5 {
    color: #8b5cf6;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 1.5rem 0 0.8rem 0;
}

.ai-analysis-box h5:first-child {
    margin-top: 0;
}

.ai-analysis-box ul {
    margin: 0.5rem 0;
    padding-right: 1.5rem;
}

.ai-analysis-box li {
    margin-bottom: 0.5rem;
}

.file-image-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

@media (max-width: 768px) {
    .analysis-preview-grid {
        grid-template-columns: 1fr;
    }
    
    .file-image-actions {
        flex-direction: column;
    }
}

/* Support Banner */
.support-banner {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(248, 113, 113, 0.1) 100%);
    border: 2px solid rgba(239, 68, 68, 0.2);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    cursor: pointer;
    transition: all 0.3s;
}

.support-banner:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(248, 113, 113, 0.15) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.banner-icon {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1);
}

.banner-icon svg {
    fill: rgba(239, 68, 68, 0.2);
}

.banner-text h3 {
    margin: 0 0 4px 0;
    color: #b91c1c;
    font-size: 1.1rem;
    font-weight: 800;
}

.banner-text p {
    margin: 0;
    color: #7f1d1d;
    font-size: 0.95rem;
}

.banner-btn {
    background: #ef4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .support-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .banner-btn {
        width: 100%;
    }
}

/* Support Modal Styling */
.donation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 32px;
}

.donation-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.donation-card.coffee {
    background: #FFDD00;
    color: #000;
}

.donation-card.paypal {
    background: #003087;
    color: white;
}

.donation-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.donation-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.donation-card h4 {
    margin: 0 0 4px 0;
    font-weight: 800;
    font-size: 1.1rem;
}

.donation-card p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* BenefitPay Section */
.benefit-section {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
}

.benefit-header {
    background: #a91e23; /* Benefit Color approx */
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.benefit-logo {
    font-weight: 900;
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.benefit-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
}

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

.benefit-qr {
    width: 200px;
    height: 200px;
    object-fit: contain;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px;
    background: white;
}

.qr-caption {
    display: block;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.iban-box {
    width: 100%;
    background: var(--bg-light);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.iban-box label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.iban-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 8px;
}

.iban-display code {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--text-main);
    font-size: 1rem;
    word-break: break-all;
}

/* Dark mode adjustments */
[data-theme="dark"] .benefit-section {
    background: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .benefit-qr {
    background: white;
}

/* App Footer */
.app-footer {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 24px 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.footer-info h3 {
    margin: 0 0 6px 0;
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-info p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.footer-developer {
    text-align: left;
}

.footer-developer .developer-credit,
.footer-developer .contact-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.footer-developer svg {
    width: 22px;
    height: 22px;
    color: var(--primary);
}

.footer-developer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    transition: border-color 0.2s;
}

.footer-developer a:hover {
    border-bottom-color: var(--primary);
}

@media (max-width: 768px) {
    .dashboard-footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .footer-developer {
        text-align: center;
    }
    
    .footer-developer .developer-credit,
    .footer-developer .contact-info {
        justify-content: center;
    }
}

/* Dashboard Footer */
.dashboard-footer {
    margin-top: 60px;
    padding: 40px 0 20px;
    border-top: 2px solid var(--border);
}

.dashboard-footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 32px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.footer-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.footer-info h3 {
    margin: 0 0 6px 0;
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-info p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.footer-developer {
    text-align: left;
}

.footer-developer .developer-credit,
.footer-developer .contact-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.footer-developer svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.footer-developer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
}

.footer-developer a:hover {
    border-bottom-color: var(--primary);
}

@media (max-width: 768px) {
    .dashboard-footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .footer-developer {
        text-align: center;
    }
    
    .footer-developer .developer-credit,
    .footer-developer .contact-info {
        justify-content: center;
    }
}

@media print {
    body { padding: 0; background: white; }
    .doc-container { box-shadow: none; max-width: 100%; border: none; border-radius: 0; }
    .doc-header { background: white; color: black; border-bottom: 3px solid black; padding: 0 0 30px 0; }
    .doc-header::before { display: none; }
    h1.title { color: black; font-size: 28pt; text-shadow: none; }
    .meta-data { color: black; border-color: black; margin-top: 10px; padding-top: 10px; }
    .brand-badge { border: 1px solid black; color: black; background: none; box-shadow: none; padding: 4px 10px; }
    .content { padding: 30px 0; }
    .toc-wrapper { border: 1px solid black; box-shadow: none; }
    .doc-footer { background: white; border-top: 2px solid black; padding: 30px 0; }
    .doc-footer::before { display: none; }
    .footer-link { border: 1px solid black; color: black; box-shadow: none; }
    blockquote { border: 1px solid black; border-right: 4px solid black; background: none; box-shadow: none; }
    
    /* Help page print styles */
    #view-help .sidebar,
    #view-help .top-bar,
    #view-help #print-help-btn {
        display: none !important;
    }
    
    #view-help .help-header {
        background: white;
        color: black;
        border-bottom: 3px solid black;
        padding: 30px 0;
    }
    
    #view-help .help-header::before {
        display: none;
    }
    
    #view-help .help-icon-large {
        background: white;
        border: 2px solid black;
        box-shadow: none;
    }
    
    #view-help .help-section {
        page-break-inside: avoid;
        border: 1px solid #e2e8f0;
        box-shadow: none;
    }
    
    #view-help .help-section::before {
        display: none;
    }
}