/* Dictation Pro - Complete CSS with 50 Templates */
:root {
    --primary: #6C63FF; --primary-dark: #5A52D5; --primary-gradient: linear-gradient(135deg,#6C63FF,#5A52D5);
    --success: #10b981; --error: #ef4444; --warning: #f59e0b; --info: #3b82f6;
    --bg: #f7fafc; --surface: #fff; --text: #2d3748; --text-muted: #718096;
    --border: #e2e8f0; --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,.1); --shadow-lg: 0 10px 15px rgba(0,0,0,.1);
}
.dark-mode { --bg: #1a202c; --surface: #2d3748; --text: #f7fafc; --text-muted: #a0aec0; --border: #4a5568; }

* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: 'Cairo','Inter',sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; transition: background .3s, color .3s; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* Header */
.header { background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; display: flex; justify-content: space-between; align-items: center; height: 64px; }
.logo { display: flex; align-items: center; gap: .75rem; color: var(--text); text-decoration: none; }
.logo-icon { width: 40px; height: 40px; background: var(--primary-gradient); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.25rem; }
.logo-text { font-size: 1.125rem; font-weight: 800; }
.header-actions { display: flex; align-items: center; gap: .75rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem 1rem; border: none; border-radius: 8px; font-size: .875rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: all .2s; font-family: inherit; }
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--primary-gradient); color: #fff; }
.btn-primary:hover { box-shadow: 0 4px 12px rgba(108,99,255,.4); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--error); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: .25rem .625rem; font-size: .75rem; }

/* Dark mode toggle */
.theme-toggle { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text); transition: all .2s; }
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .375rem; color: var(--text); }
.form-control { width: 100%; padding: .625rem .875rem; border: 1px solid var(--border); border-radius: 8px; font-size: .875rem; font-family: inherit; background: var(--surface); color: var(--text); transition: all .15s; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,.1); }
.form-select { width: 100%; padding: .5rem .75rem; border: 1px solid var(--border); border-radius: 8px; font-size: .875rem; background: var(--surface); color: var(--text); cursor: pointer; }

/* Editor */
.editor-card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; border: 1px solid var(--border); }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; padding: .75rem; background: var(--bg); border-bottom: 1px solid var(--border); }
.editor-toolbar select, .editor-toolbar button { padding: .375rem .625rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; font-size: .875rem; transition: all .15s; }
.editor-toolbar button:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.editor-toolbar select:hover { border-color: var(--primary); }
.toolbar-divider { width: 1px; height: 24px; background: var(--border); margin: 0 .25rem; }

/* CRITICAL: Paper area must inherit styles properly */
.paper-area { min-height: 400px; padding: 2rem; outline: none; white-space: pre-wrap; word-wrap: break-word; transition: all .3s; }
.paper-area:empty::before { content: attr(data-placeholder); color: #a0aec0; font-style: italic; }
.paper-area:focus { box-shadow: inset 0 0 0 2px rgba(108,99,255,.1); }

/* Status bar */
.status-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: .625rem 1rem; background: var(--bg); border-top: 1px solid var(--border); font-size: .8125rem; color: var(--text-muted); }
.status-item { display: flex; align-items: center; gap: .375rem; }
.status-item i { color: var(--primary); }

/* Recording */
.recording { border-color: var(--error) !important; box-shadow: 0 0 0 3px rgba(239,68,68,.2) !important; }
.recording-btn { animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); } 50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); } }

/* Template gallery */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .75rem; }
.tpl-card { border: 2px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; transition: all .2s; }
.tpl-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.tpl-card.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,.2); }
.tpl-preview { height: 60px; padding: .5rem; font-size: .75rem; overflow: hidden; }
.tpl-name { padding: .375rem; font-size: .75rem; font-weight: 600; text-align: center; background: var(--surface); color: var(--text); }

