/* ==========================================
   FREE LEGAL TEMPLATES - MAIN STYLESHEET
   ========================================== */

/* CSS Variables and Reset */
:root {
    /* Colors */
    --color-primary: #1D3557;
    --color-primary-dark: #152A49;
    --color-secondary: #6c757d;
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-danger: #dc3545;

    /* Shared UI tokens */
    --border: rgba(29, 53, 87, 0.1);
    --transition: all 0.2s ease;
    --text-primary: #1D3557;
    --text-secondary: rgba(33, 37, 41, 0.72);
    
    /* Background Colors */
    --color-bg: #f8f9fa;
    --color-bg-dark: #e9ecef;
    --color-panel-bg: #ffffff;
    --color-panel-border: #dee2e6;
    --color-toolbar-bg: #f8f9fa;
    --color-chat-bg: #fafafa;

    /* Marketing theme aliases */
    --primary: var(--color-primary);
    --primary-dark: var(--color-primary-dark);
    --surface: var(--color-panel-bg);
    --surface-2: var(--color-bg);
    
    /* Text Colors */
    --color-text: #212529;
    --color-text-muted: #6c757d;
    --color-text-light: #ffffff;
    
    /* Interactive Elements */
    --color-btn-bg: #ffffff;
    --color-btn-border: #dee2e6;
    --color-btn-hover-bg: #e9ecef;
    --color-link: #457B9D;
    --color-link-hover: #1D3557;
    
    /* Shadows and Effects */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.1);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;
    
    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-modal: 2000;
    --z-tooltip: 3000;
}

/* ==========================================
   HOMEPAGE & MARKETING STYLES
   ========================================== */

/* Navigation */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 48px;
    transition: var(--transition);
}

nav.scrolled {
    box-shadow: var(--shadow-sm);
    background: rgba(255, 255, 255, 0.95);
}

.nav-logo {
    font-family: var(--font-logo);
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
    text-decoration: none;
}

.nav-links {
    margin-left: auto;
    display: flex;
    gap: 40px;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    padding: 8px 0;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-links .nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 999px;
    color: var(--text-secondary);
    line-height: 1;
}

.nav-links .nav-link:hover,
.nav-links .nav-link:focus-visible {
    background: rgba(29, 53, 87, 0.08);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 32px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Main Content */
main {
    margin-top: 72px;
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-text-light);
    padding: var(--spacing-2xl) 48px var(--spacing-xl);
}

footer a {
    color: rgba(255, 255, 255, 0.8);
}

footer a:hover {
    color: #ffffff;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-xl);
    align-items: flex-start;
}

.footer-brand {
    font-family: var(--font-logo);
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
}

.footer-brand-block {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.footer-description {
    font-size: 16px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.75);
    max-width: 320px;
}

.footer-social {
    display: flex;
    gap: var(--spacing-sm);
}

.footer-social-link {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    transition: var(--transition);
}

.footer-social-link:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: transparent;
    transform: translateY(-2px);
}

.footer-links h4,
.footer-contact h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: #ffffff;
}

.footer-links ul,
.footer-contact ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.footer-contact li {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: rgba(255, 255, 255, 0.8);
}

.footer-contact i {
    font-size: 16px;
}

.footer-bottom {
    max-width: 1200px;
    margin: var(--spacing-xl) auto 0;
    text-align: center;
    padding-top: var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--font-size-sm);
}

.footer-bottom p {
    color: #ffffff;
}

/* Hero Section Styles */
.ezel-hero {
    text-align: center;
    padding: 160px 48px 120px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, #0b1f3a 0%, #1c2f4f 45%, #27476f 100%);
    color: rgba(255, 255, 255, 0.92);
}

.ezel-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% -10%, rgba(69, 123, 157, 0.45) 0%, rgba(69, 123, 157, 0) 55%);
    pointer-events: none;
    opacity: 0.8;
}

.ezel-hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(1px 1px at 20px 30px, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 60%),
        radial-gradient(1px 1px at 110px 90px, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 60%),
        radial-gradient(1.5px 1.5px at 180px 140px, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 60%),
        radial-gradient(1px 1px at 260px 40px, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 60%),
        radial-gradient(1.2px 1.2px at 320px 120px, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0) 60%),
        radial-gradient(1px 1px at 400px 60px, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 60%),
        radial-gradient(1.3px 1.3px at 480px 150px, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 60%),
        radial-gradient(1px 1px at 560px 80px, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 60%),
        radial-gradient(1.4px 1.4px at 640px 30px, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 60%);
    background-size: 200px 200px;
    background-repeat: repeat;
    pointer-events: none;
    opacity: 0.7;
}

.ezel-hero-content {
    position: relative;
    z-index: 1;
    max-width: 1000px;
    margin: 0 auto;
}

.ezel-hero h1 {
    font-family: var(--font-logo);
    font-size: 72px;
    font-weight: 700;
    letter-spacing: -2px;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-link) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 24px;
    animation: fadeInUp 0.8s ease;
}

.ezel-hero p {
    font-size: 24px;
    color: rgba(240, 248, 255, 0.88);
    max-width: 680px;
    margin: 0 auto 48px;
    line-height: 1.5;
    animation: fadeInUp 0.8s ease 0.1s both;
}

/* Product sections and other homepage styles... */
.ezel-products {
    padding: 120px 48px;
}

