/* Global CSS - Common styles across all pages */

/* Card enhancements */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: 1px solid rgba(0, 0, 0, 0.125);
}

.card-header {
    background-color: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

/* Button enhancements */
.btn {
    border-radius: 0.375rem;
}

/* Utility classes */
.inset-1 {
    padding: 1rem;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0.5rem;
    }

    .card {
        margin-bottom: 1rem;
    }
}

/* Prompt template syntax highlighting */
.prompt-editor {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.prompt-editor:empty:before {
    content: attr(data-placeholder);
    color: #6c757d;
    font-style: italic;
}

.prompt-editor:focus {
    outline: none;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.placeholder-highlight {
    background-color: #e3f2fd;
    color: #1976d2;
    font-weight: 600;
    font-family: 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', monospace;
    padding: 1px 3px;
    border-radius: 3px;
    border: 1px solid #bbdefb;
}

/* Quill Editor Styling */
.ql-container {
    font-family: inherit;
    font-size: inherit;
}

.ql-editor {
    min-height: 200px;
    overflow-y: auto;
}

/* Remove resize from editor itself - will be applied to container */
.ql-editor {
    resize: none !important;
}

.ql-editor.ql-blank::before {
    font-style: normal;
    color: #adb5bd;
}

/* Quill toolbar styling */
.ql-toolbar {
    background-color: #f8f9fa;
    border-color: #dee2e6 !important;
    border-radius: 0.375rem 0.375rem 0 0;
}

.ql-container {
    border-color: #dee2e6 !important;
    border-radius: 0 0 0.375rem 0.375rem;
}

/* Quill image resize handles */
.ql-editor img {
    cursor: pointer;
    max-width: 100%;
    height: auto;
}

/* Quill text alignment support - applies both in editor and displayed content */
.ql-align-center,
p.ql-align-center,
li.ql-align-center,
h1.ql-align-center,
h2.ql-align-center,
h3.ql-align-center,
h4.ql-align-center,
h5.ql-align-center,
h6.ql-align-center {
    text-align: center;
}

.ql-align-right,
p.ql-align-right,
li.ql-align-right,
h1.ql-align-right,
h2.ql-align-right,
h3.ql-align-right,
h4.ql-align-right,
h5.ql-align-right,
h6.ql-align-right {
    text-align: right;
}

.ql-align-justify,
p.ql-align-justify,
li.ql-align-justify {
    text-align: justify;
}

/* Default left alignment */
.ql-align-left,
p.ql-align-left,
li.ql-align-left,
h1.ql-align-left,
h2.ql-align-left,
h3.ql-align-left,
h4.ql-align-left,
h5.ql-align-left,
h6.ql-align-left {
    text-align: left;
}

/* Image alignment within aligned containers - ensure images respect parent alignment */
/* Force images to be inline-block so text-align works properly */
.ql-align-center img,
p.ql-align-center img,
li.ql-align-center img {
    display: inline-block !important;
}

.ql-align-right img,
p.ql-align-right img,
li.ql-align-right img {
    display: inline-block !important;
}

.ql-align-left img,
p.ql-align-left img,
li.ql-align-left img {
    display: inline-block !important;
}

/* For standalone images with alignment classes applied directly */
img.ql-align-center {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

img.ql-align-right {
    display: block;
    margin-left: auto;
    margin-right: 0;
}

img.ql-align-left {
    display: block;
    margin-left: 0;
    margin-right: auto;
}

/* Auto-save indicator */
.editor-autosave-indicator {
    font-size: 0.875rem;
    padding: 0.25rem 0.5rem;
    display: inline-block;
}

.editor-autosave-indicator .saving {
    color: #0d6efd;
    font-weight: 500;
}

.editor-autosave-indicator .saved {
    color: #198754;
}

.editor-autosave-indicator .text-danger {
    color: #dc3545;
    font-weight: 500;
}

.editor-autosave-indicator .text-muted {
    color: #6c757d;
}

/* Ensure Quill tooltips and dropdowns appear above modals */
.ql-tooltip,
.ql-picker-options {
    z-index: 2000 !important;
}

/* Fix for Quill pickers in modals */
.modal .ql-toolbar .ql-picker-options {
    z-index: 2000 !important;
}

/* Ensure Quill editor and toolbar stay within modal */
.modal .ql-container,
.modal .ql-toolbar {
    position: relative;
}

/* Fix ARIA accessibility issue with Quill pickers */
.ql-picker-options[aria-hidden="true"] {
    pointer-events: none;
}

.ql-picker.ql-expanded .ql-picker-options {
    pointer-events: auto;
}