/**
 * Advanced Text Editor CSS
 * Professional styling for the comprehensive text editing interface
 */

.advanced-text-editor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.editor-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.editor-panel {
    position: relative;
    width: 480px;
    max-width: 90vw;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9fafb;
}

.editor-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 18px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: #e5e7eb;
    color: #374151;
}

.editor-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.editor-section {
    border-bottom: 1px solid #f3f4f6;
}

.editor-section:last-child {
    border-bottom: none;
}

.editor-section h4 {
    margin: 0;
    padding: 16px 24px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
    border-bottom: 1px solid #f3f4f6;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.section-header:hover {
    background: #f3f4f6;
}

.toggle-icon {
    font-size: 12px;
    color: #9ca3af;
    transition: transform 0.2s ease;
}

.editor-section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.section-content {
    padding: 16px 24px;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.editor-section.collapsed .section-content {
    display: none;
}

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

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

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    height: 80px;
    resize: vertical;
    font-family: inherit;
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-group.half {
    flex: 1;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-row input {
    width: auto;
    min-width: 60px;
    flex: 1;
}

.input-row .label {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.link-icon {
    color: #9ca3af;
    font-size: 12px;
    cursor: pointer;
    padding: 4px;
}

.rotation-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rotation-control input[type="range"] {
    flex: 1;
    width: auto;
}

.rotation-control input[type="number"] {
    width: 60px;
    flex: none;
}

.anchor-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    width: fit-content;
}

.anchor-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.anchor-btn:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.anchor-btn.active {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #3b82f6;
}

.color-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-input input[type="color"] {
    width: 40px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-input input[type="text"] {
    width: 80px;
    font-family: monospace;
    font-size: 12px;
}

.upload-font-btn {
    margin-top: 8px;
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.upload-font-btn:hover {
    background: #e5e7eb;
}

.style-buttons,
.alignment-buttons,
.anchor-buttons {
    display: flex;
    gap: 4px;
}

.style-btn,
.align-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.style-btn:hover,
.align-btn:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.style-btn.active,
.align-btn.active {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #3b82f6;
}

.background-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.background-controls input[type="checkbox"] {
    width: auto;
    margin: 0;
}

.transparency-checker {
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #ccc 25%, transparent 25%), 
                linear-gradient(-45deg, #ccc 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #ccc 75%), 
                linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
    border-radius: 3px;
}

.add-style-btn {
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-style-btn:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.shadow-controls,
.outline-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.shadow-inputs,
.outline-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.shadow-inputs input,
.outline-inputs input {
    width: 50px;
    flex: none;
}

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

.wordbreak-controls input[type="checkbox"] {
    width: auto;
    margin: 0;
}

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

.btn-primary,
.btn-secondary {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: #3b82f6;
    color: #ffffff;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #ffffff;
    color: #374151;
    border-color: #d1d5db;
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .editor-panel {
        width: 95vw;
        height: 95vh;
        margin: 0;
    }
    
    .form-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .form-group.half {
        width: 100%;
    }
    
    .input-row input {
        min-width: 50px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .editor-panel {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .editor-header {
        background: #111827;
        border-color: #374151;
    }
    
    .editor-header h3 {
        color: #f9fafb;
    }
    
    .close-btn {
        background: #374151;
        color: #d1d5db;
    }
    
    .close-btn:hover {
        background: #4b5563;
    }
    
    .editor-section h4 {
        background: #111827;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .section-header:hover {
        background: #374151;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .form-group input:focus,
    .form-group textarea:focus,
    .form-group select:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }
    
    .anchor-btn,
    .style-btn,
    .align-btn {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }
    
    .anchor-btn:hover,
    .style-btn:hover,
    .align-btn:hover {
        background: #4b5563;
        border-color: #6b7280;
    }
    
    .editor-footer {
        background: #111827;
        border-color: #374151;
    }
    
    .btn-secondary {
        background: #374151;
        color: #f9fafb;
        border-color: #4b5563;
    }
    
    .btn-secondary:hover {
        background: #4b5563;
    }
}