.ezel-products:nth-child(even) {
    background: var(--color-bg-dark, #f8f9fa);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-links { gap: 20px; }
    .footer-content { grid-template-columns: 1fr; gap: 40px; }
    nav { padding: 0 24px; }
}

@media (max-width: 480px) {
    .nav-links .nav-link:not(.btn-primary) { display: none; }
}

/* ==========================================
   END HOMEPAGE STYLES - EDITOR STYLES BELOW
   ========================================== *

/* Dark Mode Variables */
body.dark-mode {
    --color-bg: #121212;
    --color-bg-dark: #1e1e1e;
    --color-panel-bg: #1e1e1e;
    --color-panel-border: #444444;
    --color-toolbar-bg: #2c2c2c;
    --color-text: #e0e0e0;
    --color-text-muted: #9e9e9e;
    --color-btn-bg: #2a2a2a;
    --color-btn-border: #444444;
    --color-btn-hover-bg: #3a3a3a;
    --color-chat-bg: #1e1e1e;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    position: relative;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
    color: var(--color-text);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
    margin-bottom: 1em;
    color: var(--color-text);
}

a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-link-hover);
}

/* Utility Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.hidden {
    display: none !important;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 10px 20px;
    border: 1px solid var(--color-btn-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    background: var(--color-btn-bg);
    color: var(--color-text);
}

.btn:hover {
    background: var(--color-btn-hover-bg);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-text-light);
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: var(--color-text-light);
}

.btn-secondary {
    background: transparent;
    color: var(--color-text);
    border: 2px solid var(--color-panel-border);
    padding: 12px 24px;
    font-size: var(--font-size-base);
    font-weight: 600;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--color-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-1px);
}

.btn-upgrade {
    background: var(--color-primary);
    color: var(--color-text-light);
    border: none;
    padding: 16px 32px;
    font-size: var(--font-size-lg);
    font-weight: 600;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.btn-upgrade:hover {
    transform: translateY(-2px);
    background: var(--color-primary-dark);
    box-shadow: 0 8px 25px rgba(29, 53, 87, 0.4);
}

.btn-upgrade .price {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 400;
    opacity: 0.9;
}

/* ==========================================
   UNIFIED APP INTERFACE - TEMPLATE INFO
   ========================================== */

.template-info-bar {
    background: var(--color-toolbar-bg);
    border-bottom: 1px solid var(--color-panel-border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    font-size: 13px;
    position: relative;
    z-index: 5;
}

.template-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.breadcrumb-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color-link);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}

.breadcrumb-link:hover {
    background: rgba(70, 123, 157, 0.1);
    color: var(--color-link-hover);
}

.breadcrumb-link i {
    font-size: 11px;
}

.breadcrumb-separator {
    color: var(--color-text-muted);
    font-size: 10px;
    opacity: 0.6;
}

