/* Email Review Page Specific Styles */

/* TinyMCE Editor Customization */
.tox-tinymce {
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
}

.tox .tox-editor-header {
    background-color: #f8f9fa !important;
    border-bottom: 1px solid #dee2e6 !important;
}

.tox .tox-toolbar__primary {
    background-color: #f8f9fa !important;
}

.tox .tox-statusbar {
    background-color: #f8f9fa !important;
    border-top: 1px solid #dee2e6 !important;
}

/* Form section styling */
.form-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

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

.form-section h5 {
    color: #2B3C6B;
    margin-bottom: 15px;
    font-weight: 600;
}

.form-section h6 {
    color: #445082;
    font-weight: bold;
    margin-bottom: 10px;
}

.form-section .form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 8px;
}

.form-section .form-control,
.form-section .form-select {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 10px;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-section .form-control:focus,
.form-section .form-select:focus {
    border-color: #445082;
    box-shadow: 0 0 0 0.2rem rgba(68, 80, 130, 0.25);
}

/* Main action buttons */
.btn-primary {
    background-color: #445082;
    border-color: #445082;
    color: white;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: #3a4370;
    border-color: #3a4370;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(68, 80, 130, 0.3);
}

/* Send Story Button - Primary Action */
#approveAndSendBtn {
    background-color: #10b981;
    border-color: #10b981;
    color: white;
    font-weight: 600;
    padding: 12px 20px;
}

#approveAndSendBtn:hover {
    background-color: #059669;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(16, 185, 129, 0.3);
}


/* Email preview styling */
.email-preview {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
}

.email-preview h6 {
    color: #2B3C6B;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.preview-content {
    line-height: 1.6;
    color: #495057;
}

.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4,
.preview-content h5,
.preview-content h6 {
    color: #2B3C6B;
}

/* Copy email button */
#copyEmailBtn {
    color: #445082;
    border-color: #445082;
}

#copyEmailBtn:hover {
    background-color: #445082;
    border-color: #445082;
    color: white;
}

/* Test email section */
.test-email-section {
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 15px;
    margin-top: 15px;
}

/* Auto-save indicator */
.auto-save-indicator {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.auto-save-indicator.saving {
    color: #ffc107;
}

.auto-save-indicator.saved {
    color: #28a745;
}

/* Email Review Layout Styles */
.email-review-container {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: calc(100vh - 200px);
}

.email-config-panel .form-section {
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

/* Portrait orientation responsive adjustments */
@media screen and (orientation: portrait) {
    .email-review-container {
        min-height: calc(100vh - 180px);
        gap: 15px;
    }
    
    .email-config-panel {
        width: 280px;
    }
}

/* For very tall screens in portrait */
@media screen and (orientation: portrait) and (min-height: 800px) {
    .email-review-container {
        min-height: calc(100vh - 160px);
    }
}

.email-config-panel {
    width: 300px;
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    height: fit-content;
    max-height: 100%;
    overflow-y: auto;
}

.email-preview-panel {
    flex: 1;
    background-color: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.preview-modes {
    display: flex;
    gap: 5px;
}

.preview-mode-btn {
    padding: 5px 12px;
    border: 1px solid #ccc;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.preview-mode-btn.active {
    background-color: #445082;
    color: white;
    border-color: #445082;
}

.email-content-area {
    padding: 0;
    flex: 1;
    height: calc(100% - 60px); /* Full height minus header */
    min-height: 400px;
}

.email-content-area #emailContent {
    width: 100% !important;
    height: 100% !important;
    border: none;
}

/* Additional responsive improvements */
@media screen and (max-width: 768px) {
    .email-review-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .email-config-panel {
        width: 100%;
        height: auto;
    }
    
    /* Mobile-specific fixes for TinyMCE */
    .email-content-area {
        height: 400px; /* Fixed height on mobile instead of percentage */
        min-height: 400px;
        flex: none; /* Remove flex sizing on mobile */
    }
    
    .email-content-area #emailContent {
        height: 400px !important; /* Fixed height for mobile */
    }
    
    /* Ensure TinyMCE iframe has proper dimensions on mobile */
    .email-content-area iframe {
        height: 400px !important;
        min-height: 400px !important;
    }
    
    /* Hide preview mode buttons on very small screens */
    @media screen and (max-width: 480px) {
        .preview-modes {
            display: none;
        }
    }
}


/* Status badge styling */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-draft {
    background-color: #ffc107;
    color: #000;
}

.status-review {
    background-color: #17a2b8;
    color: white;
}

.status-approved {
    background-color: #28a745;
    color: white;
}

.status-sent {
    background-color: #6c757d;
    color: white;
}

.status-scheduled {
    background-color: #17a2b8;
    color: white;
}

/* Action buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.action-buttons .btn {
    width: 100%;
}

/* Test and outline button styles */
.form-section .btn-outline-primary {
    color: #445082;
    border-color: #445082;
}

.form-section .btn-outline-primary:hover {
    background-color: #445082;
    border-color: #445082;
    color: white;
}

/* Scheduled Info Card */
.scheduled-info-card {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 4px 8px rgba(23, 162, 184, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.scheduled-info-card h6 {
    color: white;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 1rem;
}

.scheduled-details {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.scheduled-time,
.scheduled-countdown {
    font-size: 0.95rem;
    line-height: 1.6;
}

.scheduled-countdown span {
    color: #fff4a3 !important;
    font-weight: 600;
}

.scheduled-actions {
    display: flex;
    justify-content: center;
    margin-top: 15px;
}

.scheduled-actions .btn {
    min-width: 150px;
}

.scheduled-actions .btn-outline-warning {
    color: white;
    border-color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.scheduled-actions .btn-outline-warning:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.8);
    color: white;
}

.scheduled-actions .btn-outline-danger {
    color: white;
    border-color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.scheduled-actions .btn-outline-danger:hover {
    background-color: rgba(220, 53, 69, 0.9);
    border-color: #dc3545;
    color: white;
}

/* Schedule Modal Styling */
#scheduleModal .modal-header {
    background-color: #445082;
    color: white;
    border-bottom: none;
    padding: 20px 24px;
}

#scheduleModal .modal-title {
    font-weight: 600;
    font-size: 1.25rem;
}

#scheduleModal .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

#scheduleModal .btn-close:hover {
    opacity: 1;
}

#scheduleModal .alert-light {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

#scheduleModal .form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 8px;
}

