﻿/* ========================================
   SINGLE LINE INPUT - THEMED STYLES
   ======================================== */

/**
 * Single Line Input Component Styles
 * 
 * This component integrates with the site's theme system using CSS custom properties.
 * It adapts automatically to the active theme (nature, sky, sunset, mystical).
 * 
 * Features:
 * - Theme-aware colors using CSS custom properties
 * - Responsive design for all device sizes
 * - Accessible focus states and indicators
 * - Modern card-based design matching site aesthetics
 * - Status indicators for save states
 * - Connection status monitoring
 */

/* ========================================
   MAIN COMPONENT CONTAINER
   ======================================== */

.singleLineTextInput {
    @apply mb-6;
}

.content-element.elementSingleLineInput {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.9) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-left: 4px solid var(--primary);
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

    .content-element.elementSingleLineInput:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
        border-color: rgba(var(--primary-rgb), 0.4);
    }

    .content-element.elementSingleLineInput:focus-within {
        transform: translateY(-2px);
        box-shadow: 0 8px 30px rgba(var(--primary-rgb), 0.2);
        border-color: var(--primary);
    }

    /* Required field indicator */
    .content-element.elementSingleLineInput.content-isRequired {
        border-left-width: 5px;
        border-left-color: var(--primary);
    }

/* ========================================
   PANEL STRUCTURE
   ======================================== */

.elementSingleLineInput .panel {
    @apply border-0 rounded-none bg-transparent;
    box-shadow: none;
    margin: 0;
}

/* Panel Header */
.elementSingleLineInput .panel-heading {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border: none;
    border-radius: 0;
    color: white;
    padding: 1rem 1.5rem;
    margin: 0;
    position: relative;
    overflow: hidden;
}

    .elementSingleLineInput .panel-heading::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
        pointer-events: none;
    }

.elementSingleLineInput .panel-title {
    @apply text-lg font-semibold mb-0;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

/* Required Badge */
.elementSingleLineInput .badge.text-bg-danger {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

/* Panel Body */
.elementSingleLineInput .panel-body {
    background: rgba(255, 255, 255, 0.7);
    border: none;
    padding: 1.5rem;
    border-radius: 0;
}

/* ========================================
   TEXTAREA & EDITOR STYLING
   ======================================== */

/* Base textarea styling (for fallback when Summernote isn't loaded) */
.elementSingleLineInput textarea {
    width: 100%;
    resize: none;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1rem;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-body);
    transition: all 0.3s ease;
    min-height: 120px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
}

    .elementSingleLineInput textarea:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
        background: white;
    }

    .elementSingleLineInput textarea:disabled {
        background: #f9fafb;
        color: #6b7280;
        cursor: not-allowed;
        border-color: #e5e7eb;
    }

/* Summernote Editor Container - Only style the outer container */
.elementSingleLineInput .note-editor {
    border: 2px solid #e5e7eb !important;
    border-radius: 0.75rem !important;
    overflow: hidden;
    transition: all 0.3s ease;
    font-family: inherit !important;
}

    .elementSingleLineInput .note-editor:focus-within {
        border-color: var(--primary) !important;
        box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1) !important;
    }

/* Hide toolbar completely - this is intentional per original design */
.elementSingleLineInput .note-toolbar,
.elementSingleLineInput .note-toolbar-wrapper {
    display: none !important;
}

/* Ensure editing area maintains Summernote's expected behavior */
.elementSingleLineInput .note-editing-area {
    background: white !important;
    border: none !important;
}