.breadcrumb-category,
.breadcrumb-current {
    color: var(--color-text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb-current {
    font-weight: 600;
    max-width: 200px;
    color: var(--color-primary);
}

.template-metadata {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.metadata-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text-muted);
    font-size: 12px;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
    text-decoration: none;
}

.metadata-item:hover {
    background: rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.metadata-item.clickable {
    cursor: pointer;
    position: relative;
}

.metadata-item.clickable:hover {
    background: rgba(70, 123, 157, 0.1);
    border-color: rgba(70, 123, 157, 0.2);
    color: var(--color-link);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.metadata-item.clickable:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.metadata-item.clickable:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.metadata-item i {
    font-size: 11px;
    opacity: 0.8;
}

.jurisdiction-item i {
    color: #28a745;
}

.category-item i {
    color: #6f42c1;
}

.updated-item i {
    color: #fd7e14;
}

.template-info-toggle {
    background: none;
    border: none;
    color: var(--color-text-muted);
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-info-toggle:hover {
    background: var(--color-btn-hover-bg);
    color: var(--color-text);
}

.template-description-panel {
    background: rgba(70, 123, 157, 0.08);
    border-bottom: 1px solid var(--color-panel-border);
    padding: 16px 20px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.description-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.description-content p {
    margin: 0;
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
    flex: 1;
}

.template-tags {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.template-tag {
    background: white;
    color: var(--color-text);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.template-tag:first-child {
    background: #e3f2fd;
    color: #1976d2;
    border-color: #bbdefb;
}

.template-tag:nth-child(2) {
    background: #fff3e0;
    color: #f57c00;
    border-color: #ffcc02;
}

.template-tag:nth-child(3) {
    background: #e8f5e8;
    color: #2e7d32;
    border-color: #a5d6a7;
}

/* ==========================================
   PROFESSIONAL EDITOR STYLES
   ========================================== */

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-panel-bg);
    border: 1px solid var(--color-panel-border);
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.tab-bar {
    display: flex;
    align-items: center;
    background: var(--color-toolbar-bg);
    border-bottom: 1px solid var(--color-panel-border);
    height: 50px;
    padding: 0 12px;
    flex-shrink: 0;
    gap: 12px;
    border-top: none;
}

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

.tab-control-btn {
    background: var(--color-btn-bg);
    border: 1px solid var(--color-btn-border);
    color: var(--color-text);
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    transition: all 0.2s;
}

.tab-control-btn:hover {
    background: var(--color-btn-hover-bg);
}

.new-tab-dropdown {
    position: relative;
    display: inline-block;
}

.new-tab-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--color-panel-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-btn-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 220px;
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.new-tab-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.new-tab-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background-color 0.15s;
    color: var(--color-text);
    font-size: 13px;
    border-bottom: 1px solid var(--color-btn-border);
}

.new-tab-menu .menu-item:last-child {
    border-bottom: none;
}

.new-tab-menu .menu-item:hover {
    background: var(--color-btn-hover-bg);
}

.new-tab-menu .menu-item i {
    width: 16px;
    text-align: center;
    font-size: 12px;
    color: var(--color-text-secondary);
}

.menu-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.menu-item-title {
    font-size: 13px;
    color: var(--color-text);
}

.menu-item-subtitle {
    font-size: 11px;
    color: var(--color-text-secondary);
}

.pro-badge {
    margin-left: auto;
    padding: 2px 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 9px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.template-library-modal {
    max-width: 900px;
    width: 90vw;
    max-height: 85vh;
}

.template-modal-content {
    max-height: calc(85vh - 100px);
    overflow-y: auto;
}

.modal-search-box {
    position: relative;
    margin-bottom: 16px;
}

.modal-search-input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    font-size: 14px;
    border: 1px solid var(--color-btn-border);
    border-radius: 8px;
    background: var(--color-btn-bg);
    color: var(--color-text);
    transition: all 0.2s;
}

.modal-search-input:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.modal-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
    pointer-events: none;
}

.modal-filters-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-filter-group {
    flex: 1;
}

.modal-filter-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    border: 1px solid var(--color-btn-border);
    border-radius: 8px;
    background: var(--color-btn-bg);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
}

.modal-filter-select:focus {
    outline: none;
    border-color: #007AFF;
}

.modal-results-info {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-btn-border);
    font-size: 13px;
    color: var(--color-text-secondary);
}

.modal-template-category {
    margin-bottom: 24px;
}

.modal-category-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-category-title i {
    color: var(--color-text-secondary);
}

.modal-category-count {
    margin-left: auto;
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

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

.modal-template-card {
    background: var(--color-btn-bg);
    border: 1px solid var(--color-btn-border);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-template-card:hover {
    background: var(--color-btn-hover-bg);
    border-color: #007AFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.modal-card-header h5 {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
    line-height: 1.3;
    flex: 1;
}

.modal-jurisdiction-tag {
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    font-weight: 500;
}

.modal-jurisdiction-tag.universal {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

.template-category {
    margin-bottom: 24px;
}

.template-category-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.template-category-title i {
    color: var(--color-text-secondary);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.template-card-mini {
    background: var(--color-btn-bg);
    border: 1px solid var(--color-btn-border);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--color-text);
}

.template-card-mini:hover {
    background: var(--color-btn-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.template-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.template-card-header h5 {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text);
    line-height: 1.3;
}

.jurisdiction-tag {
    background: rgba(0, 122, 255, 0.1);
    color: #007AFF;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    font-weight: 500;
}

.template-card-desc {
    font-size: 11px;
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.4;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--color-text-secondary);
}

.loading-spinner i {
    font-size: 24px;
    margin-bottom: 12px;
}

.loading-spinner p {
    margin: 0;
    font-size: 13px;
}

.error-message {
    text-align: center;
    padding: 40px;
    color: var(--color-text-secondary);
}

.error-message i {
    font-size: 32px;
    color: #DC3545;
    margin-bottom: 12px;
}

.error-message p {
    margin: 0;
    font-size: 13px;
}

.tab-container {
    flex: 1;
    display: flex;
    align-items: center;
    overflow-x: auto;
    gap: 4px;
}

.tab {
    display: flex;
    align-items: center;
    background: var(--color-btn-bg);
    border: 1px solid var(--color-btn-border);
    border-radius: 6px 6px 0 0;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    min-width: 140px;
    max-width: 200px;
    transition: all 0.2s;
    position: relative;
    color: var(--color-text);
    animation: tabSlideIn 0.2s ease-out;
}

.tab.active {
    background: var(--color-primary);
    color: var(--color-text-light);
    border-color: var(--color-primary);
}

.tab.unsaved {
    border-left: 3px solid #ffc107;
}

.tab.unsaved.active {
    border-left: 3px solid #fff;
}

.tab-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
    line-height: 1.2;
    min-width: 0;
}

.tab-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s;
    margin-left: auto;
    flex-shrink: 0;
}

.tab:hover .tab-actions {
    opacity: 1;
}

.tab.active .tab-actions {
    opacity: 1;
}

.tab-rename-btn,
.tab-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 3px 4px;
    border-radius: 3px;
    font-size: 11px;
    opacity: 0.7;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.tab-rename-btn:hover,
.tab-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

.tab.active .tab-rename-btn:hover,
.tab.active .tab-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.tab-rename-btn {
    margin-right: 2px;
}

.tab-rename-btn i {
    font-size: 10px;
}

.tab-close i {
    font-size: 9px;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.save-status {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text);
    opacity: 0.6;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    letter-spacing: -0.01em;
}

.save-status.saving {
    color: #007AFF;
    opacity: 1;
}

.save-status.saved {
    color: #34C759;
    opacity: 1;
}

.save-status.unsaved {
    color: #FF9500;
    opacity: 1;
}

#user-menu-btn,
#theme-toggle {
    background: none;
    border: none;
    color: var(--color-text);
    opacity: 0.6;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    font-size: 12px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

#user-menu-btn:hover,
#theme-toggle:hover {
    opacity: 1;
    background: var(--color-btn-hover-bg);
    transform: scale(1.05);
}

#user-menu-btn:active,
#theme-toggle:active {
    transform: scale(0.95);
}

#theme-toggle i {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-mode #theme-toggle i {
    transform: rotate(180deg);
}

.workspace-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

.panel {
    display: flex;
    flex-direction: column;
    background: var(--color-panel-bg);
    position: relative;
    overflow: hidden;
}

.editor-panel {
    flex: 1;
    min-width: 300px;
    border-right: 1px solid var(--color-panel-border);
    overflow: hidden;
}

.editor-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--color-primary) 20%, 
        var(--color-primary) 80%, 
        transparent 100%);
    opacity: 0.3;
    z-index: 1;
}

.chat-panel {
    flex: 0 0 400px;
    background: var(--color-chat-bg);
    border-left: 1px solid var(--color-panel-border);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 250px;
    max-width: 800px;
    width: 400px;
    flex-shrink: 0;
}

.chat-panel.collapsed {
    width: 50px !important;
    min-width: 50px !important;
}

.chat-panel.collapsed .panel-header span:first-child {
    display: none;
}