#scheduleModal .form-text {
    font-size: 0.85rem;
    color: #6c757d;
}

#scheduleModal .alert-warning {
    background-color: #fff4e5;
    border-color: #ffa726;
    color: #e65100;
}

#scheduleModal .alert-warning i {
    color: #ffa726;
}

#scheduleModal .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #dee2e6;
}

#scheduleModal .modal-footer .btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
    font-weight: 500;
    padding: 10px 24px;
}

#scheduleModal .modal-footer .btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

#scheduleModal .modal-footer .btn-primary {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: white;
    font-weight: 600;
    padding: 10px 24px;
}

#scheduleModal .modal-footer .btn-primary:hover {
    background-color: #138496;
    border-color: #117a8b;
    box-shadow: 0 2px 6px rgba(23, 162, 184, 0.3);
}

#scheduleModal .modal-footer .btn-primary:disabled {
    background-color: #a8dadc;
    border-color: #a8dadc;
    cursor: not-allowed;
    opacity: 0.6;
}

#scheduleValidation .alert {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Schedule Button Styling */
#scheduleSendBtn {
    background-color: transparent;
    border: 2px solid #17a2b8;
    color: #17a2b8;
    font-weight: 500;
    transition: all 0.2s ease;
}

#scheduleSendBtn:hover {
    background-color: #17a2b8;
    border-color: #17a2b8;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(23, 162, 184, 0.3);
}

#sendTestBtn {
    color: #445082;
    border-color: #445082;
}

#sendTestBtn:hover {
    background-color: #445082;
    border-color: #445082;
    color: white;
}

/* Additional button styles */
.btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
}

.btn-outline-danger:hover {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
    color: #212529;
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
    color: white;
}

/* Email picker select - truncate displayed text and ensure arrow is visible */
.email-picker-select {
    display: block;
    width: 100%;
    padding-right: 2.5rem !important; /* Space for native dropdown arrow */
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

/* Full text in dropdown options */
.email-picker-select option {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    padding-right: 10px;
}

/* Enhanced dropdown item display for mentions */
.dropdown-item > div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Keyboard navigation highlight for dropdown items */
.dropdown-item.active,
.dropdown-item:focus {
    background-color: #445082;
    color: #fff !important;
    outline: none;
}

.dropdown-item.active > div {
    color: #fff !important;
}