/* Import more Arabic fonts */
@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Scheherazade+New:wght@400;700&family=Reem+Kufi:wght@400;500;600;700&family=Cairo:wght@200;300;400;500;600;700;800;900&family=Tajawal:wght@200;300;400;500;700;800;900&family=Almarai:wght@300;400;700;800&family=Changa:wght@200;300;400;500;600;700;800&family=El+Messiri:wght@400;500;600;700&family=Lalezar&family=Markazi+Text:wght@400;500;600;700&display=swap');

/* Load aalmaghribi.ttf font from asset folder */
@font-face {
    font-family: 'Aalmaghribi2';
    src: url('./asset/aalmaghribi.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Load additional Quran fonts from assets */
@font-face {
    font-family: 'Kitab';
    src: url('./asset/Kitab-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Kitab Bold';
    src: url('./asset/Kitab-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Almaghribi Warsh';
    src: url('./asset/Almaghribi-Warsh-Quran.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Arabic Text Diacritics (Tashkeel) Alignment CSS Fixes */
.arabic-text, .editable-text[dir="rtl"], .arabic-diacritics {
    /* Enhanced Arabic text rendering */
    font-feature-settings: "liga" 1, "dlig" 1, "calt" 1, "kern" 1, "mark" 1, "mkmk" 1;
    font-variant-ligatures: common-ligatures discretionary-ligatures;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* Better diacritic positioning */
    line-height: 1.8;
    letter-spacing: 0.02em;
    word-spacing: 0.1em;
    
    /* Support for complex scripts */
    unicode-bidi: plaintext;
    direction: rtl;
    
    /* Improve diacritic rendering on specific problematic letters */
    position: relative;
}

/* Specific adjustments for problematic Arabic characters */
.arabic-text .adj, .editable-text .adj {
    position: relative;
    display: inline-block;
    vertical-align: baseline;
}

/* Fine-tune diacritics on specific letters like ش and و */
.arabic-text .adj::before, .editable-text .adj::before {
    content: '';
    position: absolute;
    top: -0.1em;
    left: 0;
    right: 0;
    height: 0.2em;
    pointer-events: none;
}

/* Improved spacing for diacritics */
.editable-text {
    /* Enhanced kerning for Arabic */
    font-kerning: auto;
    font-variant-position: normal;
    
    /* Better baseline alignment */
    vertical-align: baseline;
    line-height: 1.8;
    
    /* Prevent text selection issues with diacritics */
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Special adjustments for common problematic sequences */
.editable-text .tashkeel-fix {
    letter-spacing: -0.05em;
    word-spacing: 0.05em;
}

/* Smooth diacritic rendering for different fonts */
.editable-text[style*="Amiri"], 
.editable-text[style*="Aalmaghribi"], 
.editable-text[style*="Scheherazade"] {
    text-shadow: 0 0 1px transparent;
    transform: translateZ(0);
    will-change: transform;
}

/* Enhanced Arabic font stack with diacritic support */
.arabic-enhanced {
    font-family: "Aalmaghribi2", "Amiri Quran", "Kitab", "Scheherazade New", "Amiri", "Noto Naskh Arabic", "Arabic Typesetting", sans-serif;
    font-feature-settings: "liga" 1, "dlig" 1, "calt" 1, "kern" 1, "mark" 1, "mkmk" 1, "ccmp" 1;
    font-variant-ligatures: common-ligatures contextual;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    overflow: hidden;
    height: 100vh;
}

/* Editor Container */
.editor-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

/* Top Toolbar */
.top-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, #000000 0%, #2E7D32 100%);    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.back-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

.toolbar-left h1 {
    font-size: 20px;
    font-weight: 600;
}

.toolbar-center {
    display: flex;
    gap: 8px;
}

.tool-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 16px;
}

.tool-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-right #exportFormat {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 13px;
}

.export-quality-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.export-quality-wrap label {
    font-size: 12px;
    color: rgba(255,255,255,0.9);
}

.export-quality-wrap input[type="range"] {
    width: 60px;
}

.export-quality-wrap span {
    font-size: 12px;
    color: white;
    min-width: 28px;
}

.action-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.save-btn {
    background: #28a745;
    color: white;
}

.save-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

.export-btn {
    background: #fd7e14;
    color: white;
}

.export-btn:hover {
    background: #e55a00;
    transform: translateY(-1px);
}

.import-btn {
    background: #6c757d;
    color: white;
}

.import-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* Main Editor Area */
.editor-main {
    display: flex;
    flex: 1;
    height: calc(100vh - 70px);
    flex-direction: column;
    overflow: hidden; /* Prevent scrolling */
}

.editor-content {
    display: flex;
    flex: 1;
    overflow: hidden; /* Prevent internal scrolling */
    position: relative;
}

/* Sidebar Styles */
.left-sidebar, .right-sidebar {
    width: 347px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    overflow-y: auto;
    padding: 20px;
}

.right-sidebar {
    border-right: none;
    border-left: 1px solid #e9ecef;
}

.panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
}

.panel h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel h3 i {
    color: #6c757d;
}

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 6px;
}

.form-group select,
.form-group input[type="text"],
.form-group input[type="range"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[type="color"] {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* Buttons */
.load-btn, .element-btn, .bg-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

.load-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.load-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.element-btn {
    background: #e9ecef;
    color: #495057;
}

.element-btn:hover {
    background: #dee2e6;
    transform: translateY(-1px);
}

.bg-btn {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #e9ecef;
}

.bg-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

/* Template Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.template-item {
    cursor: pointer;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.template-item:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.template-preview {
    width: 100%;
    height: 60px;
    border-radius: 6px;
    margin-bottom: 8px;
}

.classic-template {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

.modern-template {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.elegant-template {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.gradient-template {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.template-item span {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* Template Actions */
.template-actions {
    margin-bottom: 16px;
}

.template-action-btn {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    background: white;
    color: #495057;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.template-action-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
}

/* Custom Templates */
.custom-templates {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.custom-templates h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: #495057;
    font-weight: 600;
}

.no-templates {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    font-size: 12px;
    padding: 20px;
    margin: 0;
}

.custom-template-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.custom-template-item:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

.custom-template-preview {
    width: 40px;
    height: 30px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.template-font-preview {
    font-size: 12px;
    font-weight: bold;
}

.custom-template-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.custom-template-name {
    font-size: 12px;
    font-weight: 500;
    color: #495057;
}

.custom-template-actions {
    display: flex;
    gap: 4px;
}

.custom-template-btn {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.3s ease;
}

.custom-template-btn.apply-btn {
    background: #28a745;
    color: white;
}

.custom-template-btn.apply-btn:hover {
    background: #218838;
}

.custom-template-btn.export-btn {
    background: #17a2b8;
    color: white;
}

.custom-template-btn.export-btn:hover {
    background: #138496;
}

.custom-template-btn.delete-btn {
    background: #dc3545;
    color: white;
}

.custom-template-btn.delete-btn:hover {
    background: #c82333;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

/* Audio Timeline Wrapper - Inside Canvas Wrapper */
.audio-timeline-wrapper {
    width: 800px; /* Match canvas width */
    background: #ffffff;
    border-top: 2px solid #e9ecef;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
    z-index: 100;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

/* Audio Timeline Container - Light Design */
.audio-timeline-container {
    background: #f8f9fa;
    border-radius: 0;
    padding: 0;
    margin: 0;
    color: #495057;
    box-shadow: none;
    border: none;
    position: relative;
    min-height: 120px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
}

.timeline-header h4 {
    margin: 0;
    color: #495057;
    font-size: 14px;
    font-weight: 500;
}

.audio-test-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.audio-test-btn:hover {
    background: #0056b3;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
}

.audio-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #ffffff;
    color: #495057;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
}

.audio-btn:hover {
    background: #f8f9fa;
    color: #212529;
    border-color: #adb5bd;
}

.audio-btn.playing {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.audio-info {
    font-size: 13px;
    font-weight: 400;
    margin-left: auto;
    color: #495057;
}

.timeline-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #ffffff;
}

.timeline {
    flex: 1;
    height: 40px;
    background: #e9ecef;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

/* Waveform visualization background */
.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.05) 2px,
        rgba(0,0,0,0.05) 4px
    );
}

.timeline-progress {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    width: 0%;
    transition: width 0.1s ease;
    position: relative;
    opacity: 0.8;
}

.timeline-handle {
    position: absolute;
    top: 50%;
    left: 0%;
    width: 3px;
    height: 100%;
    background: #007bff;
    cursor: ew-resize;
    transform: translate(-50%, -50%);
    transition: left 0.1s ease;
    box-shadow: 0 0 8px rgba(0,123,255,0.5);
}

.timeline-handle::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #007bff;
}

.timeline-handle::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 8px solid #007bff;
}

.time-display {
    font-size: 12px;
    font-family: 'SF Mono', Consolas, monospace;
    min-width: 100px;
    text-align: center;
    color: #495057;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
    overflow: auto;
}

.canvas {
    width: 800px;
    height: 500px; /* Reduced height to make room for timeline */
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    margin-bottom: 20px; /* Space before timeline */
}

.canvas-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    font-size: 18px;
}

.canvas-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #dee2e6;
}

/* Editable Elements */
.editable-element {
    position: absolute;
    cursor: move;
    user-select: none;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent !important; /* Force transparent background */
    transition: transform 0.2s ease;
}

.editable-element:hover {
    transform: scale(1.02);
}

.editable-element.selected {
    outline: 2px solid #007bff;
    outline-offset: 5px;
    background: transparent !important; /* No background on selected state */
}

.editable-element.dragging {
    opacity: 0.8;
    cursor: grabbing !important;
}

.editable-text {
    padding: 8px;
    outline: none;
    border: none;
    background: transparent !important; /* Force transparent background */
    min-width: 50px;
    min-height: 30px;
    display: inline-block;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Arabic Text Rendering Support */
.editable-text,
.canvas .arabic-text,
.ayah-text {
    /* Enhanced Arabic text rendering */
    font-feature-settings: "liga" 1, "calt" 1, "kern" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* Unicode support for Arabic */
    unicode-bidi: embed;
    direction: rtl;
    
    /* Better line spacing for Arabic */
    line-height: 1.8;
    
    /* Ensure proper Arabic font fallback */
    font-family: 'Amiri', 'Scheherazade New', 'Reem Kufi', 'Cairo', 'Noto Sans Arabic', 'Arabic Typesetting', 'Traditional Arabic', 'Al Bayan', 'Geeza Pro', serif;
}

/* Typography Controls */
.button-group {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.style-btn, .align-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #ced4da;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #495057;
}

.style-btn:hover, .align-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

.style-btn.active, .align-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Color Picker Group */
.color-picker-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.color-picker-group label {
    font-size: 14px;
    color: #495057;
    flex: 1;
}

/* Layers Panel */
.layers-list {
    max-height: 300px;
    overflow-y: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 8px;
    border: 1px solid #e9ecef;
}

.layer-item:hover {
    background: #f8f9fa;
}

.layer-item.active {
    background: #e3f2fd;
    border-color: #2196f3;
}

.layer-item.hidden {
    opacity: 0.5;
    background: #f8f9fa;
}

.layer-icon {
    width: 20px;
    height: 20px;
    background: #e9ecef;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #6c757d;
    font-weight: bold;
}

.layer-icon.translation {
    background: #e3f2fd;
    color: #1976d2;
}

.layer-icon.surah-info {
    background: #f3e5f5;
    color: #7b1fa2;
}

.layer-name {
    flex: 1;
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

.layer-visibility {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #6c757d;
    border-radius: 3px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-visibility:hover {
    background: #e9ecef;
    color: #495057;
}

.layer-visibility.hidden {
    color: #dc3545;
}

.layer-lock {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #6c757d;
    border-radius: 3px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layer-lock:hover {
    background: #e9ecef;
    color: #495057;
}

.layer-lock.locked {
    color: #007bff;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid #e9ecef;
    padding: 8px 0;
    z-index: 1000;
    display: none;
    min-width: 180px;
}

.context-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.context-item:hover {
    background: #f8f9fa;
    color: #007bff;
}

.context-separator {
    height: 1px;
    background: #e9ecef;
    margin: 8px 0;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: #1e1e1e;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #333;
    background: #252525;
}

.modal-header h3 {
    margin: 0;
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-body {
    padding: 24px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

.export-modal-content {
    max-width: 480px;
}

.export-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.export-section {
    padding: 12px 0;
}

.export-section h4 {
    margin: 0 0 12px 0;
    color: #000000;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.export-section .element-btn {
    margin-top: 8px;
    width: 100%;
}

.export-divider {
    border: none;
    border-top: 1px solid #333;
    margin: 4px 0;
}

.export-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.export-row label {
    min-width: 60px;
    color: #b0b0b0;
}

.export-hint {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #888;
}

.video-status {
    margin-top: 8px;
    font-size: 12px;
    color: #888;
}

.design-tools-description {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 12px;
}

.custom-audio-section {
    margin-top: 12px;
    padding: 14px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.custom-audio-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 10px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ccc;
}

.custom-audio-tab {
    flex: 1;
    padding: 6px 8px;
    font-size: 11px;
    font-weight: 600;
    border: none;
    background: #fff;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-audio-tab.active {
    background: #0d6efd;
    color: #fff;
}

.custom-audio-tab:hover:not(.active) {
    background: #e9ecef;
}

.custom-audio-panel {
    min-height: 40px;
}

.custom-audio-dropzone {
    padding: 16px 12px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
}

.custom-audio-dropzone.drag-over {
    border-color: #0d6efd;
    background: #e7f1ff;
}

.custom-audio-dropzone:hover {
    border-color: #999;
}

.custom-audio-hint {
    font-size: 12px;
    color: #666;
    margin: 0;
}

.custom-audio-hint i {
    margin-right: 4px;
    color: #0d6efd;
}

.custom-audio-list {
    font-size: 12px;
    color: #444;
    max-height: 120px;
    overflow-y: auto;
    margin-top: 8px;
}

.custom-audio-row {
    padding: 4px 0;
    border-bottom: 1px solid #e0e0e0;
}

.custom-audio-extra {
    margin-top: 6px;
    color: #888;
    font-style: italic;
}

/* Single file waveform & markers */
.custom-single-filename {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.custom-single-filename::before {
    content: '\f1c7';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    color: #0d6efd;
}

.custom-waveform-wrapper {
    position: relative;
    width: 100%;
    height: 80px;
    background: #1a1a2e;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    margin-bottom: 8px;
}

.custom-waveform-wrapper canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.custom-waveform-playhead {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: #ff4444;
    pointer-events: none;
    z-index: 2;
    transition: left 0.05s linear;
}

.custom-waveform-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.custom-waveform-marker {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background: #ffc107;
}

.custom-waveform-marker-label {
    position: absolute;
    top: 2px;
    left: 3px;
    font-size: 9px;
    font-weight: 700;
    color: #ffc107;
    white-space: nowrap;
    text-shadow: 0 0 3px rgba(0,0,0,0.8);
}

.custom-marker-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.custom-marker-time {
    font-size: 11px;
    font-family: monospace;
    color: #555;
    min-width: 48px;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
}

.btn-sm:hover { background: #f0f0f0; }
.btn-sm.btn-primary { background: #0d6efd; color: #fff; border-color: #0d6efd; }
.btn-sm.btn-primary:hover { background: #0b5ed7; }
.btn-sm.btn-danger { background: #dc3545; color: #fff; border-color: #dc3545; }
.btn-sm.btn-danger:hover { background: #bb2d3b; }

.custom-marker-list {
    font-size: 11px;
    max-height: 140px;
    overflow-y: auto;
}

.custom-marker-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    background: #fff;
    border: 1px solid #e8e8e8;
}

.custom-marker-item:hover {
    background: #f0f4ff;
}

.custom-marker-item .marker-ayah {
    font-weight: 600;
    color: #333;
    min-width: 60px;
}

.custom-marker-item .marker-time {
    font-family: monospace;
    color: #0d6efd;
}

.custom-marker-item .marker-del {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
}

.custom-marker-item .marker-del:hover {
    color: #a71d2a;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #333;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #252525;
}

/* Gradient Controls */
.gradient-controls,
.color-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gradient-preview,
.color-preview {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    border: 2px solid #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-settings {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gradient-type,
.gradient-angle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gradient-type label,
.gradient-angle label {
    color: #aaa;
    min-width: 80px;
}

.gradient-type select {
    flex: 1;
    padding: 8px 12px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
}

.gradient-angle input[type="range"] {
    flex: 1;
}

.gradient-angle span {
    color: #fff;
    min-width: 40px;
    text-align: right;
}

.gradient-colors {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-stop {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-stop label {
    color: #aaa;
    min-width: 80px;
}

.color-stop input[type="color"] {
    width: 60px;
    height: 36px;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
}

.color-stop input[type="range"] {
    flex: 1;
}

.color-stop .position-value {
    color: #fff;
    min-width: 40px;
    text-align: right;
}

/* Gradient and Color Presets */
.gradient-presets,
.color-presets-section {
    margin-top: 20px;
}

.gradient-presets h4,
.color-presets-section h4 {
    color: #fff;
    margin-bottom: 12px;
    font-size: 14px;
}

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

.gradient-preset-btn,
.color-preset-btn {
    width: 60px;
    height: 60px;
    border: 2px solid #444;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.gradient-preset-btn:hover,
.color-preset-btn:hover {
    transform: scale(1.1);
    border-color: #007bff;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.4);
}

/* Cancel and Save Buttons */
.cancel-btn,
.save-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cancel-btn {
    background: #444;
    color: #fff;
}

.cancel-btn:hover {
    background: #555;
}

.save-btn {
    background: #007bff;
    color: #fff;
}

.save-btn:hover {
    background: #0056b3;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}

/* Properties Panel */
.properties-content .no-selection {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}

/* Range Input Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    /* width: 100%; */
    /* height: 6px; */
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: #5a6fd8;
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .left-sidebar, .right-sidebar {
        width: 240px;
    }
    
    .canvas {
        width: 600px;
        height: 450px;
    }
}

@media (max-width: 768px) {
    .editor-main {
        flex-direction: column;
    }
    
    .left-sidebar, .right-sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
        order: 2;
    }
    
    .canvas-container {
        order: 1;
        height: 400px;
    }
    
    .canvas {
        width: 90%;
        height: 90%;
    }
    
    .toolbar-center {
        display: none;
    }
    
    .toolbar-left h1 {
        font-size: 16px;
    }
}

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

.panel {
    animation: fadeIn 0.3s ease-out;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Drag and Drop Effects */
.drag-over {
    border: 2px dashed #667eea !important;
    background: rgba(102, 126, 234, 0.05) !important;
}

.dragging {
    opacity: 0.8;
    transform: rotate(5deg);
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Success/Error States */
.success {
    border-color: #28a745 !important;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1) !important;
}

.error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

/* Logo and header improvements */
.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toolbar-logo {
    height: 32px;
    width: auto;
}

.toolbar-left h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* Generate button styling */
.generate-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.generate-btn:hover {
    background: linear-gradient(135deg, #218838 0%, #1abc9c 100%);
    transform: translateY(-1px);
}

/* Canvas header */
.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    border-radius: 8px 8px 0 0;
}

.canvas-title h3 {
    margin: 0;
    font-size: 18px;
    color: #495057;
}

.canvas-title span {
    font-size: 14px;
    color: #6c757d;
    font-style: italic;
}

.canvas-controls select {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
}

/* Ayah Navigation Panel */
.ayah-nav-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #e3f2fd;
    border-radius: 6px;
    font-weight: 500;
}

.ayah-nav-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.nav-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    background: white;
    color: #495057;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
}

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

.ayah-list {
    max-height: 200px;
    overflow-y: auto;
}

.ayah-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 4px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.ayah-list-item:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.ayah-list-item.active {
    background: #007bff !important;
    color: #ffffff !important;
    border-color: #0056b3 !important;
    font-weight: 600;
}

.ayah-list-item.active .ayah-number {
    color: #ffffff !important;
}

.ayah-list-item.active .ayah-preview {
    color: #ffffff !important;
    opacity: 0.9;
}

.ayah-list-item .ayah-number {
    font-weight: 600;
}

.ayah-list-item .ayah-preview {
    font-size: 12px;
    opacity: 0.7;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Font selection with optgroups */
#fontFamilySelect optgroup {
    font-weight: bold;
    color: #495057;
}

#fontFamilySelect option {
    font-weight: normal;
    padding: 4px 8px;
}

/* No elements state */
.no-elements {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
    margin: 0;
}

/* Progress Modal */
.progress-container {
    margin-bottom: 20px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #28a745);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #495057;
}

.generation-log {
    max-height: 200px;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    font-family: monospace;
    font-size: 12px;
}

.log-entry {
    margin-bottom: 4px;
    padding: 2px 0;
}

.log-entry.success {
    color: #28a745;
}

.log-entry.error {
    color: #dc3545;
}

.log-entry.info {
    color: #007bff;
}

/* Large Modal */
.large-modal {
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
}

.large-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.result-item {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    transition: all 0.3s ease;
}

.result-item:hover {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0,123,255,0.15);
}

.result-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #f8f9fa;
}

.result-info {
    padding: 12px;
}

.result-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.result-subtitle {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
}

.result-actions {
    display: flex;
    gap: 4px;
}

.result-btn {
    flex: 1;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    background: white;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s ease;
}

.result-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
}

/* Download Actions */
.download-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 20px 0;
    border-top: 1px solid #e9ecef;
}

.download-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.download-btn:first-child {
    background: #007bff;
    color: white;
}

.download-btn:first-child:hover {
    background: #0056b3;
}

.download-btn:nth-child(2) {
    background: #28a745;
    color: white;
}

.download-btn:nth-child(2):hover {
    background: #1e7e34;
}

.download-btn:nth-child(3) {
    background: #ffc107;
    color: #212529;
}

.download-btn:nth-child(3):hover {
    background: #e0a800;
}

/* Advanced controls styling */
.advanced-controls .form-group {
    margin-bottom: 16px;
}

.advanced-controls .form-group:last-child {
    margin-bottom: 0;
}

/* Responsive improvements */
@media (max-width: 1200px) {
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .large-modal {
        width: 98%;
    }
    
    .canvas {
        width: 600px;
        height: 400px;
    }
    
    .audio-timeline-wrapper {
        width: 600px; /* Match smaller canvas width */
    }
}

@media (max-width: 768px) {
    .logo-container {
        gap: 8px;
    }
    
    .toolbar-logo {
        height: 24px;
    }
    
    .toolbar-left h1 {
        font-size: 16px;
    }
    
    .canvas-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .ayah-nav-controls {
        flex-direction: column;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .download-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .canvas {
        width: 90%;
        height: 300px;
    }
    
    .audio-timeline-wrapper {
        width: 90%; /* Match mobile canvas width */
        border-radius: 0;
    }
    
    .timeline-header h4 {
        font-size: 12px;
    }
    
    .audio-controls {
        flex-wrap: wrap;
    }
    
    .audio-info {
        width: 100%;
        margin-top: 8px;
        text-align: center;
    }
}

/* Animation for loading states */

/* Background Creation Buttons */
.background-creation-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.bg-create-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
    white-space: nowrap;
}

.bg-create-btn i {
    font-size: 14px;
}

/* Gradient button */
#createGradientBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 1px solid transparent;
}

#createGradientBtn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Solid color button */
#createSolidColorBtn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: 1px solid transparent;
}

#createSolidColorBtn:hover {
    background: linear-gradient(135deg, #3d8bfe 0%, #00d4fe 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

/* Clear button */
#clearBackgroundBtn {
    background: #6c757d;
    color: white;
    border: 1px solid #6c757d;
}

#clearBackgroundBtn:hover {
    background: #545b62;
    border-color: #545b62;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Active state for all bg buttons */
.bg-create-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Gradient Modal Styles */
.gradient-modal .modal-content {
    width: 600px;
    max-width: 90vw;
}

.gradient-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gradient-preview {
    width: 100%;
    height: 120px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gradient-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.color-inputs {
    display: flex;
    gap: 20px;
}

.color-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-input-group label {
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.color-input-group input[type="color"] {
    width: 100%;
    height: 50px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-input-group input[type="color"]:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

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

.direction-input label {
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.direction-input select {
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.direction-input select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.gradient-presets h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #495057;
    font-weight: 600;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 10px;
}

.gradient-preset-btn {
    width: 60px;
    height: 60px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.gradient-preset-btn:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Color Modal Styles */
.color-modal .modal-content {
    width: 500px;
    max-width: 90vw;
}

.color-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.color-preview {
    width: 100%;
    height: 100px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    background: #1a1a1a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.color-picker-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-picker-container label {
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.color-picker-container input[type="color"] {
    /* width: 100%; */
    /* height: 60px; */
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-picker-container input[type="color"]:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.color-presets-section h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #495057;
    font-weight: 600;
}

.color-presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 8px;
}

.color-preset-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.color-preset-btn:hover {
    border-color: #007bff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    z-index: 1;
}

/* Responsive adjustments for background buttons and modals */
@media (max-width: 768px) {
    .background-creation-buttons {
        flex-direction: column;
        gap: 6px;
    }
    
    .bg-create-btn {
        padding: 10px 12px;
        font-size: 11px;
    }
    
    .bg-create-btn i {
        font-size: 12px;
    }
    
    .gradient-modal .modal-content,
    .color-modal .modal-content {
        width: 95vw;
        margin: 10px;
    }
    
    .color-inputs {
        flex-direction: column;
        gap: 12px;
    }
    
    .preset-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .color-presets-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .gradient-preset-btn {
        width: 50px;
        height: 50px;
    }
    
    .color-preset-btn {
        width: 35px;
        height: 35px;
    }
}

/* Copy Style Section */
.style-copy-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e9ecef;
}

.style-copy-section h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: #495057;
    font-weight: 600;
}

.style-apply-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.style-apply-buttons .element-btn {
    flex: 1;
    font-size: 12px;
    padding: 8px 10px;
}

.element-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f8f9fa;
    color: #6c757d;
}

.element-btn:disabled:hover {
    background: #f8f9fa;
    transform: none;
}

.copied-style-info {
    margin-top: 8px;
    padding: 6px 10px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    text-align: center;
}

.copied-style-info small {
    color: #155724;
    font-weight: 500;
}

/* Canvas Toolbar - Canva Style - Compact */
.canvas-toolbar {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px 8px 0 0;
    padding: 8px 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 6px;
    overflow-x: auto;
    overflow-y: visible;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.canvas-toolbar::-webkit-scrollbar {
    height: 4px;
}
.canvas-toolbar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.toolbar-section {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    margin-right: 16px;
    white-space: nowrap;
}

.toolbar-group label {
    font-size: 12px;
    font-weight: 500;
    color: #495057;
    min-width: 35px;
    white-space: nowrap;
}

.toolbar-select {
    min-width: 140px;
    max-width: 160px;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.toolbar-range {
    width: 60px;
    height: 4px;
    border-radius: 2px;
    background: #e9ecef;
    outline: none;
    cursor: pointer;
}

.toolbar-range::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #007bff;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toolbar-value {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    min-width: 35px;
    text-align: center;
}

.toolbar-color {
    width: 32px;
    height: 32px;
    border: 2px solid #e9ecef;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar-color:hover {
    border-color: #007bff;
    transform: scale(1.05);
}

.toolbar-buttons {
    display: flex;
    gap: 2px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: white;
    color: #495057;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
    border-right: 1px solid #e9ecef;
}

.toolbar-btn:last-child {
    border-right: none;
}

.toolbar-btn:hover {
    background: #f8f9fa;
    color: #007bff;
}

.toolbar-btn.active {
    background: #007bff;
    color: white;
}

/* Element Controls */
.elements-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.element-control-btn {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    background: white;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.element-control-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
}

/* Responsive Design for Canvas Toolbar */
@media (max-width: 1200px) {
    .toolbar-section {
        gap: 16px;
    }
    
    .toolbar-select {
        min-width: 140px;
    }
    
    .toolbar-range {
        width: 60px;
    }
}

@media (max-width: 992px) {
    .canvas-toolbar {
        padding: 8px 12px;
    }
    
    .toolbar-section {
        gap: 12px;
    }
    
    .toolbar-group {
        gap: 6px;
    }
    
    .toolbar-select {
        min-width: 120px;
        font-size: 12px;
    }
    
    .toolbar-group label {
        font-size: 12px;
        min-width: 35px;
    }
    
    .toolbar-btn {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .canvas-toolbar {
        display: none; /* Hide on mobile, use sidebars instead */
    }
}

/* Magnetic Positioning Guides */
.position-guide {
    position: absolute;
    background: #007bff;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.position-guide.active {
    opacity: 0.8;
}

.position-guide.vertical {
    width: 2px;
    height: 100%;
    top: 0;
}

.position-guide.horizontal {
    height: 2px;
    width: 100%;
    left: 0;
}

.position-guide.center-x {
    left: 50%;
    transform: translateX(-50%);
}

.position-guide.center-y {
    top: 50%;
    transform: translateY(-50%);
}

/* Snap Distance Indicator */
.snap-indicator {
    position: absolute;
    background: rgba(0, 123, 255, 0.2);
    border: 2px dashed #007bff;
    border-radius: 4px;
    z-index: 998;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.snap-indicator.active {
    opacity: 1;
}

/* Position Info Display */
.position-info {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'SF Mono', Consolas, monospace;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1001;
    pointer-events: none;
}

.position-info.active {
    opacity: 1;
}

.position-info .coords {
    display: block;
    margin-bottom: 4px;
}

.position-info .size {
    display: block;
    color: #4facfe;
}

/* Modern Custom File Upload */
.custom-file-upload {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.file-upload-btn {
    width: 100%;
    padding: 16px 20px;
    border: 2px dashed #ced4da;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.file-upload-btn:hover {
    border-color: #007bff;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.15);
}

.file-upload-btn:active {
    transform: translateY(0);
}

.file-upload-btn i {
    font-size: 24px;
    margin-bottom: 4px;
}

.file-upload-btn span {
    font-weight: 600;
}

.file-upload-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s ease;
}

.file-upload-btn:hover::before {
    left: 100%;
}

.file-upload-info {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.file-upload-info.has-file {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.file-upload-info.has-file .file-name::before {
    content: '✓';
    color: #28a745;
    font-weight: bold;
}

/* File drag and drop enhancement */
.file-upload-btn.drag-over {
    border-color: #28a745 !important;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%) !important;
    color: #155724 !important;
    transform: scale(1.02);
}

/* Responsive file upload */
@media (max-width: 768px) {
    .file-upload-btn {
        padding: 12px 16px;
    }
    
    .file-upload-btn i {
        font-size: 20px;
    }
}

/* Resize Handles - Professional Canva-style */
.resize-handle {
    position: absolute;
    background: #007bff;
    border: 2px solid #ffffff;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.editable-element:hover .resize-handle,
.editable-element.selected .resize-handle {
    opacity: 1;
}

/* Corner Handles - For full resize */
.corner-handle {
    width: 10px;
    height: 10px;
    background: #007bff;
}

.corner-handle.nw {
    top: -5px;
    left: -5px;
    cursor: nw-resize;
}

.corner-handle.ne {
    top: -5px;
    right: -5px;
    cursor: ne-resize;
}

.corner-handle.sw {
    bottom: -5px;
    left: -5px;
    cursor: sw-resize;
}

.corner-handle.se {
    bottom: -5px;
    right: -5px;
    cursor: se-resize;
}

/* Side Handles - For width adjustment */
.side-handle {
    width: 8px;
    height: 20px;
    background: #28a745;
    top: 50%;
    transform: translateY(-50%);
}

.side-handle.w {
    left: -4px;
    cursor: ew-resize;
}

.side-handle.e {
    right: -4px;
    cursor: ew-resize;
}

/* Font Handles - For font size adjustment */
.font-handle {
    width: 20px;
    height: 8px;
    background: #ffc107;
    left: 50%;
    transform: translateX(-50%);
}

.font-handle.n {
    top: -4px;
    cursor: ns-resize;
}

.font-handle.s {
    bottom: -4px;
    cursor: ns-resize;
}

.rotation-handle {
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffc107;
    border: 2px solid #fff;
}

/* Handle hover effects */
.resize-handle:hover {
    transform: scale(1.3);
}

/* File Upload Info */
#fileUploadInfo {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: rgba(0, 123, 255, 0.1);
    border: 1px solid rgba(0, 123, 255, 0.3);
    border-radius: 8px;
}

#fileUploadInfo.has-file {
    display: block;
}

#fileUploadInfo .file-name {
    color: #007bff;
    font-weight: 500;
    word-break: break-all;
}



.style-action-btn {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

#smartCopyBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#smartCopyBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

#smartPasteBtn {
    background: #28a745;
    color: white;
}

#smartPasteBtn:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

#smartPasteBtn:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

.copied-style-preview {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    margin-top: 8px;
}

.copied-style-preview small {
    color: #155724;
    font-weight: 500;
}

/* Color Palette */
.color-picker-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-palette {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    max-width: 200px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.2);
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
}

.color-swatch:active {
    transform: scale(1.1);
}

/* Add preview on hover for selected elements */
.color-swatch::after {
    content: '';
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: inherit;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.color-swatch:hover::after {
    opacity: 1;
}

/* Preset Backgrounds */
.preset-backgrounds-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.preset-bg {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    aspect-ratio: 16/9;
}

.preset-bg:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.preset-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preset-bg.active {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

/* Watermark Controls */
.watermark-section {
    border-top: 1px solid #e9ecef;
    padding-top: 12px;
    margin-top: 12px;
}

.watermark-section > label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
}

.watermark-section input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.watermark-controls {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.watermark-position,
.watermark-opacity,
.watermark-size {
    display: flex;
    align-items: center;
    gap: 8px;
}

.watermark-position label,
.watermark-opacity label,
.watermark-size label {
    min-width: 60px;
    font-size: 13px;
    color: #6c757d;
}

.watermark-position select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
}

.watermark-opacity input[type="range"],
.watermark-size input[type="range"] {
    flex: 1;
}

#watermarkOpacityValue,
#watermarkSizeValue {
    min-width: 40px;
    text-align: right;
    font-size: 12px;
    color: #6c757d;
}

/* Watermark Element on Canvas */
.watermark-element {
    position: absolute;
    pointer-events: none;
    z-index: 100;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.watermark-element img {
    height: 40px;
    width: auto;
    opacity: 0.8;
}

.watermark-element .watermark-text {
    font-family: 'Arial', sans-serif;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Position variations */
.watermark-element.bottom-right {
    bottom: 20px;
    right: 20px;
}

.watermark-element.bottom-left {
    bottom: 20px;
    left: 20px;
}

.watermark-element.top-right {
    top: 20px;
    right: 20px;
}

.watermark-element.top-left {
    top: 20px;
    left: 20px;
}

.watermark-element.center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Undo/Redo Button Enhancement */
#undoBtn:disabled,
#redoBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quick Actions Panel Update */
.element-btn {
    position: relative;
    overflow: hidden;
}

.element-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s ease;
}

.element-btn:hover::before {
    left: 100%;
}

/* History State Indicator */
.history-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.history-indicator.active {
    opacity: 1;
}

/* Improved hover effects for better UX */
.panel {
    transition: all 0.3s ease;
}

.panel:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

/* Smooth color transitions for text preview */
.editable-text {
    transition: color 0.2s ease;
}

/* Loading state for backgrounds */
.preset-bg.loading::after {
    content: '';
    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: #007bff;
}

.preset-bg.loading::after {
    content: 'Loading...';
}

.style-copier {
    border-top: 1px solid #e9ecef;
    padding-top: 16px;
}

.style-copier h4 {
    font-size: 14px;
    margin-bottom: 12px;
    color: #495057;
    font-weight: 600;
}

.style-action-btn {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
}

#smartCopyBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#smartCopyBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.apply-options {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.apply-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    font-size: 12px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.current-btn {
    background: #28a745;
    color: white;
}

.current-btn:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.all-btn {
    background: #dc3545;
    color: white;
}

.all-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.copied-style-preview {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    margin-top: 8px;
}

.copied-style-preview small {
    color: #155724;
    font-weight: 500;
}

.style-preview-mini {
    margin-top: 4px;
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}



/* Text Shadow Panel Styles */
.shadow-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.shadow-controls .form-group {
    margin-bottom: 0;
}

.shadow-controls .form-group label {
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    margin-bottom: 8px;
    display: block;
}

.shadow-controls input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    transition: background 0.3s ease;
}

.shadow-controls input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.shadow-controls input[type="range"]::-webkit-slider-thumb:hover {
    background: #5a67d8;
    transform: scale(1.1);
}

.shadow-controls input[type="color"] {
    width: 50px;
    height: 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
    padding: 0;
}

.shadow-controls input[type="color"]:hover {
    transform: scale(1.05);
}

.shadow-controls span {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    min-width: 40px;
    text-align: right;
}

/* Translation and Surah Info Styles */
.translation-text {
    text-align: center;
    margin: 10px 0;
    padding: 5px;
    font-size: 1.2em;
    color: var(--translation-color, #cccccc);
    line-height: 1.5;
    width: 100%;
}

.surah-info {
    text-align: center;
    margin: 10px 0;
    padding: 5px;
    font-size: 1.1em;
    color: var(--surah-info-color, #ffffff);
    line-height: 1.4;
    width: 100%;
    opacity: var(--surah-info-opacity, 0.9);
}

.ayah-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 15px;
    position: relative;
}

.ayah-container .arabic-text {
    text-align: center;
    width: 100%;
    margin: 10px 0;
}

/* Ensure proper spacing between elements */
.ayah-container > * {
    margin: 5px 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .translation-text {
        font-size: 1em;
    }
    
    .surah-info {
        font-size: 0.9em;
    }
}

/* Design Linking Panel Styles */
.linking-info {
    margin-bottom: 15px;
}

.linking-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.linking-toggle:hover {
    background: #e9ecef;
    border-color: #2E7D32;
}

.linking-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #2E7D32;
}

.linking-toggle span {
    font-weight: 500;
    color: #495057;
    user-select: none;
}

.linking-toggle input[type="checkbox"]:checked + span {
    color: #2E7D32;
    font-weight: 600;
}

.linking-description {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    margin: 0;
    padding: 10px;
    background: rgba(46, 125, 50, 0.1);
    border-radius: 6px;
    border-left: 3px solid #2E7D32;
}

.sync-status {
    margin-top: 12px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #2E7D32 0%, #4CAF50 100%);
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: pulse 2s ease-in-out infinite;
}

.sync-status i {
    animation: rotate 2s linear infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

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

.linking-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.linking-controls .element-btn {
    flex: 1;
    font-size: 13px;
    padding: 10px 8px;
}

#linkAllBtn {
    background: linear-gradient(135deg, #2E7D32, #4CAF50);
    border-color: #2E7D32;
}

#linkAllBtn:hover {
    background: linear-gradient(135deg, #1B5E20, #2E7D32);
}

#linkAllBtn:disabled {
    background: #ddd;
    color: #999;
    cursor: not-allowed;
}

#unlinkAllBtn {
    background: linear-gradient(135deg, #757575, #BDBDBD);
    border-color: #757575;
}

#unlinkAllBtn:hover {
    background: linear-gradient(135deg, #424242, #757575);
}

#unlinkAllBtn:disabled {
    background: #f5f5f5;
    color: #ccc;
    cursor: not-allowed;
}

.linking-status {
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    font-size: 12px;
    color: #495057;
    text-align: center;
}

.ayah-list-item .link-icon {
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 14px;
    opacity: 0.8;
}

.ayah-list-item.linked {
    border-left: 3px solid #2E7D32;
    /* background-color: rgba(46, 125, 50, 0.05); */
}

.ayah-list-item.linked .link-icon {
    color: #2E7D32;
}

/* Design Linking Responsive adjustments */
@media (max-width: 768px) {
    .linking-controls {
        flex-direction: column;
        gap: 8px;
    }
    
    .linking-controls .element-btn {
        font-size: 12px;
        padding: 8px 6px;
    }
}

/* My Projects */
.my-projects-list {
    margin-top: 12px;
    max-height: 280px;
    overflow-y: auto;
}

.my-projects-list .no-projects {
    color: #6c757d;
    font-size: 13px;
    margin: 0;
}

.project-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.project-item-info {
    flex: 1;
    min-width: 0;
}

.project-item-name {
    font-weight: 600;
    color: #495057;
    font-size: 13px;
}

.project-item-date {
    font-size: 11px;
    color: #6c757d;
    margin-top: 2px;
}

.project-item-actions {
    display: flex;
    gap: 6px;
}

.project-item-actions button {
    padding: 6px 10px;
    font-size: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: #e9ecef;
    color: #495057;
}

.project-item-actions button:hover {
    background: #dee2e6;
}

.project-item-actions button.load-btn {
    background: #2E7D32;
    color: #fff;
}

.project-item-actions button.load-btn:hover {
    background: #1B5E20;
}

.project-item-actions button.delete-btn {
    background: #dc3545;
    color: #fff;
}

.project-item-actions button.delete-btn:hover {
    background: #c82333;
}

/* Template Manager Styles */
.saved-templates-list {
    margin-top: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.template-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    position: relative;
}

.template-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.15);
    transform: translateY(-1px);
}

.template-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.template-item-name {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.template-item-date {
    font-size: 11px;
    color: #6c757d;
}

.template-item-description {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 10px;
    line-height: 1.4;
}

.template-item-preview {
    width: 100%;
    height: 60px;
    border-radius: 6px;
    margin-bottom: 10px;
    background-size: cover;
    background-position: center;
    border: 1px solid #dee2e6;
}

.template-item-actions {
    display: flex;
    gap: 6px;
}

.template-action-btn {
    flex: 1;
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.template-apply-btn {
    background: #28a745;
    color: white;
}

.template-apply-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

.template-edit-btn {
    background: #007bff;
    color: white;
}

.template-edit-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.template-delete-btn {
    background: #dc3545;
    color: white;
}

.template-delete-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Save Template Modal */
#saveTemplateModal .modal-body {
    padding: 24px;
}

#saveTemplateModal .form-group {
    margin-bottom: 16px;
}

#saveTemplateModal input[type="text"],
#saveTemplateModal textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

#saveTemplateModal input[type="text"]:focus,
#saveTemplateModal textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

#saveTemplateModal textarea {
    resize: vertical;
    min-height: 60px;
}

/* Responsive Template Manager */
@media (max-width: 768px) {
    .template-item-actions {
        flex-direction: column;
        gap: 4px;
    }
    
    .template-action-btn {
        padding: 8px 10px;
    }
}

/* Keyboard Shortcuts Modal */
.shortcuts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.shortcuts-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #333;
}

.shortcuts-table td:first-child {
    white-space: nowrap;
    width: 200px;
}

.shortcuts-table kbd {
    display: inline-block;
    padding: 2px 8px;
    font-family: inherit;
    font-size: 12px;
    background: #444;
    border-radius: 4px;
    border: 1px solid #555;
    margin: 0 2px;
}