.chat-panel.collapsed .assistant-tabs,
.chat-panel.collapsed .tab-content-container {
    display: none;
}

.resize-handle {
    width: 6px;
    background: var(--color-panel-border);
    cursor: col-resize;
    flex-shrink: 0;
    transition: background-color 0.1s;
    position: relative;
    z-index: 10;
}

.resize-handle:hover,
.resize-handle:active {
    background: var(--color-primary);
    width: 8px;
}

.panel-header {
    padding: 10px 20px;
    background: var(--color-toolbar-bg);
    border-bottom: 1px solid var(--color-panel-border);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.save-btn {
    background: #34C759;
    border: none;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 590;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    letter-spacing: -0.01em;
    box-shadow: 0 1px 2px rgba(52, 199, 89, 0.2);
}

.save-btn:hover {
    background: #30D158;
    transform: translateY(-0.5px);
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
}

.save-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(52, 199, 89, 0.2);
}

.export-dropdown {
    position: relative;
    display: inline-block;
}

.export-btn {
    background: rgba(0, 122, 255, 0.1);
    border: 1px solid rgba(0, 122, 255, 0.2);
    color: #007AFF;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 590;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    letter-spacing: -0.01em;
}

.export-btn:hover {
    background: rgba(0, 122, 255, 0.15);
    border-color: rgba(0, 122, 255, 0.3);
    transform: translateY(-0.5px);
}

.export-btn:active {
    transform: translateY(0);
    background: rgba(0, 122, 255, 0.08);
}

.export-btn .fa-chevron-down {
    font-size: 9px;
    margin-left: 2px;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.export-dropdown.active .export-btn .fa-chevron-down {
    transform: rotate(180deg);
}

.export-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--color-panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--color-panel-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 160px;
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.export-dropdown.active .export-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.export-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--color-text);
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.1s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
}

.export-option:hover {
    background: var(--color-btn-hover-bg);
}

.export-option:active {
    background: rgba(0, 122, 255, 0.1);
}

.export-option i {
    width: 14px;
    text-align: center;
    font-size: 11px;
}

.export-option .fa-file-word {
    color: #185ABD;
}

.export-option .fa-file-pdf {
    color: #DC3545;
}

.collapse-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text);
    opacity: 0.7;
    padding: 12px 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    flex-shrink: 0;
}

.collapse-btn:hover {
    background: rgba(29, 53, 87, 0.1);
    opacity: 1;
}

#collapse-icon {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-panel.collapsed #collapse-icon {
    transform: rotate(180deg);
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 12px;
    background: var(--color-toolbar-bg);
    border-bottom: 1px solid var(--color-panel-border);
    gap: 4px;
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-right: 12px;
    padding-right: 12px;
    border-right: 1px solid #ddd;
}

.toolbar-group:last-child {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
}

.toolbar-btn {
    background: var(--color-btn-bg);
    border: 1px solid var(--color-btn-border);
    color: var(--color-text);
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    transition: all 0.2s;
    position: relative;
}

.toolbar-btn:hover {
    background: var(--color-btn-hover-bg);
    border-color: var(--color-btn-border);
}

.toolbar-btn.active {
    background: var(--color-primary);
    color: var(--color-text-light);
    border-color: var(--color-primary);
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toolbar-select {
    background: var(--color-btn-bg);
    border: 1px solid var(--color-btn-border);
    color: var(--color-text);
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    min-width: 80px;
    height: 32px;
}

.toolbar-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.pro-badge {
    background: var(--color-primary);
    color: var(--color-text-light);
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 4px;
    position: relative;
    top: -2px;
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-panel-bg);
    min-height: 0;
}

.editor-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
    min-height: 0;
}

.rich-editor {
    min-height: 100%;
    padding: 72px;
    font-family: "Times New Roman", Times, serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-panel-bg);
    outline: none;
    border: none;
    max-width: 8.5in;
    margin: 0 auto;
    text-align: left;
}

.rich-editor p {
    margin-bottom: 16px;
    margin-top: 0;
    text-indent: 0;
}

.rich-editor h1 {
    font-family: "Times New Roman", Times, serif;
    font-size: 20px;
    font-weight: bold;
    margin: 24px 0 16px 0;
    line-height: 1.3;
    text-align: center;
    border-bottom: none;
    padding-bottom: 0;
}

.rich-editor h2 {
    font-family: "Times New Roman", Times, serif;
    font-size: 18px;
    font-weight: bold;
    margin: 20px 0 12px 0;
    text-align: left;
}

.rich-editor h3 {
    font-family: "Times New Roman", Times, serif;
    font-size: 16px;
    font-weight: bold;
    margin: 16px 0 8px 0;
}

.rich-editor h4, .rich-editor h5, .rich-editor h6 {
    font-family: "Times New Roman", Times, serif;
    font-size: 16px;
    font-weight: bold;
    margin: 12px 0 6px 0;
}

.rich-editor ul, .rich-editor ol {
    margin: 16px 0;
    padding-left: 36px;
    line-height: 1.6;
}

.rich-editor li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.rich-editor pre {
    padding: 16px;
    border-radius: 0;
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid #ccc;
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
    line-height: 1.4;
}

.rich-editor code {
    padding: 2px 4px;
    border-radius: 0;
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
}

.rich-editor table {
    border-collapse: collapse;
    width: 100%;
    margin: 20px 0;
    font-family: "Times New Roman", Times, serif;
    font-size: 16px;
}

.rich-editor th {
    font-weight: bold;
    text-align: left;
    padding: 12px;
    border: 1px solid var(--color-panel-border);
}

.rich-editor td {
    padding: 12px;
    border: 1px solid var(--color-panel-border);
    vertical-align: top;
}

