/* ==========================================================================
   1. GLOBAL FONTS & RESET (The Engine)
   ========================================================================== */
/* ==========================================================================
   LOCAL FONT REGISTRATION (Consolidated & Optimized)
   ========================================================================== */

/* --- INTER (Main Body & Small Caps) --- */
@font-face { font-family: 'Inter'; src: url('/static/fonts/Inter_18pt-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Inter'; src: url('/static/fonts/Inter_18pt-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; }
@font-face { font-family: 'Inter'; src: url('/static/fonts/Inter_18pt-Light.ttf') format('truetype'); font-weight: 300; font-style: normal; }
@font-face { font-family: 'Inter'; src: url('/static/fonts/Inter_18pt-Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; }
@font-face { font-family: 'Inter'; src: url('/static/fonts/Inter_18pt-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; }
@font-face { font-family: 'Inter'; src: url('/static/fonts/Inter_18pt-Black.ttf') format('truetype'); font-weight: 900; font-style: normal; }

/* --- POPPINS (Headings) --- */
@font-face { font-family: 'Poppins'; src: url('/static/fonts/Poppins-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Poppins'; src: url('/static/fonts/Poppins-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; }
@font-face { font-family: 'Poppins'; src: url('/static/fonts/Poppins-Light.ttf') format('truetype'); font-weight: 300; font-style: normal; }
@font-face { font-family: 'Poppins'; src: url('/static/fonts/Poppins-Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; }
@font-face { font-family: 'Poppins'; src: url('/static/fonts/Poppins-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; }
@font-face { font-family: 'Poppins'; src: url('/static/fonts/Poppins-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; }
@font-face { font-family: 'Poppins'; src: url('/static/fonts/Poppins-ExtraBold.ttf') format('truetype'); font-weight: 800; font-style: normal; }
@font-face { font-family: 'Poppins'; src: url('/static/fonts/Poppins-Black.ttf') format('truetype'); font-weight: 900; font-style: normal; }

/* --- MANROPE --- */
@font-face { font-family: 'Manrope'; src: url('/static/fonts/Manrope-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Manrope'; src: url('/static/fonts/Manrope-Light.ttf') format('truetype'); font-weight: 300; font-style: normal; }
@font-face { font-family: 'Manrope'; src: url('/static/fonts/Manrope-Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; }
@font-face { font-family: 'Manrope'; src: url('/static/fonts/Manrope-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; }

/* --- OPEN SANS --- */
@font-face { font-family: 'Open Sans'; src: url('/static/fonts/OpenSans_Condensed-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Open Sans'; src: url('/static/fonts/OpenSans_Condensed-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; }
@font-face { font-family: 'Open Sans'; src: url('/static/fonts/OpenSans_Condensed-Light.ttf') format('truetype'); font-weight: 300; font-style: normal; }
@font-face { font-family: 'Open Sans'; src: url('/static/fonts/OpenSans_Condensed-Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; }
@font-face { font-family: 'Open Sans'; src: url('/static/fonts/OpenSans_SemiCondensed-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; }

/* --- MULTILINGUAL SUPPORT (Localized) --- */
@font-face { font-family: 'Abhaya Libre'; src: url('/static/fonts/AbhayaLibre-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; }
@font-face { font-family: 'Anek Tamil'; src: url('/static/fonts/AnekTamil-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; }

*, *:before, *:after { 
    box-sizing: border-box; 
}

* { 
    margin: 0; 
    padding: 0; 
}

html { 
    font-size: 10pt; 
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #F8FAFC;
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
}

/* --- SHARED UTILITIES --- */
.font-sinhala { font-family: 'Abhaya Libre', serif; }
.font-tamil { font-family: 'Anek Tamil', sans-serif; }
.text-uppercase { text-transform: uppercase; }
.font-bold { font-weight: 700; }
.text-slate { color: #64748b; }
.text-justify { text-align: justify; }
.text-italic { font-style: italic; }

/* ==========================================================================
   2. SHARED WRAPPER (The A4 Paper Shell)
   ========================================================================== */
.pdf-wrapper {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    position: relative;
    background-color: white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: block;
    overflow: visible;
    position: relative;

}

/* Global WeasyPrint Page Setup */
@page {
    size: A4;
    margin: 0;
}



/* ==========================================================================
   3. BUILDER UI COMPONENTS (Web Dashboard Only)
   ========================================================================== */

/* --- BUILDER CARDS --- */
.builder-card {
    background-color: white;
    border: 1px solid #E2E8F0;
    border-radius: 2.5rem;
    overflow: hidden;
    transition: all 0.5s ease;
    border-left: 6px solid #E2E8F0;
    margin-bottom: 1.5rem;
}

.builder-card.active {
    border-color: #BFDBFE;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border-left-color: #2563EB;
}

/* --- TOGGLE SWITCHES (Fixes Double Checkbox) --- */
.toggle-wrapper { 
    position: relative; 
    display: inline-flex; 
    align-items: center;
    width: 48px; 
    height: 24px; 
    cursor: pointer; 
}

/* 🚨 Hides the native blue checkbox 🚨 */
.toggle-wrapper input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track { 
    width: 100%; 
    height: 100%; 
    background-color: #E2E8F0; 
    border-radius: 9999px; 
    transition: all 0.3s ease; 
}

.toggle-dot { 
    position: absolute; 
    left: 3px; 
    top: 3px; 
    background: white; 
    width: 18px; 
    height: 18px; 
    border-radius: 50%; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.toggle-wrapper input:checked + .toggle-track { 
    background-color: #2563EB; 
}

.toggle-wrapper input:checked + .toggle-track .toggle-dot { 
    transform: translateX(24px); 
}

/* --- 🧠 AI SUMMARY BUTTON (State Management) --- */


/* Hide the "Thinking" span by default */
.indicator-progress {
    display: none;
}

/* When HTMX is active (.htmx-request class is added to the button) */
.htmx-request .indicator-label {
    display: none !important; /* Hide 'Generate' text */
}

.htmx-request.indicator-progress, 
.htmx-request .indicator-progress {
    display: inline-flex !important; /* Show 'Thinking' text/spinner */
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   4. PRINT & EXPORT RULES
   ========================================================================== */

/* Hide Builder UI during PDF Generation */
@media print {
    .builder-card, 
    .toggle-wrapper, 
    button, 
    .no-print {
        display: none !important;
    }
}