/* ===================================
   Organization Content Pages Styles
   Shared styles for all org pages
   =================================== */

/* Page Title in Header Styles */
.lakely-header-bg h2 {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    margin-bottom: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Title Divider - Subtle horizontal line between org name and page title */
.title-divider {
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.6) 50%, transparent 100%);
    margin: 1rem auto 0.5rem auto;
    border-radius: 1px;
}

/* Responsive adjustments for header titles */
@media (max-width: 768px) {
    .lakely-header-bg h2 {
        font-size: 1.75rem;
        margin-top: 1rem;
    }
    
    .title-divider {
        width: 40px;
        margin: 0.75rem auto 0.5rem auto;
    }
}

/* Section Container Styles */
.section-container {
    border-radius: 8px;
    padding: 2rem;
    transition: all 0.3s ease;
}

.section-disabled {
    background-color: #f8f9fa;
    opacity: 0.6;
    border: 2px dashed #dee2e6;
}

.section-disabled h2 {
    color: #6c757d;
}

.section-disabled-message {
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

/* Editor Mode Styles */
.prose-editor {
    min-height: 300px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
}

.prose-editor-toolbar {
    border-bottom: 1px solid #ddd;
    padding: 8px;
    background-color: #f8f9fa;
}

/* Prose Editor Loading States - Prevents FOUC */
textarea[data-django-prose-editor-configurable] {
    /* Style the textarea to look more like the final editor */
    min-height: 300px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background-color: #ffffff;
    transition: all 0.3s ease;
    resize: vertical;
}

textarea[data-django-prose-editor-configurable]:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: 0;
}

/* Loading state for prose editor initialization */
.prose-editor-loading {
    position: relative;
}

/* Hide the textarea while loading */
.prose-editor-loading textarea[data-django-prose-editor-configurable] {
    opacity: 0;
    pointer-events: none;
}

.prose-editor-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    z-index: 10;
    min-height: 300px;
}

.prose-editor-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    z-index: 11;
    animation: spin 1s linear infinite;
}

/* Add loading text below the spinner */
.prose-editor-loading .loading-text {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    color: #6c757d;
    z-index: 11;
    font-weight: 500;
    text-align: center;
    margin-top: 30px;
    white-space: nowrap;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Show the textarea and hide loading state once editor is initialized */
.prose-editor-initialized textarea[data-django-prose-editor-configurable] {
    opacity: 1;
    pointer-events: auto;
}

.prose-editor-initialized::before,
.prose-editor-initialized::after,
.prose-editor-initialized .loading-text {
    display: none;
}

/* Smooth transition when editor initializes */
.prose-editor-container {
    transition: opacity 0.3s ease;
}

.prose-editor-container.initializing {
    opacity: 0.9;
}

.prose-editor-container.initialized {
    opacity: 1;
}

/* ProseMirror editor styling improvements */
.ProseMirror {
    min-height: 250px;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 0 0 6px 6px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    background-color: #ffffff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.ProseMirror:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: 0;
}

/* Make empty paragraphs take up space for visual spacing */
.ProseMirror p:empty::before,
.prose-editor-output p:empty::before {
    content: '\00a0';
    display: inline;
}

/* Constrain images to container width */
.ProseMirror img,
.prose-editor-output img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0;
}

/* Image alignment based on image's own text-align style */
.ProseMirror img[style*="text-align: center"],
.prose-editor-output img[style*="text-align: center"] {
    margin-left: auto;
    margin-right: auto;
}

.ProseMirror img[style*="text-align: right"],
.prose-editor-output img[style*="text-align: right"] {
    margin-left: auto;
    margin-right: 0;
}

.ProseMirror img[style*="text-align: left"],
.prose-editor-output img[style*="text-align: left"] {
    margin-left: 0;
    margin-right: auto;
}

/* Also support alignment based on parent container */
.ProseMirror[style*="text-align: center"] img,
.ProseMirror p[style*="text-align: center"] img,
.prose-editor-output[style*="text-align: center"] img,
.prose-editor-output p[style*="text-align: center"] img {
    margin-left: auto;
    margin-right: auto;
}

.ProseMirror[style*="text-align: right"] img,
.ProseMirror p[style*="text-align: right"] img,
.prose-editor-output[style*="text-align: right"] img,
.prose-editor-output p[style*="text-align: right"] img {
    margin-left: auto;
    margin-right: 0;
}

.ProseMirror[style*="text-align: left"] img,
.ProseMirror p[style*="text-align: left"] img,
.prose-editor-output[style*="text-align: left"] img,
.prose-editor-output p[style*="text-align: left"] img {
    margin-left: 0;
    margin-right: auto;
}

/* Toolbar styling to match Bootstrap */
.ProseMirror-menubar {
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.ProseMirror-menu-item {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #495057;
}

.ProseMirror-menu-item:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.ProseMirror-menu-item.ProseMirror-menu-active {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

/* Loading spinner animation */
@keyframes prose-editor-loading {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.prose-editor-loading::before {
    background: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 50%, #f8f9fa 100%);
    background-size: 200px 100%;
    animation: prose-editor-loading 1.5s ease-in-out infinite;
}

/* Section Editor Container */
.section-editor-container {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    background-color: #ffffff;
    margin-bottom: 1.5rem;
}

.section-header {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.section-editor.section-disabled {
    background-color: #f8f9fa;
    opacity: 0.6;
    border-radius: 4px;
}

/* Form Controls */
.form-check-input:checked {
    background-color: #198754;
    border-color: #198754;
}

.save-section-btn {
    min-width: 120px;
    transition: all 0.3s ease;
}

.save-section-btn.btn-success {
    background-color: #198754;
    border-color: #198754;
}

/* Messages Container */
.messages-container .alert {
    margin-bottom: 1rem;
}

/* Gallery Styles (when used in content pages) */
.gallery-section {
    margin-top: 2rem;
}

.gallery-section h3 {
    margin-bottom: 1.5rem;
    color: #333;
}

.gallery-empty {
    text-align: center;
    padding: 3rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    color: #6c757d;
}

.gallery-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Dark mode styles for gallery empty state */
body.dark-mode .gallery-empty {
    background-color: #2d2d2d;
    color: #b0b0b0;
}

body.dark-mode .gallery-empty h4 {
    color: #ffffff;
}

body.dark-mode .gallery-empty i {
    color: #808080;
}

/* Edit Mode Banner */
.edit-mode-banner {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

/* Disabled Sections Alert */
.persistent-alert {
    background: linear-gradient(135deg, #e3f2fd 0%, #f8f9fa 100%);
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Container Width Constraints for Wide Monitors */
.container {
    max-width: 1200px;
}

/* Additional constraint for extremely wide monitors */
@media (min-width: 1400px) {
    .container {
        max-width: 1140px;
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .section-container {
        padding: 1rem;
    }
    
    .section-editor-container {
        padding: 1rem;
    }
    
    .prose-editor {
        min-height: 200px;
    }
}

/* ===================================
   Organization Card Donation Button
   =================================== */

/* Donation button styling */
.donate-btn {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    background-color: #f8f9fa !important;
    border-color: #dee2e6 !important;
    color: #6c757d !important;
    cursor: not-allowed;
    opacity: 0.75;
}

.donate-btn:hover {
    background-color: #e9ecef !important;
    border-color: #ced4da !important;
}

.donate-info-icon {
    font-size: 0.75rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.donate-info-icon:hover {
    opacity: 1;
}