.rich-editor blockquote {
    border-left: none;
    padding: 0 36px;
    margin: 20px 0;
    font-style: italic;
    font-family: "Times New Roman", Times, serif;
}

.rich-editor hr {
    border: none;
    border-top: 1px solid #000;
    margin: 32px 0 8px 0;
    width: 300px;
}

.rich-editor a {
    color: #0969da;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.rich-editor a:hover {
    border-bottom-color: #0969da;
}

.rich-editor.locked {
    background-color: #f8f9fa !important;
    opacity: 0.7;
    transition: opacity 0.3s ease;
    cursor: not-allowed !important;
    pointer-events: none;
}

.rich-editor.locked:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(248, 249, 250, 0.8);
    z-index: 10;
    pointer-events: none;
}

.editor-locked-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 8px;
}

.locked-message {
    background: white;
    padding: 32px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.locked-message i {
    font-size: 48px;
    color: #ffc107;
    margin-bottom: 16px;
}

.locked-message h3 {
    margin-bottom: 12px;
    color: #333;
    font-size: 20px;
}

.locked-message p {
    margin-bottom: 20px;
    color: #666;
    line-height: 1.5;
}

.locked-message .btn-primary {
    background: var(--color-primary);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    color: var(--color-text-light);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.locked-message .btn-primary:hover {
    transform: translateY(-2px);
    background: var(--color-primary-dark);
    box-shadow: 0 8px 25px rgba(29, 53, 87, 0.4);
}

.assistant-tabs {
    display: flex;
    background: var(--color-toolbar-bg);
    border-bottom: 1px solid var(--color-panel-border);
    padding: 0;
    flex-shrink: 0;
}

.assistant-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 15px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text);
    opacity: 0.7;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.assistant-tab:hover:not(:disabled) {
    background: rgba(29, 53, 87, 0.1);
    opacity: 1;
}

.assistant-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    background: rgba(29, 53, 87, 0.1);
    opacity: 1;
}

.assistant-tab:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.assistant-tab i {
    font-size: 14px;
}

.coming-soon {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #ffc107;
    color: #fff;
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab-content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    position: relative;
}

.message {
    animation: fadeIn 0.3s ease-out;
    max-width: 90%;
}

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

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

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.message-content p {
    margin: 0 0 12px 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content h1, .message-content h2, .message-content h3, 
.message-content h4, .message-content h5, .message-content h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    color: inherit;
}

.message-content h1:first-child, .message-content h2:first-child, 
.message-content h3:first-child, .message-content h4:first-child,
.message-content h5:first-child, .message-content h6:first-child {
    margin-top: 0;
}

.message-content h1 { font-size: 1.4em; }
.message-content h2 { font-size: 1.3em; }
.message-content h3 { font-size: 1.2em; color: #333; font-weight: 600; }
.message-content h4 { font-size: 1.1em; color: #555; font-weight: 600; }
.message-content h5 { font-size: 1.05em; }
.message-content h6 { font-size: 1em; }

.message-content ul, .message-content ol {
    margin: 8px 0 12px 0;
    padding-left: 20px;
}

.message-content li {
    margin-bottom: 4px;
}

.message-content strong {
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

.message-content .btn-primary {
    background: var(--color-primary);
    border: none;
    color: var(--color-text-light);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.message-content .btn-primary:hover {
    transform: translateY(-1px);
    background: var(--color-primary-dark);
    box-shadow: 0 4px 12px rgba(29, 53, 87, 0.4);
}

.message.user .message-content {
    background: var(--color-primary);
    color: var(--color-text-light);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--color-btn-bg);
    color: var(--color-text);
    border: 1px solid var(--color-panel-border);
    border-bottom-left-radius: 4px;
}

.chat-input-container {
    flex-shrink: 0;
    background: var(--color-panel-bg);
    border-top: 1px solid var(--color-panel-border);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
}

.chat-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: inherit;
    font-size: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    background: white;
    box-sizing: border-box;
}

.chat-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(29, 53, 87, 0.1);
}

.send-button {
    width: 50px;
    height: 50px;
    border: none;
    background: var(--color-primary);
    color: var(--color-text-light);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.send-button:hover {
    background: var(--color-primary-dark);
}

.send-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* ==========================================
   HEADER STYLES
   ========================================== */

.site-header {
    background: var(--color-panel-bg);
    border-bottom: 1px solid var(--color-panel-border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--color-primary);
}

.logo i {
    font-size: var(--font-size-2xl);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: var(--color-btn-hover-bg);
}

.upgrade-link {
    background: var(--color-primary);
    color: var(--color-text-light) !important;
    font-weight: 600;
}

.upgrade-link:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    background: var(--color-primary-dark);
}

/* ==========================================
   HERO SEARCH SECTION
   ========================================== */

.hero-search {
    padding: 64px 0 48px;
    background: var(--color-bg);
}

.search-hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.search-title {
    font-size: 56px;
    font-weight: 700;
    letter-spacing: -0.005em;
    margin-bottom: 8px;
    background: linear-gradient(180deg, #1d1d1f 0%, #86868b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-subtitle {
    font-size: 21px;
    color: var(--color-text-muted);
    margin-bottom: 48px;
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-input-wrapper {
    position: relative;
    background: #f5f5f7;
    border-radius: var(--radius-lg);
    transition: all 0.25s ease;
}

.search-input-wrapper:focus-within {
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1), var(--shadow-lg);
    transform: scale(1.02);
}

.search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 18px 52px 18px 52px;
    background: transparent;
    border: none;
    font-size: 17px;
    font-family: var(--font-family);
    color: var(--color-text);
    outline: none;
}

.search-input::placeholder {
    color: var(--color-text-muted);
}

.search-loading {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
}

.search-loading.active {
    display: block;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #d2d2d7;
    border-top-color: #0071e3;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 10;
}

.search-suggestions.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.suggestions-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.suggestion-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-pill {
    padding: 6px 12px;
    background: #f5f5f7;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.15s ease;
}

.suggestion-pill:hover {
    background: #0071e3;
    color: white;
    transform: scale(1.05);
}

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.16);
    max-height: 400px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 20;
}