/* Style the editable content area without breaking Summernote functionality */
.elementSingleLineInput .note-editable {
    /* Keep Summernote's default behavior, only add our styling */
    padding: 1rem !important;
    min-height: 120px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif !important;
    font-size: 1rem !important;
    line-height: 1.6 !important;
    color: var(--text-body) !important;
    background: white !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

    /* Ensure focus states work properly with Summernote */
    .elementSingleLineInput .note-editable:focus {
        /* Let Summernote handle its own focus styles, just ensure visibility */
        outline: none !important;
        background: white !important;
    }

/* Hide status bar */
.elementSingleLineInput .note-statusbar {
    display: none !important;
}

/* Ensure Summernote's resizer doesn't interfere */
.elementSingleLineInput .note-resizebar {
    display: none !important;
}

/* Preserve Summernote's default paragraph and content styling */
.elementSingleLineInput .note-editable p {
    /* Let Summernote handle paragraph styling */
    margin-bottom: 1rem;
}

.elementSingleLineInput .note-editable:empty::before {
    /* Preserve Summernote's placeholder functionality */
    color: #6b7280;
    font-style: italic;
}

/* Ensure any Summernote dropdowns/popups work correctly */
.elementSingleLineInput .note-editor .note-dropdown-menu,
.elementSingleLineInput .note-editor .note-popover {
    /* Reset any potential interference */
    position: absolute !important;
    z-index: 1050 !important;
    font-family: inherit !important;
}

/* Mobile responsiveness for Summernote */
@media (max-width: 768px) {
    .elementSingleLineInput .note-editable {
        font-size: 0.875rem !important;
        padding: 0.875rem !important;
        min-height: 100px !important;
    }
}

@media (max-width: 480px) {
    .elementSingleLineInput .note-editable {
        font-size: 0.875rem !important;
        padding: 0.75rem !important;
        min-height: 80px !important;
    }
}

/* ========================================
   STATUS INDICATORS
   ======================================== */

.save-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding: 0.5rem 0;
    font-size: 0.875rem;
}

    .save-status .status-message {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        color: #6b7280;
        transition: all 0.3s ease;
    }

    /* Status Icons */
    .save-status .spinner {
        display: inline-block;
        width: 16px;
        height: 16px;
        border: 2px solid #e5e7eb;
        border-top-color: var(--primary);
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.save-status .checkmark {
    color: var(--primary);
    font-weight: bold;
    font-size: 1rem;
}

.save-status .error-icon {
    color: #ef4444;
    font-size: 1rem;
}

.save-status .status-text.text-success {
    color: var(--primary) !important;
    font-weight: 500;
}

.save-status .status-text.text-danger {
    color: #ef4444 !important;
    font-weight: 500;
}

/* ========================================
   CONNECTION STATUS
   ======================================== */

.connection-status {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #92400e;
    transition: all 0.3s ease;
}

    .connection-status.d-none {
        display: none !important;
    }

    .connection-status span {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

/* ========================================
   DATA RESTORATION NOTIFICATIONS
   ======================================== */

.data-restored-notification {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1) 0%, rgba(var(--primary-rgb), 0.05) 100%);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-top: 0.75rem;
    color: var(--primary-dark);
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   UNSAVED CHANGES MODAL
   ======================================== */

.modal-content {
    border-radius: 1rem;
    border: none;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 1rem 1rem 0 0;
    border-bottom: none;
    padding: 1.5rem;
    color: white;
}

.modal-title {
    color: white !important;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

    .modal-header .btn-close:hover {
        opacity: 1;
    }

.modal-body {
    padding: 1.5rem;
}

    .modal-body .alert {
        border-radius: 0.75rem;
        border: none;
        padding: 1rem 1.25rem;
    }

    .modal-body .alert-info {
        background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1) 0%, rgba(var(--primary-rgb), 0.05) 100%);
        color: var(--primary-dark);
        border-left: 4px solid var(--primary);
    }

    .modal-body .card {
        border-radius: 0.75rem;
        border: 2px solid #e5e7eb;
        overflow: hidden;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    }

    .modal-body .card-header {
        background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
        border-bottom: 1px solid #f59e0b;
        padding: 0.75rem 1rem;
        font-weight: 600;
        color: #92400e;
    }

    .modal-body textarea {
        border: none;
        border-radius: 0;
        font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
        font-size: 0.875rem;
        line-height: 1.6;
        background: #f8f9fa !important;
        color: #374151;
        resize: none;
    }

        .modal-body textarea:focus {
            outline: none;
            box-shadow: none;
        }

.modal-footer {
    border-top: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
    background: #f9fafb;
}

/* Modal Buttons */
.modal .btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

    .modal .btn-primary:hover {
        background: var(--primary-dark);
        border-color: var(--primary-dark);
        transform: translateY(-1px);
    }

