/* Custom Local Handwriting Fonts */
@font-face {
    font-family: 'Nadeznas Handwritting';
    src: url("Nadezna-'s handwriting regular.ttf") format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Zuey Handwriting';
    src: url('ZueyHandwriting-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'LPMQ Isep Misbah';
    src: url('LPMQ-IsepMisbah.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Arabic Handwritten Font';
    src: url('IRDastNevis.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Motken K Tabassom';
    src: url('IRTabassom.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Motken K Kamran';
    src: url('IRKamran.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Motken Unicode Hor';
    src: url('IRElham.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'MRT_Faraz regular';
    src: url('IRFarnaz.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Mikhak light';
    src: url('Mikhak-Light.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Ocean brush arabic';
    src: url('IRElham.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'resalaty arabic';
    src: url('IRTabassom.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'MRT_Nil 2 Regular';
    src: url('IRKamran.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Molhim Regular';
    src: url('IRDastNevis.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'MolsaqArabic-Extra-Light';
    src: url('Mikhak-Light.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Mj_Wafi Regular';
    src: url('IRKamran.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Design System & CSS Variables */
:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: rgba(255, 255, 255, 0.75);
    --bg-card: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --primary-color: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --primary-hover: #4338ca;
    
    --success-color: #10b981;
    --danger-color: #ef4444;
    --accent-color: #06b6d4;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 30px rgba(79, 70, 229, 0.06);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.08);
    --shadow-paper: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    
    --blur-strength: 16px;
    --border-radius-sm: 8px;
    --border-radius-md: 14px;
    --border-radius-lg: 20px;
    
    --font-ui: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --glow-1-color: rgba(79, 70, 229, 0.15);
    --glow-2-color: rgba(6, 182, 212, 0.15);
}

body.dark-theme {
    --bg-primary: #070b13;
    --bg-secondary: rgba(13, 20, 35, 0.65);
    --bg-card: #0f172a;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary-color: #6366f1;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --primary-hover: #4f46e5;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.4);
    --shadow-paper: 0 12px 36px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
    
    --glow-1-color: rgba(99, 102, 241, 0.18);
    --glow-2-color: rgba(139, 92, 246, 0.12);
}

/* Global Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: var(--font-ui);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Glow Background Effects */
.glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.glow-1, .glow-2 {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.8;
    animation: floatGlow 12s infinite alternate ease-in-out;
}

.glow-1 {
    top: -100px;
    right: -100px;
    background-color: var(--glow-1-color);
}

.glow-2 {
    bottom: -150px;
    left: -100px;
    background-color: var(--glow-2-color);
    animation-delay: -6s;
}

@keyframes floatGlow {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(80px, 50px) scale(1.15);
    }
}

/* Header Styling */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2.5rem;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    z-index: 10;
    position: sticky;
    top: 0;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-sm);
    background: var(--primary-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.3rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.logo-text h1 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.logo-text h1 span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, background-color 0.2s;
}

.action-btn:hover {
    transform: scale(1.05);
    background-color: var(--bg-primary);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 30px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.green {
    background-color: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
}

.status-dot.loading {
    background-color: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-color);
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* App Layout Workspace */
.app-workspace {
    flex: 1;
    display: grid;
    grid-template-columns: 420px 1fr;
    height: calc(100vh - 72px - 40px);
    overflow: hidden;
}

/* Left Panel: Scrollable Controls */
.controls-panel {
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    backdrop-filter: blur(var(--blur-strength));
    -webkit-backdrop-filter: blur(var(--blur-strength));
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.controls-panel::-webkit-scrollbar {
    width: 6px;
}
.controls-panel::-webkit-scrollbar-track {
    background: transparent;
}
.controls-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
.controls-panel::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Card Sections */
.panel-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel-section .section-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1.1rem 1.3rem;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0.01);
    border-bottom: 1px solid transparent;
    user-select: none;
}

.panel-section.active .section-header {
    border-bottom-color: var(--border-color);
    background-color: rgba(0, 0, 0, 0.02);
}

.panel-section .section-header .icon {
    font-size: 1.1rem;
    color: var(--primary-color);
    width: 20px;
    text-align: center;
}

.panel-section .section-header h2 {
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
}

.panel-section .section-content {
    padding: 1.3rem;
    display: none;
}

.panel-section.active .section-content {
    display: block;
}

/* Form Controls & Styling */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.1rem;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-group textarea {
    width: 100%;
    height: 180px;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
}

.input-group textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.input-group select, .input-group input[type="text"], .input-group input[type="number"] {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
}

.input-group select:focus, .input-group input[type="text"]:focus, .input-group input[type="number"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Grid helper */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

/* Button UI */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-sm {
    padding: 0.45rem 0.8rem;
    font-size: 0.75rem;
}

.btn-outline {
    background-color: transparent;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-outline-danger {
    background-color: transparent;
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.btn-outline-danger:hover {
    background-color: var(--danger-color);
    color: white;
}

.ai-helper-box {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Accordion Sub (Margins / Randomness) */
.accordion-sub {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-top: 0.8rem;
    overflow: hidden;
}

.accordion-sub-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.9rem;
    background-color: rgba(0,0,0,0.02);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    user-select: none;
}

.accordion-sub-trigger i {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.accordion-sub.open .accordion-sub-trigger i {
    transform: rotate(180deg);
}

.accordion-sub-content {
    padding: 0.9rem;
    display: none;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

.accordion-sub.open .accordion-sub-content {
    display: block;
}

/* Color Picker Custom styling */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    padding: 0.35rem 0.6rem;
    border-radius: var(--border-radius-sm);
}

.color-picker-wrapper input[type="color"] {
    border: none;
    background: none;
    width: 28px;
    height: 28px;
    cursor: pointer;
    padding: 0;
}

.color-picker-wrapper .color-value {
    font-size: 0.8rem;
    font-family: monospace;
    color: var(--text-primary);
    font-weight: 500;
}

/* Slider Controls */
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

.slider-val {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.1);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    margin: 0.5rem 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-gradient);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Ink color selector */
.ink-colors {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    height: 38px;
}

.ink-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
    position: relative;
}

.ink-btn.active {
    border-color: var(--text-primary);
    transform: scale(1.15);
}

.ink-custom-wrapper {
    position: relative;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
}

.ink-custom-wrapper input[type="color"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.ink-custom-wrapper i {
    font-size: 0.75rem;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Align buttons styling */
.align-buttons {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    width: 100%;
}

.align-btn {
    flex: 1;
    padding: 0.6rem 0;
    background-color: var(--bg-primary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.align-btn:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.align-btn:hover {
    background-color: rgba(0,0,0,0.03);
    color: var(--text-primary);
}

.align-btn.active {
    background-color: var(--bg-card);
    color: var(--primary-color);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

/* Header & TTD Inputs containers */
.toggle-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.toggle-label {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Switch styling */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

input:checked + .slider {
    background: var(--primary-gradient);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.header-inputs, .ttd-inputs {
    margin-top: 1rem;
    animation: slideDown 0.3s forwards ease;
}

.hidden {
    display: none !important;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tab button UI */
.tab-buttons {
    display: flex;
    background-color: var(--bg-primary);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 0.45rem 0.5rem;
    border: none;
    background: none;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
}

.tab-btn.active {
    background-color: var(--bg-card);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.tab-content {
    display: none;
    margin-top: 0.8rem;
}

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

/* Signature Pad Styles */
.signature-pad-container {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.canvas-border-wrapper {
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 4px;
    background-color: white;
}

#sig-canvas {
    width: 100%;
    height: 120px;
    display: block;
    background-color: #ffffff;
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M12 20h9'/><path d='M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z'/></svg>") 0 15, crosshair;
}

.sig-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.3rem;
}

/* Export section styling */
.export-grid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    width: 100%;
    padding: 1rem 1.3rem;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    cursor: pointer;
    text-align: left;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.export-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-sm);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    color: white;
}

.export-btn.jpg .export-icon {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    box-shadow: 0 4px 10px rgba(6, 182, 212, 0.25);
}

.export-btn.pdf .export-icon {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
}

.export-btn.docx .export-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25);
}

.export-text h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.1rem;
}

.export-text p {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Right Panel: Preview Area */
.preview-panel {
    background-color: rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-toolbar {
    padding: 0.9rem 1.8rem;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 5;
}

.preview-toolbar h3 {
    font-size: 0.95rem;
    font-weight: 700;
}

.preview-toolbar h3 span {
    color: var(--primary-color);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background-color: var(--bg-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 30px;
    border: 1px solid var(--border-color);
}

.tool-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
}

.tool-btn:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

#zoom-value {
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 38px;
    text-align: center;
}

/* Scroll Container for Canvases */
.preview-scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 2.5rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.preview-scroll-container::-webkit-scrollbar {
    width: 8px;
}
.preview-scroll-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.01);
}
.preview-scroll-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
.preview-scroll-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Canvases layout */
.pages-grid {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    align-items: center;
    width: 100%;
}

.pages-grid canvas {
    max-width: 100%;
    height: auto !important;
    background-color: #ffffff;
    box-shadow: var(--shadow-paper);
    border-radius: 4px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    transform-origin: top center;
}

/* Loading Spinner inside preview */
.page-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 4rem;
    color: var(--text-secondary);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.preview-footer {
    padding: 0.7rem;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.preview-footer i {
    color: var(--accent-color);
    margin-right: 2px;
}

/* Bottom Footer info */
.app-footer-info {
    text-align: center;
    padding: 0.8rem;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-secondary);
    z-index: 5;
}

/* Font styles preview helper in select box */
.font-select option {
    font-size: 1.1rem;
    padding: 0.5rem;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .app-workspace {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }
    
    .controls-panel {
        overflow-y: visible;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .preview-panel {
        height: 600px;
    }
    
    .app-header {
        padding: 0.8rem 1.2rem;
    }
    
    .glow-1, .glow-2 {
        width: 300px;
        height: 300px;
    }
}

.page-wrapper {
    width: 100%;
    margin: 0 auto;
    transition: max-width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
}