.search-results.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.results-container {
    padding: 8px;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.search-result-item:hover {
    background: #f5f5f7;
}

.result-info {
    flex: 1;
}

.result-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 2px;
}

.result-description {
    font-size: 13px;
    color: var(--color-text-muted);
}

.result-badge {
    padding: 4px 8px;
    background: #0071e3;
    color: white;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ==========================================
   COLLECTIONS SECTION
   ========================================== */

.collections {
    padding: 64px 0;
    background: var(--color-bg);
}

.collection {
    margin-bottom: 64px;
}

.collection-header {
    margin-bottom: 32px;
}

.collection-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 4px;
}

.collection-subtitle {
    font-size: 17px;
    color: var(--color-text-muted);
}

.document-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.document-card {
    background: white;
    border: 1px solid #e8e8ed;
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.document-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #0071e3;
    transform: scaleX(0);
    transition: transform 0.25s ease;
}

.document-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border-color: transparent;
}

.document-card:hover::before {
    transform: scaleX(1);
}

.document-icon {
    width: 40px;
    height: 40px;
    background: #f5f5f7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 20px;
    color: #0071e3;
}

.document-name {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--color-text);
}

.document-description {
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.4;
    margin-bottom: 16px;
}

.document-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #d2d2d7;
}

.jurisdiction-tag {
    padding: 4px 8px;
    background: #f5f5f7;
    border-radius: 4px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.browse-all-container {
    text-align: center;
    margin-top: 48px;
}

.browse-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: white;
    border: 1px solid #d2d2d7;
    border-radius: 30px;
    font-size: 17px;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.25s ease;
}

.browse-all-btn:hover {
    background: var(--color-text);
    color: white;
    transform: scale(1.05);
}

.browse-all-btn:hover .btn-icon {
    transform: translateX(4px);
}

.btn-icon {
    transition: transform 0.25s ease;
}

.all-categories {
    padding: 64px 0;
    background: #f5f5f7;
}

.categories-header {
    text-align: center;
    margin-bottom: 48px;
}

.categories-header h2 {
    margin-bottom: 24px;
}

.filter-pills {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-pill {
    padding: 8px 16px;
    background: white;
    border: 1px solid #e8e8ed;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-pill:hover {
    background: #f5f5f7;
}

.filter-pill.active {
    background: var(--color-text);
    color: white;
    border-color: var(--color-text);
}

.categories-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.category-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: all 0.25s ease;
}

.category-section:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.category-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-count {
    font-size: 14px;
    color: var(--color-text-muted);
    font-weight: 400;
}

.template-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-link {
    padding: 8px 0;
    color: var(--color-text);
    font-size: 15px;
    border-bottom: 1px solid #e8e8ed;
    transition: all 0.15s ease;
}

.template-link:last-child {
    border-bottom: none;
}

.template-link:hover {
    color: #0071e3;
    padding-left: 8px;
}

.fab {
    display: none;
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 56px;
    height: 56px;
    background: #0071e3;
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    z-index: 90;
    transition: all 0.25s ease;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.16);
}

.fab:active {
    transform: scale(0.95);
}

.stats-bar {
    background: #f5f5f7;
    border-top: 1px solid #e8e8ed;
    padding: 24px 0;
}

.stats-content {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text);
}

.stat-label {
    display: block;
    font-size: 13px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ==========================================
   MODAL STYLES
   ========================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: var(--spacing-lg);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal {
    background: var(--color-panel-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
    transform: scale(0.9);
    transition: transform 0.25s ease;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.category-modal {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-xl);
    border-bottom: 1px solid var(--color-panel-border);
}

.modal-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.modal-close {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: #f5f5f7;
}

.modal-content {
    padding: var(--spacing-xl);
}

.upgrade-features {
    margin-bottom: var(--spacing-xl);
}

.feature {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--color-panel-border);
}

.feature:last-child {
    border-bottom: none;
}

.feature i {
    font-size: var(--font-size-xl);
    color: var(--color-primary);
    width: 40px;
    text-align: center;
}

.feature h4 {
    margin: 0 0 4px 0;
    font-size: var(--font-size-base);
    font-weight: 600;
}

.feature p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: var(--font-size-sm);
}

.upgrade-cta {
    text-align: center;
}

.already-user {
    margin-top: var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

#email-input {
    padding: var(--spacing-md);
    border: 2px solid var(--color-panel-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    background: var(--color-panel-bg);
    color: var(--color-text);
    transition: border-color 0.2s ease;
    width: 100%;
    margin-bottom: var(--spacing-lg);
}

#email-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Email Modal Enhancements */
.email-modal-description {
    font-size: var(--font-size-base);
    color: var(--color-text);
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
}

.email-input-group {
    position: relative;
    margin-bottom: var(--spacing-lg);
}

.email-input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 15px;
    pointer-events: none;
    line-height: 0;
}

.email-input-group input {
    padding-left: 40px !important;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: var(--spacing-lg);
}

.form-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 500;
    font-size: 14px;
    padding: 9px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.form-actions .btn-secondary {
    background: var(--color-bg);
    border: 2px solid var(--color-panel-border);
    color: var(--color-text);
}

.form-actions .btn-secondary:hover {
    background: var(--color-panel-bg);
    border-color: var(--color-text-muted);
    transform: translateY(-1px);
}

.form-actions .btn-primary {
    background: var(--color-primary);
    border: 2px solid var(--color-primary);
    color: white;
}

