/* Docizr Local Fonts - Complete Offline Font Stack */
/* Replaces all Google Fonts CDN dependencies for offline operation */

/* ========================================
   INTER FONT FAMILY - PRIMARY UI FONT
   ======================================== */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('../fonts/inter/inter-300.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/inter/inter-400.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/inter/inter-500.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/inter/inter-600.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/inter/inter-700.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ========================================
   NOTO SANS FONT FAMILY - UNICODE SUPPORT
   ======================================== */

@font-face {
    font-family: 'Noto Sans';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('../fonts/noto-sans/noto-sans-300.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Noto Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/noto-sans/noto-sans-400.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Noto Sans';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../fonts/noto-sans/noto-sans-500.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Noto Sans';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/noto-sans/noto-sans-600.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Noto Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/noto-sans/noto-sans-700.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ========================================
   NOTO COLOR EMOJI - EMOJI SUPPORT
   ======================================== */

@font-face {
    font-family: 'Noto Color Emoji';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/noto-color-emoji/noto-color-emoji.woff2') format('woff2');
    unicode-range: U+1F000-1F02F, U+1F0A0-1F0FF, U+1F100-1F64F, U+1F680-1F6FF, U+1F700-1F77F, U+1F780-1F7FF, U+1F800-1F8FF, U+1F900-1F9FF, U+1FA00-1FA6F, U+1FA70-1FAFF, U+2194-2199, U+21A9-21AA, U+231A-231B, U+2328, U+23CF, U+23E9-23F3, U+23F8-23FA, U+24C2, U+25AA-25AB, U+25B6, U+25C0, U+25FB-25FE, U+2600-2604, U+260E, U+2611, U+2614-2615, U+2618, U+261D, U+2620, U+2622-2623, U+2626, U+262A, U+262E-262F, U+2638-263A, U+2640, U+2642, U+2648-2653, U+2660, U+2663, U+2665-2666, U+2668, U+267B, U+267E-267F, U+2692-2697, U+2699, U+269B-269C, U+26A0-26A1, U+26AA-26AB, U+26B0-26B1, U+26BD-26BE, U+26C4-26C5, U+26C8, U+26CE-26CF, U+26D1, U+26D3-26D4, U+26E9-26EA, U+26F0-26F5, U+26F7-26FA, U+26FD, U+2702, U+2705, U+2708-2709, U+270A-270B, U+270C-270D, U+270F, U+2712, U+2714, U+2716, U+271D, U+2721, U+2728, U+2733-2734, U+2744, U+2747, U+274C, U+274E, U+2753-2755, U+2757, U+2763-2764, U+2795-2797, U+27A1, U+27B0, U+27BF, U+2934-2935, U+2B05-2B07, U+2B1B-2B1C, U+2B50, U+2B55, U+3030, U+303D, U+3297, U+3299;
}

/* ========================================
   NOTO SANS MATH - MATHEMATICAL SYMBOLS
   ======================================== */

@font-face {
    font-family: 'Noto Sans Math';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/noto-sans-math/noto-sans-math.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD, U+1D400-1D7FF, U+2100-214F, U+2190-21FF, U+2200-22FF, U+2300-23FF, U+2460-24FF, U+25A0-25FF, U+2600-26FF, U+2700-27BF, U+2900-297F, U+2980-29FF, U+2A00-2AFF, U+2B00-2BFF;
}

/* ========================================
   NOTO SANS SYMBOLS - TECHNICAL SYMBOLS
   ======================================== */

@font-face {
    font-family: 'Noto Sans Symbols';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/noto-sans-symbols/noto-sans-symbols.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD, U+2190-21FF, U+2200-22FF, U+2300-23FF, U+2400-243F, U+2440-245F, U+2460-24FF, U+25A0-25FF, U+2600-26FF, U+2700-27BF, U+2800-28FF, U+2900-297F, U+2980-29FF, U+2A00-2AFF, U+2B00-2BFF, U+4DC0-4DFF, U+A700-A71F, U+AB30-AB6F, U+FB00-FB4F;
}

/* ========================================
   FIRA CODE - PROGRAMMING LIGATURES FONT (VARIABLE FONT)
   ======================================== */

@font-face {
    font-family: 'Fira Code';
    font-style: normal;
    font-weight: 300 700;  /* Variable font weight range */
    font-display: swap;
    src: url('../fonts/fira-code/fira-code-400.woff2') format('woff2');
    font-variation-settings: 'wght' 400;  /* Default weight */
}

/* ========================================
   CASCADIA CODE - MICROSOFT EDITOR FONT (VARIABLE FONT)
   ======================================== */

@font-face {
    font-family: 'Cascadia Code';
    font-style: normal;
    font-weight: 400 700;  /* Variable font weight range */
    font-display: swap;
    src: url('../fonts/cascadia-code/cascadia-code-400.woff2') format('woff2');
    font-variation-settings: 'wght' 400;  /* Default weight */
}

/* ========================================
   JETBRAINS MONO - CODE EDITOR FONT (VARIABLE FONT)
   ======================================== */

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 300 600;  /* Variable font weight range */
    font-display: swap;
    src: url('../fonts/jetbrains-mono/jetbrains-mono-400.woff2') format('woff2');
    font-variation-settings: 'wght' 400;  /* Default weight */
}

/* ========================================
   SOURCE CODE PRO - ADOBE EDITOR FONT (VARIABLE FONT)
   ======================================== */

@font-face {
    font-family: 'Source Code Pro';
    font-style: normal;
    font-weight: 200 900;  /* Variable font weight range */
    font-display: swap;
    src: url('../fonts/source-code-pro/source-code-pro-400.woff2') format('woff2');
    font-variation-settings: 'wght' 400;  /* Default weight */
}

/* ========================================
   ROBOTO MONO - GOOGLE EDITOR FONT (VARIABLE FONT)
   ======================================== */

@font-face {
    font-family: 'Roboto Mono';
    font-style: normal;
    font-weight: 100 700;  /* Variable font weight range */
    font-display: swap;
    src: url('../fonts/roboto-mono/roboto-mono-400.woff2') format('woff2');
    font-variation-settings: 'wght' 400;  /* Default weight */
}

/* ========================================
   CROSS-PLATFORM FONT STACKS - IMPROVED
   ======================================== */

/* Optimal UI Font Stack with Cross-Platform Support */
:root {
    --font-family-ui: 'Inter', 'system-ui', '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Helvetica Neue', 'Arial', sans-serif;
    --font-family-unicode: 'Noto Sans', 'system-ui', '-apple-system', 'BlinkMacSystemFont', 'Segoe UI', 'Roboto', 'Helvetica Neue', 'Arial', sans-serif;
    
    /* Programming Font Stack with Cross-Platform Fallbacks */
    --font-family-code-modern: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Source Code Pro', 'Roboto Mono', monospace;
    --font-family-code-system: 'Consolas', 'Menlo', 'Monaco', 'Liberation Mono', 'Droid Sans Mono', 'Courier New', monospace;
    --font-family-code-optimal: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Source Code Pro', 'Consolas', 'Menlo', 'Monaco', 'Liberation Mono', 'Droid Sans Mono', 'Courier New', monospace;
    
    /* Specialized Font Stacks */
    --font-family-emoji: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Sans Symbols', sans-serif;
    --font-family-math: 'Noto Sans Math', 'STIX Two Math', 'Latin Modern Math', 'Cambria Math', serif;
    --font-family-symbols: 'Noto Sans Symbols', 'Segoe UI Symbol', 'Arial Unicode MS', sans-serif;
}

/* ========================================
   FONT FEATURE SETTINGS & OPTIMIZATIONS
   ======================================== */

/* Programming Ligatures for Fira Code */
.fira-code-font {
    font-family: 'Fira Code', var(--font-family-code-system);
    font-feature-settings: 'liga' 1, 'calt' 1;
    font-variant-ligatures: contextual;
}

/* Programming Ligatures for Cascadia Code */
.cascadia-code-font {
    font-family: 'Cascadia Code', var(--font-family-code-system);
    font-feature-settings: 'liga' 1, 'calt' 1, 'ss01' 1;
    font-variant-ligatures: contextual;
}

/* Optimized Source Code Pro for readability */
.source-code-pro-font {
    font-family: 'Source Code Pro', var(--font-family-code-system);
    font-feature-settings: 'kern' 1, 'liga' 1;
    font-variant-ligatures: common-ligatures;
}

/* Enhanced rendering for Inter */
.inter-font {
    font-family: 'Inter', var(--font-family-ui);
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    font-variant-numeric: oldstyle-nums;
}

/* Optimized JetBrains Mono for code */
.jetbrains-mono-font {
    font-family: 'JetBrains Mono', var(--font-family-code-system);
    font-feature-settings: 'liga' 1, 'calt' 1;
    font-variant-ligatures: contextual;
}

/* Roboto Mono with system fallbacks */
.roboto-mono-font {
    font-family: 'Roboto Mono', var(--font-family-code-system);
    font-feature-settings: 'kern' 1;
}

/* Monaco Editor Optimal Font Stack */
.monaco-editor-optimal {
    font-family: var(--font-family-code-optimal);
    font-feature-settings: 'liga' 1, 'calt' 1;
    font-variant-ligatures: contextual;
    text-rendering: optimizeLegibility;
}

/* ========================================
   PRELOAD HINTS FOR CRITICAL FONTS
   ======================================== */

/* 
Add these to your HTML head for better performance:

<link rel="preload" href="fonts/inter/inter-400.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="fonts/jetbrains-mono/jetbrains-mono-400.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="fonts/noto-color-emoji/noto-color-emoji.woff2" as="font" type="font/woff2" crossorigin>
*/

/* ========================================
   MONACO EDITOR FONT CLASSES - FOR REAL-TIME SWITCHING
   ======================================== */

/* Individual Font Classes for Monaco Editor with System Fallbacks */
.font-preview-auto {
    font-family: var(--font-family-code-optimal);
    font-feature-settings: 'liga' 1, 'calt' 1;
}

.font-preview-fira-code {
    font-family: 'Fira Code', var(--font-family-code-system);
    font-feature-settings: 'liga' 1, 'calt' 1;
    font-variant-ligatures: contextual;
}

.font-preview-cascadia-code {
    font-family: 'Cascadia Code', var(--font-family-code-system);
    font-feature-settings: 'liga' 1, 'calt' 1, 'ss01' 1;
    font-variant-ligatures: contextual;
}

.font-preview-jetbrains-mono {
    font-family: 'JetBrains Mono', var(--font-family-code-system);
    font-feature-settings: 'liga' 1, 'calt' 1;
    font-variant-ligatures: contextual;
}

.font-preview-source-code-pro {
    font-family: 'Source Code Pro', var(--font-family-code-system);
    font-feature-settings: 'kern' 1, 'liga' 1;
    font-variant-ligatures: common-ligatures;
}

.font-preview-roboto-mono {
    font-family: 'Roboto Mono', var(--font-family-code-system);
    font-feature-settings: 'kern' 1;
}

.font-preview-consolas {
    font-family: 'Consolas', 'Menlo', 'Monaco', var(--font-family-code-system);
}

.font-preview-menlo {
    font-family: 'Menlo', 'Monaco', 'Consolas', var(--font-family-code-system);
}

.font-preview-droid-sans-mono {
    font-family: 'Droid Sans Mono', 'Liberation Mono', var(--font-family-code-system);
}

/* Font Preview Container Styling */
.font-preview {
    background: var(--bs-light);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 0.75rem;
    margin-top: 0.5rem;
    font-size: 12px;
    line-height: 1.4;
}

.font-option-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 13px;
    color: var(--bs-primary);
}

.font-option-sample {
    font-size: 11px;
    line-height: 1.3;
    color: var(--bs-dark);
}

.font-option-sample > div {
    margin-bottom: 2px;
}

/* Dark theme support for font preview */
[data-theme="dark"] .font-preview {
    background: var(--bs-dark);
    border-color: var(--bs-secondary);
}

[data-theme="dark"] .font-option-sample {
    color: var(--bs-light);
}

/* ========================================
   FONT LOADING DETECTION & FALLBACKS
   ======================================== */

/* Ensure fonts are loaded before use */
.font-loading {
    position: relative;
}

.font-loading::before {
    content: "Loading font...";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #666;
}

/* Force font refresh animation */
@keyframes font-refresh {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.font-refresh {
    animation: font-refresh 0.3s ease-in-out;
}

/* ========================================
   MONACO EDITOR SPECIFIC FONT SUPPORT
   ======================================== */

/* Force Monaco Editor to use proper font rendering */
.monaco-editor {
    font-feature-settings: 'liga' 1, 'calt' 1 !important;
    font-variant-ligatures: contextual !important;
}

/* Monaco Editor text content areas - FORCE VARIABLE FONT SUPPORT */
.monaco-editor .view-lines .view-line,
.monaco-editor .view-lines,
.monaco-editor .monaco-editor-background {
    font-feature-settings: inherit !important;
    font-variant-ligatures: inherit !important;
    font-variation-settings: inherit !important;
    font-weight: inherit !important;
}

/* Font-specific Monaco Editor support with system fallbacks */
.monaco-editor[data-font="fira-code"],
.monaco-editor .fira-code-font {
    font-family: 'Fira Code', var(--font-family-code-system) !important;
    font-feature-settings: 'liga' 1, 'calt' 1 !important;
    font-variant-ligatures: contextual !important;
}

.monaco-editor[data-font="cascadia-code"],
.monaco-editor .cascadia-code-font {
    font-family: 'Cascadia Code', var(--font-family-code-system) !important;
    font-feature-settings: 'liga' 1, 'calt' 1, 'ss01' 1 !important;
    font-variant-ligatures: contextual !important;
}

.monaco-editor[data-font="jetbrains-mono"],
.monaco-editor .jetbrains-mono-font {
    font-family: 'JetBrains Mono', var(--font-family-code-system) !important;
    font-feature-settings: 'liga' 1, 'calt' 1 !important;
    font-variant-ligatures: contextual !important;
}

.monaco-editor[data-font="source-code-pro"],
.monaco-editor .source-code-pro-font {
    font-family: 'Source Code Pro', var(--font-family-code-system) !important;
    font-feature-settings: 'kern' 1, 'liga' 1 !important;
    font-variant-ligatures: common-ligatures !important;
}

.monaco-editor[data-font="roboto-mono"],
.monaco-editor .roboto-mono-font {
    font-family: 'Roboto Mono', var(--font-family-code-system) !important;
    font-feature-settings: 'kern' 1 !important;
}

.monaco-editor[data-font="consolas"],
.monaco-editor .consolas-font {
    font-family: 'Consolas', var(--font-family-code-system) !important;
}

.monaco-editor[data-font="menlo"],
.monaco-editor .menlo-font {
    font-family: 'Menlo', 'Monaco', var(--font-family-code-system) !important;
}

/* Variable Font Weight Classes for Monaco Editor */
.monaco-editor.font-weight-300 { font-weight: 300 !important; font-variation-settings: 'wght' 300 !important; }
.monaco-editor.font-weight-400 { font-weight: 400 !important; font-variation-settings: 'wght' 400 !important; }
.monaco-editor.font-weight-500 { font-weight: 500 !important; font-variation-settings: 'wght' 500 !important; }
.monaco-editor.font-weight-600 { font-weight: 600 !important; font-variation-settings: 'wght' 600 !important; }
.monaco-editor.font-weight-700 { font-weight: 700 !important; font-variation-settings: 'wght' 700 !important; }

/* Ensure ligatures work in all Monaco text elements */
.monaco-editor .view-lines .view-line > span {
    font-feature-settings: inherit !important;
    font-variant-ligatures: inherit !important;
    font-variation-settings: inherit !important;
}

/* Programming ligature test styles */
.ligature-test {
    font-family: var(--font-family-code-optimal);
    font-feature-settings: 'liga' 1, 'calt' 1;
    font-variant-ligatures: contextual;
    font-size: 16px;
    line-height: 1.5;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    margin: 10px 0;
}

/* Force Monaco to honor CSS font settings */
.monaco-editor .view-overlay {
    font-family: inherit !important;
    font-weight: inherit !important;
    font-feature-settings: inherit !important;
}

/* Minimap font consistency */
.monaco-editor .minimap .minimap-decorations-layer {
    font-family: inherit !important;
}

/* ========================================
   FONT DEBUGGING & DEVELOPMENT HELPERS
   ======================================== */

/* Development-only font debugging */
.font-debug {
    position: relative;
}

.font-debug::after {
    content: attr(data-font-applied);
    position: absolute;
    top: -20px;
    left: 0;
    font-size: 10px;
    color: #666;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 4px;
    border-radius: 2px;
    border: 1px solid #ccc;
    z-index: 1000;
}