/**
 * Callout Display Styles
 * Styles for callout box rendering in editor and published views
 */

/* =====================
   EDITOR PREVIEW STYLES
   ===================== */

/* Quill Editor Callout Block */
.quill-callout-block {
    margin: 1.5rem 0;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #ffffff;
    transition: all 0.2s;
    cursor: default;
    overflow: hidden;
}

.quill-callout-block:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.quill-callout-block.ql-selected {
    box-shadow: 0 0 0 3px rgba(92, 64, 51, 0.1);
}

/* Callout Header (Editor View) */
.callout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid currentColor;
}

.callout-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.callout-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.callout-type {
    font-weight: 600;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
}

.callout-controls {
    display: flex;
    gap: 0.5rem;
}

.callout-edit-btn,
.callout-delete-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid;
    background: white;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.callout-edit-btn {
    /* Color set inline based on callout type */
}

.callout-edit-btn:hover {
    background: currentColor;
    color: white !important;
}

.callout-delete-btn {
    color: #dc2626;
    border-color: #dc2626;
}

.callout-delete-btn:hover {
    background: #dc2626;
    color: white;
}

.callout-edit-btn svg,
.callout-delete-btn svg {
    width: 14px;
    height: 14px;
}

/* Callout Preview Content (Editor View) */
.callout-preview-content {
    padding: 1rem;
    color: rgba(44, 44, 44, 0.85);
    font-size: 0.9375rem;
    line-height: 1.6;
    font-family: 'Inter', sans-serif;
    border-left: 4px solid;
    margin-left: 0.5rem;
}

/* Callout Error Display */
.callout-error {
    padding: 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    color: #dc2626;
    text-align: center;
    font-style: italic;
}

/* =====================
   PUBLISHED STYLES
   ===================== */

/* Show/Hide appropriate views based on context */

/* In Editor: Show editor view, hide published view */
.admin-editor .callout-editor-view {
    display: block;
}

.admin-editor .callout-published-view {
    display: none !important;
}

/* In Published/Preview: Hide editor view, show published view */
body:not(.admin-editor) .callout-editor-view {
    display: none !important;
}

body:not(.admin-editor) .callout-published-view {
    display: flex !important;
}

/* In Published/Preview: Remove wrapper styling to prevent double-box effect */
body:not(.admin-editor) .quill-callout-block {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 1.6875rem 0 !important;
}

/* In Published/Preview: Disable hover effects on wrapper */
body:not(.admin-editor) .quill-callout-block:hover {
    box-shadow: none !important;
}

body:not(.admin-editor) .quill-callout-block.ql-selected {
    box-shadow: none !important;
}