.form-actions .btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(29, 53, 87, 0.3);
}

.form-actions .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.email-disclaimer {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-panel-border);
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.email-disclaimer i {
    color: var(--color-primary);
}

/* Email Modal - Clean & Simple (New Version) */
.email-modal-new #email-input {
    padding: 10px 14px;
    border: 2px solid var(--color-panel-border);
    border-radius: 6px;
    font-size: 14px;
    background: var(--color-panel-bg);
    color: var(--color-text);
    transition: all 0.2s ease;
    width: 100%;
    margin-bottom: 14px;
    font-family: inherit;
}

.email-modal-new #email-input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-bg);
}

.email-modal-new #email-input::placeholder {
    color: var(--color-text-muted);
}

.email-modal-new .email-modal-description {
    font-size: 14px;
    color: var(--color-text);
    margin-bottom: 14px;
    line-height: 1.4;
}

.email-modal-new .form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.email-modal-new .form-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 500;
    font-size: 14px;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: 2px solid transparent;
}

.email-modal-new .btn-secondary {
    background: transparent;
    border-color: var(--color-panel-border);
    color: var(--color-text);
}

.email-modal-new .btn-secondary:hover {
    background: var(--color-panel-bg);
    border-color: var(--color-text-muted);
}

.email-modal-new .btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.email-modal-new .btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    box-shadow: 0 4px 12px rgba(29, 53, 87, 0.25);
}

.email-modal-new .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.email-modal-new .email-disclaimer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--color-panel-border);
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.email-modal-new .email-disclaimer i {
    color: var(--color-primary);
    font-size: 14px;
}

/* Upgrade Modal Pitch Styling - Compact */
.upgrade-pitch {
    text-align: left;
}

.upgrade-headline {
    font-size: 15px;
    color: var(--color-text);
    margin-bottom: 10px;
    line-height: 1.3;
}

.upgrade-features {
    list-style: none;
    padding: 0;
    margin: 0 0 10px 0;
}

.upgrade-features li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 5px 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--color-text);
}

.upgrade-features li i {
    color: var(--color-primary);
    font-size: 14px;
    margin-top: 2px;
    flex-shrink: 0;
}

.upgrade-features .feature-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.upgrade-features .feature-text strong {
    color: var(--color-text);
    font-weight: 600;
    font-size: 13px;
}

.upgrade-features .feature-text span {
    color: var(--color-text-muted);
    font-size: 12px;
    line-height: 1.3;
}

.upgrade-cta-text {
    font-size: 12px;
    color: var(--color-text-muted);
    margin: 10px 0 0 0;
    line-height: 1.4;
    font-style: italic;
}

/* ==========================================
   FOOTER STYLES
   ========================================== */

.site-footer {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-text-light);
    padding: var(--spacing-2xl) 0 var(--spacing-xl);
    margin-top: var(--spacing-2xl);
}

.site-footer .footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-xl);
}

.site-footer .footer-bottom {
    max-width: 1200px;
    margin: var(--spacing-xl) auto 0;
    text-align: center;
    padding-top: var(--spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--font-size-sm);
}

/* ==========================================
   LOADING STATES AND PLACEHOLDERS
   ========================================== */

.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px;
    color: var(--color-text-muted);
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e8e8ed;
    border-top-color: #0071e3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-placeholder p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

.error-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--color-danger);
    text-align: center;
    background: rgba(220, 53, 69, 0.05);
    border: 1px solid rgba(220, 53, 69, 0.2);
    border-radius: var(--radius-lg);
}

.error-placeholder button {
    background: var(--color-danger);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
}

.error-placeholder button:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.search-error {
    padding: 24px;
    text-align: center;
}

.no-results {
    padding: 24px;
    text-align: center;
    color: var(--color-text-muted);
}

.no-results p {
    margin-bottom: 8px;
}

.no-results-hint {
    font-size: 13px;
    opacity: 0.8;
}

/* ==========================================
   NOTIFICATIONS
   ========================================== */

.notification {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    padding: 12px 16px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    background: white;
}

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

.notification-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-content i {
    flex-shrink: 0;
}

/* ==========================================
   DARK MODE ADJUSTMENTS
   ========================================== */

body.dark-mode .template-info-bar {
    background: var(--color-toolbar-bg);
    border-bottom-color: var(--color-panel-border);
}