/* Admin */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #1a202c; color: #fff; position: fixed; top: 0; bottom: 0; inset-inline-start: 0; overflow-y: auto; z-index: 100; }
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid #2d3748; display: flex; align-items: center; gap: .75rem; }
.sidebar-menu { padding: 1rem 0; }
.sidebar-menu a { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.5rem; color: #a0aec0; text-decoration: none; transition: all .15s; font-size: .875rem; }
.sidebar-menu a:hover { background: #2d3748; color: #fff; text-decoration: none; }
.sidebar-menu a.active { background: var(--primary-gradient); color: #fff; }
.sidebar-menu a i { width: 20px; text-align: center; }
.sidebar-divider { height: 1px; background: #2d3748; margin: .5rem 0; }
.admin-content { flex: 1; margin-inline-start: 250px; padding: 2rem; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--surface); border-radius: 12px; padding: 1.25rem; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 1rem; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.25rem; flex-shrink: 0; }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: .75rem; color: var(--text-muted); }

/* Tables */
.data-table { width: 100%; background: var(--surface); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-md); }
.data-table table { width: 100%; border-collapse: collapse; }
.data-table th { background: var(--bg); padding: .75rem 1rem; text-align: start; font-size: .75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.data-table td { padding: .75rem 1rem; border-top: 1px solid var(--border); font-size: .875rem; }
.data-table tr:hover { background: var(--bg); }

/* Badges */
.badge { display: inline-block; padding: .25rem .625rem; border-radius: 12px; font-size: .75rem; font-weight: 600; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #e9d5ff; color: #581c87; }

/* Flash */
.flash { padding: .875rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .875rem; }
.flash-success { background: #d1fae5; color: #065f46; }
.flash-error { background: #fee2e2; color: #991b1b; }

/* Upload zone */
.upload-zone { border: 2px dashed var(--border); border-radius: 12px; padding: 2rem; text-align: center; cursor: pointer; transition: all .2s; }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: rgba(108,99,255,.05); }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; }
.tab { padding: .75rem 1.25rem; border: none; background: none; cursor: pointer; font-size: .875rem; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: all .15s; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================
   50 TEMPLATES - CSS Classes
   ============================================ */
.tpl-notebook-lined { background:#fff; color:#1a202c; font-family:"Caveat",cursive; font-size:20px; line-height:2.0; background-image:linear-gradient(to bottom,transparent 0%,transparent calc(2em - 1px),#3b82f633 calc(2em - 1px),#3b82f633 2em); background-size:100% 2em; }
.tpl-grid-notebook { background:#fff; color:#1a202c; font-family:"Kalam",cursive; font-size:18px; line-height:1.8; background-image:linear-gradient(to right,#10b98122 1px,transparent 1px),linear-gradient(to bottom,#10b98122 1px,transparent 1px); background-size:20px 20px; }
.tpl-classic-notebook { background:#fffbf0; color:#2d3748; font-family:Georgia,serif; font-size:18px; line-height:1.8; }
.tpl-college-notebook { background:#f0f9ff; color:#0c4a6e; font-family:"Tajawal",sans-serif; font-size:18px; line-height:1.9; background-image:linear-gradient(to bottom,transparent 0%,transparent calc(1.9em - 1px),#0284c733 calc(1.9em - 1px),#0284c733 1.9em); background-size:100% 1.9em; }
.tpl-music-notebook { background:#fff; color:#1a202c; font-family:Georgia,serif; font-size:18px; line-height:1.8; background-image:repeating-linear-gradient(to bottom,transparent 0,transparent 8px,#7c3aed22 8px,#7c3aed22 9px,transparent 9px,transparent 16px,#7c3aed22 16px,#7c3aed22 17px,transparent 17px,transparent 24px,#7c3aed22 24px,#7c3aed22 25px,transparent 25px,transparent 32px,#7c3aed22 32px,#7c3aed22 33px,transparent 33px,transparent 40px,#7c3aed22 40px,#7c3aed22 41px); background-size:100% 40px; }
.tpl-white-paper { background:#fff; color:#000; font-family:Arial,sans-serif; font-size:16px; line-height:1.6; }
.tpl-yellow-paper { background:#fef3c7; color:#451a03; font-family:"Comic Sans MS",cursive; font-size:18px; line-height:1.8; }
.tpl-sepia-paper { background:#f4ecd8; color:#5b4636; font-family:Georgia,serif; font-size:18px; line-height:1.9; }
.tpl-craft-paper { background:#d4a574; color:#3d2817; font-family:"Courier New",monospace; font-size:16px; line-height:1.7; background-image:radial-gradient(rgba(139,69,19,.1) 1px,transparent 1px); background-size:4px 4px; }
.tpl-patchwork-paper { background:#fce7f3; color:#831843; font-family:"Dancing Script",cursive; font-size:18px; line-height:1.9; }
.tpl-dark-mode { background:#1a202c; color:#e2e8f0; font-family:Arial,sans-serif; font-size:18px; line-height:1.8; }
.tpl-neon { background:#0a0a0a; color:#00ff88; font-family:"Courier New",monospace; font-size:18px; line-height:1.8; text-shadow:0 0 5px #00ff88,0 0 10px #00ff88; }
.tpl-glassmorphism { background:rgba(224,231,255,.7); backdrop-filter:blur(10px); color:#1e1b4b; font-family:Arial,sans-serif; font-size:18px; line-height:1.8; border:1px solid rgba(99,102,241,.2); }
.tpl-watercolor { background:linear-gradient(135deg,#fce7f3 0%,#e0e7ff 50%,#fef3c7 100%); color:#831843; font-family:"Sacramento",cursive; font-size:22px; line-height:2.0; }
.tpl-metallic { background:linear-gradient(135deg,#1f2937 0%,#374151 50%,#1f2937 100%); color:#d1d5db; font-family:Georgia,serif; font-size:18px; line-height:1.8; }
.tpl-typewriter { background:#f5f1e8; color:#2d2d2d; font-family:"Courier New",monospace; font-size:14px; line-height:1.6; }
.tpl-crt-screen { background:#0c0c0c; color:#33ff33; font-family:"Courier New",monospace; font-size:16px; line-height:1.5; text-shadow:0 0 2px #33ff33,0 0 5px #33ff3388; }
.tpl-legal-pad { background:#fef9c3; color:#1a202c; font-family:"Times New Roman",serif; font-size:16px; line-height:1.7; background-image:linear-gradient(to bottom,transparent 0%,transparent calc(1.7em - 1px),#dc262633 calc(1.7em - 1px),#dc262633 1.7em); background-size:100% 1.7em; }
.tpl-sticky-notes { background:#fef08a; color:#422006; font-family:"Indie Flower",cursive; font-size:18px; line-height:1.8; box-shadow:2px 2px 8px rgba(0,0,0,.1); }
.tpl-professional { background:#fff; color:#1f2937; font-family:"Trebuchet MS",sans-serif; font-size:16px; line-height:1.7; border-inline-start:4px solid #2563eb; }
/* Nature */
.tpl-forest-green { background:#f0fdf4; color:#14532d; font-family:Georgia,serif; font-size:18px; line-height:1.8; }
.tpl-ocean-blue { background:#f0f9ff; color:#0c4a6e; font-family:Arial,sans-serif; font-size:18px; line-height:1.8; }
.tpl-sunset-orange { background:#fff7ed; color:#7c2d12; font-family:"Trebuchet MS",sans-serif; font-size:18px; line-height:1.8; }
.tpl-lavender { background:#f5f3ff; color:#4c1d95; font-family:Georgia,serif; font-size:18px; line-height:1.8; }
.tpl-mint-green { background:#ecfdf5; color:#064e3b; font-family:Arial,sans-serif; font-size:18px; line-height:1.8; }
/* Artistic */
.tpl-watercolor-splash { background:#fdf2f8; color:#831843; font-family:"Great Vibes",cursive; font-size:24px; line-height:2.0; }
.tpl-oil-painting { background:#451a03; color:#fef3c7; font-family:Georgia,serif; font-size:18px; line-height:1.8; }
.tpl-sketch-paper { background:#fafafa; color:#1a202c; font-family:"Patrick Hand",cursive; font-size:18px; line-height:1.8; background-image:linear-gradient(to right,#73737322 1px,transparent 1px),linear-gradient(to bottom,#73737322 1px,transparent 1px); background-size:20px 20px; }
.tpl-canvas-texture { background:#f5f5dc; color:#2d2d2d; font-family:"Courier New",monospace; font-size:16px; line-height:1.7; }
.tpl-pastel-dream { background:#fce7f3; color:#4a044e; font-family:"Dancing Script",cursive; font-size:20px; line-height:1.9; }
/* Modern */
.tpl-neumorphism { background:#e0e5ec; color:#333; font-family:Arial,sans-serif; font-size:18px; line-height:1.8; box-shadow:inset 5px 5px 10px #b8bcc2,inset -5px -5px 10px #fff; }
.tpl-gradient-flow { background:linear-gradient(135deg,#f0f0f0,#e0e0e0); color:#1a1a2e; font-family:Arial,sans-serif; font-size:18px; line-height:1.8; }
.tpl-cyberpunk { background:#0a0a0a; color:#f0abfc; font-family:"Courier New",monospace; font-size:16px; line-height:1.6; text-shadow:0 0 5px #e879f9; }
.tpl-minimal-dark { background:#18181b; color:#fafafa; font-family:Arial,sans-serif; font-size:18px; line-height:1.8; }
.tpl-frosted-glass { background:rgba(255,255,255,.7); backdrop-filter:blur(15px); color:#1e293b; font-family:Arial,sans-serif; font-size:18px; line-height:1.8; }
/* Classic */
.tpl-vintage-paper { background:#f4ecd8; color:#5b4636; font-family:"Times New Roman",serif; font-size:16px; line-height:1.7; }
.tpl-parchment { background:#f7e4c4; color:#3d2817; font-family:Georgia,serif; font-size:18px; line-height:1.8; }
.tpl-old-book { background:#f5f1e8; color:#2d2d2d; font-family:Georgia,serif; font-size:16px; line-height:1.7; }
.tpl-letter-paper { background:#fff; color:#1a202c; font-family:"Times New Roman",serif; font-size:16px; line-height:1.8; background-image:linear-gradient(to bottom,transparent 0%,transparent calc(1.8em - 1px),#3b82f633 calc(1.8em - 1px),#3b82f633 1.8em); background-size:100% 1.8em; }
.tpl-royal-gold { background:#1a1a1a; color:#fbbf24; font-family:Georgia,serif; font-size:18px; line-height:1.8; text-shadow:0 1px 0 #f59e0b44; }
/* Specialized */
.tpl-coding-dark { background:#1e1e1e; color:#d4d4d4; font-family:"Courier New",monospace; font-size:14px; line-height:1.5; }
.tpl-terminal-green { background:#000; color:#0f0; font-family:"Courier New",monospace; font-size:14px; line-height:1.5; }
.tpl-newspaper { background:#f5f5f5; color:#1a1a1a; font-family:"Times New Roman",serif; font-size:14px; line-height:1.6; }
.tpl-magazine { background:#fff; color:#1a1a1a; font-family:"Trebuchet MS",sans-serif; font-size:16px; line-height:1.7; }
.tpl-storyboard { background:#fff; color:#1a1a1a; font-family:Arial,sans-serif; font-size:16px; line-height:1.7; background-image:linear-gradient(to right,#3b82f622 1px,transparent 1px),linear-gradient(to bottom,#3b82f622 1px,transparent 1px); background-size:20px 20px; }
/* Comfort */
.tpl-warm-yellow { background:#fef9c3; color:#422006; font-family:"Comic Sans MS",cursive; font-size:18px; line-height:1.8; }
.tpl-soft-pink { background:#fce7f3; color:#831843; font-family:"Dancing Script",cursive; font-size:18px; line-height:1.9; }
.tpl-cool-gray { background:#f3f4f6; color:#1f2937; font-family:Arial,sans-serif; font-size:18px; line-height:1.8; }
.tpl-cream-white { background:#fffbeb; color:#451a03; font-family:Georgia,serif; font-size:18px; line-height:1.8; }
.tpl-eye-care { background:#c7edcc; color:#1a202c; font-family:Arial,sans-serif; font-size:18px; line-height:1.8; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    .sidebar.show { transform: translateX(0); }
    .admin-content { margin-inline-start: 0 !important; padding: 1rem; }
    .editor-toolbar button span { display: none; }
}