/* Published Callout Styles */
.published-callout {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin: 0;
    padding: 1.25rem 1.5rem;
    border-left: 4px solid;
    border-radius: 0.5rem;
    font-family: 'Inter', sans-serif;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Subtle hover effect for published callouts */
.published-callout:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.published-callout .callout-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.published-callout .callout-content {
    flex: 1;
    color: rgba(44, 44, 44, 0.85);
    font-size: 1rem;
    line-height: 1.6;
}

/* Type-specific colors for published callouts */
.published-callout-info {
    background: #EFF6FF;
    border-left-color: #3B82F6;
}

.published-callout-info .callout-icon {
    color: #3B82F6;
}

.published-callout-warning {
    background: #FFFBEB;
    border-left-color: #F59E0B;
}

.published-callout-warning .callout-icon {
    color: #F59E0B;
}

.published-callout-success {
    background: #F0FDF4;
    border-left-color: #22C55E;
}

.published-callout-success .callout-icon {
    color: #22C55E;
}

.published-callout-tip {
    background: #FCF5F7;
    border-left-color: #D88C9A;
}

.published-callout-tip .callout-icon {
    color: #D88C9A;
}

.published-callout-note {
    background: #F9FAFB;
    border-left-color: #6B7280;
}

.published-callout-note .callout-icon {
    color: #6B7280;
}

/* =====================
   RESPONSIVE STYLES
   ===================== */

@media (max-width: 640px) {
    .published-callout {
        margin: 0;
        padding: 1rem;
        gap: 0.75rem;
    }

    .published-callout .callout-icon {
        font-size: 1.25rem;
    }

    .published-callout .callout-content {
        font-size: 0.9375rem;
    }

    .callout-header {
        padding: 0.5rem 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .callout-controls {
        gap: 0.375rem;
        width: 100%;
        justify-content: flex-end;
    }

    .callout-edit-btn,
    .callout-delete-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.6875rem;
    }

    .callout-preview-content {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
}

/* =====================
   PRINT STYLES
   ===================== */

@media print {
    .callout-header,
    .callout-controls {
        display: none;
    }

    .quill-callout-block {
        border: none;
        background: transparent;
        break-inside: avoid;
    }

    .published-callout {
        break-inside: avoid;
        border-left-width: 3px;
    }
}

/* =====================
   ACCESSIBILITY
   ===================== */

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .quill-callout-block {
        border-width: 3px;
    }

    .published-callout {
        border-left-width: 5px;
    }

    .callout-edit-btn,
    .callout-delete-btn {
        border-width: 2px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .callout-edit-btn,
    .callout-delete-btn,
    .quill-callout-block {
        transition: none;
    }
}

/* Dark Mode Support - ONLY for Admin Editor */
@media (prefers-color-scheme: dark) {
    /* Dark mode only applies to editor view in admin */
    .admin-editor .quill-callout-block {
        background: #1f2937;
        border-color: #4b5563;
    }

    .admin-editor .callout-header {
        background: #111827;
    }

    .admin-editor .callout-preview-content {
        color: #e5e7eb;
    }

    .admin-editor .callout-edit-btn,
    .admin-editor .callout-delete-btn {
        background: #1f2937;
    }

    .admin-editor .callout-error {
        background: #451a1a;
        border-color: #991b1b;
        color: #f87171;
    }

    /* Published callouts ALWAYS use their brand colors, never dark mode */
    /* No dark mode override for .published-callout */
}

/* =====================
   MODAL STYLES
   ===================== */

.callout-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.callout-modal-content {
    background: white;
    border-radius: 0.75rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.callout-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.callout-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #5C4033;
    font-family: 'Playfair Display', serif;
}

.callout-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.callout-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.callout-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.callout-type-selector {
    margin-bottom: 1.5rem;
}

.callout-type-selector label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: rgba(44, 44, 44, 0.95);
    font-family: 'Inter', sans-serif;
}

.callout-type-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
}

.callout-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.callout-type-btn .type-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.callout-type-btn .type-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(44, 44, 44, 0.85);
}

.callout-type-btn:hover {
    border-color: #D88C9A;
    background: #FCF5F7;
}

.callout-type-btn.active {
    border-color: #5C4033;
    background: #5C4033;
    color: white;
}

.callout-type-btn.active .type-label {
    color: white;
}

.callout-content-editor {
    margin-bottom: 1.5rem;
}

.callout-content-editor label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: rgba(44, 44, 44, 0.95);
    font-family: 'Inter', sans-serif;
}

.callout-content-editor textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
}

.callout-content-editor textarea:focus {
    outline: none;
    border-color: #5C4033;
    box-shadow: 0 0 0 3px rgba(92, 64, 51, 0.1);
}

.callout-preview-section {
    margin-bottom: 1rem;
}

.callout-preview-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: rgba(44, 44, 44, 0.95);
    font-family: 'Inter', sans-serif;
}

.callout-preview-box {
    min-height: 80px;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
}

.preview-placeholder {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    margin: 1.5rem 0;
}

.callout-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.callout-modal-cancel,
.callout-modal-insert {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.callout-modal-cancel {
    background: white;
    border: 1px solid #e5e7eb;
    color: rgba(44, 44, 44, 0.85);
}

.callout-modal-cancel:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.callout-modal-insert {
    background: #5C4033;
    border: 1px solid #5C4033;
    color: white;
}

.callout-modal-insert:hover {
    background: #4A3429;
    border-color: #4A3429;
}

/* Modal Responsive Styles */
@media (max-width: 640px) {
    .callout-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .callout-modal-header,
    .callout-modal-body,
    .callout-modal-footer {
        padding: 1rem;
    }

    .callout-type-buttons {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 0.5rem;
    }

    .callout-type-btn {
        padding: 0.75rem 0.25rem;
    }

    .callout-type-btn .type-icon {
        font-size: 1.25rem;
    }

    .callout-type-btn .type-label {
        font-size: 0.75rem;
    }
}