body.dark-mode .metadata-item {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .metadata-item:hover {
    background: rgba(255, 255, 255, 0.12);
}

body.dark-mode .template-description-panel {
    background: rgba(70, 123, 157, 0.15);
}

body.dark-mode .template-tag {
    background: var(--color-panel-bg);
    color: var(--color-text);
    border-color: var(--color-panel-border);
}

body.dark-mode .template-tag:first-child {
    background: rgba(25, 118, 210, 0.2);
    color: #64b5f6;
}

body.dark-mode .template-tag:nth-child(2) {
    background: rgba(245, 124, 0, 0.2);
    color: #ffb74d;
}

body.dark-mode .template-tag:nth-child(3) {
    background: rgba(46, 125, 50, 0.2);
    color: #81c784;
}

body.dark-mode .export-menu {
    background: rgba(30, 30, 30, 0.9);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

body.dark-mode .export-option .fa-file-word {
    color: #4A90E2;
}

body.dark-mode .export-btn {
    background: rgba(10, 132, 255, 0.15);
    border-color: rgba(10, 132, 255, 0.3);
    color: #0A84FF;
}

body.dark-mode .export-btn:hover {
    background: rgba(10, 132, 255, 0.2);
    border-color: rgba(10, 132, 255, 0.4);
}

body.dark-mode .chat-input {
    background: #374151;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .chat-input:focus {
    border-color: #63b3ed;
    box-shadow: 0 0 0 2px rgba(99, 179, 237, 0.1);
}

body.dark-mode .locked-message {
    background: var(--color-panel-bg);
    color: var(--color-text);
}

body.dark-mode .locked-message h3 {
    color: var(--color-text);
}

body.dark-mode .locked-message p {
    color: var(--color-text);
    opacity: 0.8;
}

/* ==========================================
   ANIMATIONS
   ========================================== */

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

@keyframes tabSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes expandDown {
    from {
        opacity: 0;
        transform: translateY(-10px) scaleY(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scaleY(1);
    }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 1200px) {
    .tab-bar {
        gap: 8px;
    }
    .header-controls {
        gap: 8px;
    }
    .chat-panel {
        flex: 0 0 350px;
    }
    .template-info-bar {
        padding: 10px 16px;
    }
    .template-metadata {
        gap: 12px;
    }
    .breadcrumb-current {
        max-width: 150px;
    }
}

@media (max-width: 768px) {
    .search-title {
        font-size: 40px;
    }
    .search-subtitle {
        font-size: 18px;
    }
    .hero-search {
        padding: 48px 0 32px;
    }
    .collection-title {
        font-size: 24px;
    }
    .document-grid {
        grid-template-columns: 1fr;
    }
    .stats-content {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    .filter-pills {
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 8px;
    }
    .categories-container {
        grid-template-columns: 1fr;
    }
    .fab {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .tab {
        min-width: 100px;
        max-width: 150px;
        padding: 6px 8px;
    }
    .tab-actions {
        opacity: 1;
    }
    .tab-bar {
        height: 45px;
        padding: 0 8px;
        gap: 6px;
    }
    .save-status {
        font-size: 10px;
    }
    .header-controls .save-btn,
    .header-controls .export-btn {
        padding: 4px 6px;
        font-size: 10px;
    }
    .header-controls .save-btn span,
    .header-controls .export-btn span {
        display: none;
    }
    .workspace-container {
        flex-direction: column;
    }
    .panel {
        border-right: none;
        border-bottom: 1px solid #ddd;
    }
    .chat-panel {
        border-left: none;
        flex: 1;
        border-top: 1px solid var(--color-panel-border);
    }
    .resize-handle {
        display: none;
    }
    .toolbar {
        flex-wrap: wrap;
    }
    .toolbar-group {
        margin-right: 8px;
        padding-right: 8px;
    }
    .export-menu {
        right: 0;
        left: auto;
    }
    .locked-message {
        margin: 20px;
        padding: 24px;
    }
    .locked-message h3 {
        font-size: 18px;
    }
    .locked-message i {
        font-size: 36px;
    }
    .footer-content {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .header-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    .template-info-bar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
        padding: 12px 16px;
    }
    .template-breadcrumb {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 4px;
    }
    .template-metadata {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    .metadata-item {
        font-size: 11px;
        padding: 3px 6px;
    }
    .breadcrumb-current {
        max-width: none;
    }
    .description-content {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    .template-tags {
        justify-content: center;
        flex-wrap: wrap;
    }
    .updated-item {
        display: none;
    }
    .loading-placeholder {
        padding: 32px;
    }
    .loading-spinner {
        width: 32px;
        height: 32px;
        border-width: 2px;
    }
    .error-placeholder {
        padding: 24px;
        margin: 16px;
    }
}

@media (max-width: 480px) {
    .search-title {
        font-size: 32px;
    }
    .main-nav {
        gap: 16px;
    }
    .nav-link {
        font-size: 14px;
    }
    .rich-editor {
        padding: 24px;
    }
    .template-info-bar {
        padding: 10px 12px;
    }
    .breadcrumb-link span {
        display: none;
    }
    .breadcrumb-category {
        display: none;
    }
    .breadcrumb-separator:first-of-type {
        display: none;
    }
    .metadata-item span {
        display: none;
    }
    .template-info-toggle {
        display: none;
    }
}

/* ==========================================
   SCROLLBAR STYLING
   ========================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .site-header,
    .tab-bar,
    .toolbar,
    .chat-panel,
    .resize-handle,
    .fab,
    .stats-bar,
    .site-footer,
    .template-info-bar {
        display: none !important;
    }
    .workspace-container {
        display: block !important;
    }
}

/* Fullscreen mode styles */
#editor-app.is-fullscreen .template-info-bar,
#editor-app:fullscreen .template-info-bar,
#editor-app:-webkit-full-screen .template-info-bar,
#editor-app:-moz-full-screen .template-info-bar,
#editor-app:-ms-fullscreen .template-info-bar {
    display: none !important;
}

#editor-app.is-fullscreen .template-description-panel,
#editor-app:fullscreen .template-description-panel,
#editor-app:-webkit-full-screen .template-description-panel,
#editor-app:-moz-full-screen .template-description-panel,
#editor-app:-ms-fullscreen .template-description-panel {
    display: none !important;
}

#editor-app.is-fullscreen .workspace-container,
#editor-app:fullscreen .workspace-container,
#editor-app:-webkit-full-screen .workspace-container,
#editor-app:-moz-full-screen .workspace-container,
#editor-app:-ms-fullscreen .workspace-container {
    height: calc(100vh - 60px) !important;
}

/* Fullscreen button styling */
#fullscreen-btn {
    background: var(--color-btn-bg);
    border: 1px solid var(--color-btn-border);
    color: var(--color-text);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: 36px;
    height: 36px;
}

#fullscreen-btn:hover {
    background: var(--color-btn-hover-bg);
    border-color: #007AFF;
    color: #007AFF;
    transform: translateY(-1px);
}

#fullscreen-btn:active {
    transform: translateY(0);
}
    .editor-panel {
        border: none !important;
    }
    .rich-editor {
        padding: 20px !important;
        max-width: none !important;
        margin: 0 !important;
    }
}