.modal .btn-secondary {
    background: #6b7280;
    border-color: #6b7280;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

    .modal .btn-secondary:hover {
        background: #4b5563;
        border-color: #4b5563;
        transform: translateY(-1px);
    }

.modal .btn-success {
    background: #22c55e;
    border-color: #22c55e;
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

    .modal .btn-success:hover {
        background: #16a34a;
        border-color: #16a34a;
        transform: translateY(-1px);
    }

/* Copy Status Alerts */
.alert-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.5rem;
}

.alert-success {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    border: 1px solid #22c55e;
    color: #166534;
}

.alert-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    color: #92400e;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet styles */
@media (max-width: 768px) {
    .elementSingleLineInput .panel-heading {
        padding: 0.875rem 1rem;
    }

    .elementSingleLineInput .panel-body {
        padding: 1rem;
    }

    .elementSingleLineInput .panel-title {
        @apply text-base;
    }

    .elementSingleLineInput textarea,
    .elementSingleLineInput .note-editable {
        font-size: 0.875rem;
        padding: 0.875rem;
        min-height: 100px;
    }
}

/* Mobile styles */
@media (max-width: 480px) {
    .singleLineTextInput {
        @apply mb-4;
    }

    .content-element.elementSingleLineInput {
        border-radius: 0.75rem;
        margin: 0 -0.5rem;
    }

    .elementSingleLineInput .panel-heading {
        padding: 0.75rem 1rem;
        border-radius: 0.75rem 0.75rem 0 0;
    }

    .elementSingleLineInput .panel-body {
        padding: 0.875rem;
    }

    .elementSingleLineInput .panel-title {
        @apply text-sm;
    }

    .elementSingleLineInput textarea,
    .elementSingleLineInput .note-editable {
        font-size: 0.875rem;
        padding: 0.75rem;
        min-height: 80px;
        border-radius: 0.5rem;
    }

    .save-status {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

        .save-status .status-message {
            font-size: 0.8125rem;
        }

    /* Modal adjustments for mobile */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

        .modal-footer .btn {
            width: 100%;
            margin: 0;
        }
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .content-element.elementSingleLineInput {
        border-width: 2px;
        border-color: var(--primary);
    }

    .elementSingleLineInput .panel-heading {
        background: var(--primary-dark);
    }

    .elementSingleLineInput textarea,
    .elementSingleLineInput .note-editable {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .content-element.elementSingleLineInput,
    .elementSingleLineInput textarea,
    .elementSingleLineInput .note-editable,
    .save-status .status-message,
    .modal .btn {
        transition: none;
    }

    .save-status .spinner {
        animation: none;
    }

    .content-element.elementSingleLineInput:hover,
    .content-element.elementSingleLineInput:focus-within {
        transform: none;
    }

    @keyframes slideIn {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }
}

/* Focus visible improvements */
.elementSingleLineInput textarea:focus-visible,
.elementSingleLineInput .note-editable:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ========================================
   THEME-SPECIFIC CUSTOMIZATIONS
   ======================================== */

/* Nature Theme Specific */
body.theme-nature .elementSingleLineInput .panel-heading {
    background: linear-gradient(135deg, #4caf50 0%, #81c784 100%);
}

body.theme-nature .save-status .checkmark,
body.theme-nature .save-status .status-text.text-success {
    color: #2e7d32 !important;
}

/* Sky Theme Specific */
body.theme-sky .elementSingleLineInput .panel-heading {
    background: linear-gradient(135deg, #2196f3 0%, #64b5f6 100%);
}

body.theme-sky .save-status .checkmark,
body.theme-sky .save-status .status-text.text-success {
    color: #1565c0 !important;
}

/* Sunset Theme Specific */
body.theme-sunset .elementSingleLineInput .panel-heading {
    background: linear-gradient(135deg, #ff7043 0%, #ff8a65 100%);
}

body.theme-sunset .save-status .checkmark,
body.theme-sunset .save-status .status-text.text-success {
    color: #d84315 !important;
}

/* Mystical Theme Specific */
body.theme-mystical .elementSingleLineInput .panel-heading {
    background: linear-gradient(135deg, #7e57c2 0%, #9e8cc2 100%);
}

body.theme-mystical .save-status .checkmark,
body.theme-mystical .save-status .status-text.text-success {
    color: #512da8 !important;
}

/* ========================================
   SUMMERNOTE GLOBAL COMPATIBILITY
   ======================================== */

/* Ensure Summernote components that might appear outside our container work */
.note-modal,
.note-popover,
.note-dropdown-menu,
.note-dialog,
.note-help-dialog {
    /* Prevent theme interference with Summernote's global components */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif !important;
    font-size: 14px !important;
    color: #212529 !important;
    background: white !important;
    z-index: 9999 !important;
}

    /* Reset any potential button styling interference */
    .note-modal .btn,
    .note-popover .btn,
    .note-dropdown-menu .btn {
        /* Ensure Summernote buttons render correctly */
        background: #6c757d !important;
        border: 1px solid #6c757d !important;
        color: white !important;
        padding: 0.375rem 0.75rem !important;
        border-radius: 0.25rem !important;
        font-size: 0.875rem !important;
        font-weight: 400 !important;
        line-height: 1.5 !important;
        text-transform: none !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .note-modal .btn-primary,
    .note-popover .btn-primary {
        background: #007bff !important;
        border-color: #007bff !important;
    }

    /* Ensure proper form control styling in Summernote dialogs */
    .note-modal .form-control,
    .note-dialog .form-control {
        border: 1px solid #ced4da !important;
        border-radius: 0.25rem !important;
        padding: 0.375rem 0.75rem !important;
        font-size: 1rem !important;
        background: white !important;
        color: #495057 !important;
    }

/* ========================================
   SUMMERNOTE COMPATIBILITY & SAFETY
   ======================================== */

/* Ensure Summernote has proper namespace and doesn't inherit unwanted styles */
.elementSingleLineInput .note-editor,
.elementSingleLineInput .note-editor * {
    box-sizing: border-box;
}

    /* Reset any potential CSS conflicts for Summernote components */
    .elementSingleLineInput .note-editor .note-editable,
    .elementSingleLineInput .note-editor .note-editable * {
        /* Reset transform and position that might interfere */
        transform: none !important;
        position: static !important;
    }

    .elementSingleLineInput .note-editor .note-editable {
        /* Ensure proper positioning for the editable area */
        position: relative !important;
    }

    /* Ensure Summernote buttons and controls work if they appear */
    .elementSingleLineInput .note-editor .note-btn,
    .elementSingleLineInput .note-editor .btn {
        /* Don't inherit our themed button styles */
        background: #f8f9fa !important;
        border: 1px solid #dee2e6 !important;
        color: #495057 !important;
        font-weight: normal !important;
        transform: none !important;
        border-radius: 0.25rem !important;
        padding: 0.375rem 0.75rem !important;
        font-size: 0.875rem !important;
        box-shadow: none !important;
    }

/* Ensure any Summernote modals or overlays work properly */
.note-modal,
.note-popover,
.note-dropdown-menu {
    /* Make sure these appear above our themed content */
    z-index: 9999 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif !important;
}

/* Preserve Summernote's air mode functionality if used */
.elementSingleLineInput .note-air-editor {
    /* Don't interfere with air mode styling */
    border: none !important;
    background: transparent !important;
}

/* Ensure placeholder text works correctly */
.elementSingleLineInput .note-placeholder {
    color: #6b7280 !important;
    font-style: italic !important;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Loading states */
.elementSingleLineInput.is-loading textarea,
.elementSingleLineInput.is-loading .note-editable {
    opacity: 0.7;
    pointer-events: none;
}

/* Error states */
.elementSingleLineInput.has-error {
    border-left-color: #ef4444;
    border-left-width: 5px;
}

    .elementSingleLineInput.has-error textarea,
    .elementSingleLineInput.has-error .note-editable {
        border-color: #ef4444;
    }

/* Success states */
.elementSingleLineInput.has-success {
    border-left-color: var(--primary);
    border-left-width: 5px;
}

    .elementSingleLineInput.has-success textarea,
    .elementSingleLineInput.has-success .note-editable {
        border-color: var(--primary);
    }

/* Hidden input mode */
.hiddenTextInput {
    display: none !important;
}

/* Unsaved data pulse animation */
.unsaved-data-notice {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}



/* Hide unwanted UI Elements showing */
.modal.note-modal,
#themed-ui-messages {
    display: none;
}

