/* BOZ.AI - FAQ Assistant Plugin Styles */

/* Assistant Button */
#faq-assistant-button {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.faq-branding {
    font-size: 10px;
    font-weight: 600;
    color: #667eea;
    text-align: center;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

#faq-assistant-button.position-bottom-right {
    bottom: 30px;
    right: 30px;
}

#faq-assistant-button.position-bottom-left {
    bottom: 30px;
    left: 30px;
}

#faq-assistant-button.position-top-right {
    top: 30px;
    right: 30px;
}

#faq-assistant-button.position-top-left {
    top: 30px;
    left: 30px;
}

#generate-faq-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    color: white;
    padding: 15px 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

#generate-faq-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#generate-faq-btn:active {
    transform: translateY(0);
}

#generate-faq-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.faq-icon {
    font-size: 16px;
}

#faq-loading {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 12px;
    margin-top: 10px;
    text-align: center;
}

/* Full-screen loading overlay */
#faq-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999999;
    display: none;
    justify-content: center;
    align-items: center;
}

#faq-loading-overlay .loading-content {
    background: #2c3e50;
    color: white;
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 400px;
}

#faq-loading-overlay .loading-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
}

#faq-loading-overlay .loading-message {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.5;
}

/* Dual circle loading spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    position: relative;
}

/* Inner circle - clockwise rotation with 1/4 gap at bottom */
.loading-spinner::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid transparent;
    border-top: 3px solid #3498db;
    border-right: 3px solid #3498db;
    border-left: 3px solid #3498db;
    border-radius: 50%;
    animation: spinClockwise 1s linear infinite;
}

/* Outer circle - counterclockwise rotation with 1/4 gap at top */
.loading-spinner::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border: 3px solid transparent;
    border-bottom: 3px solid #667eea;
    border-right: 3px solid #667eea;
    border-left: 3px solid #667eea;
    border-radius: 50%;
    animation: spinCounterClockwise 1.5s linear infinite;
}

@keyframes spinClockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spinCounterClockwise {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

/* FAQ Container */
#faq-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2c3e50;
    color: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 80vh;
    width: 900px;
    z-index: 999999;
    overflow: hidden;
}

#faq-header {
    background: #34495e;
    color: white;
    padding: 20px;
    border-bottom: 1px solid #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
}

#faq-header h3 {
    margin: 0;
    font-size: 18px;
    color: white !important;
}

#detected-language {
    font-size: 12px;
    font-weight: normal;
    color: #666;
    display: block;
}

#faq-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#faq-controls button {
    background: #3498db;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s ease;
}

#faq-controls button:hover {
    background: #2980b9;
}

#toggle-edit-mode-btn {
    background: #e67e22 !important;
}

#toggle-edit-mode-btn:hover {
    background: #d35400 !important;
}

#faq-controls button.active {
    background: #e74c3c;
}

/* Ensure toggle edit mode button appears last when in edit mode */
#toggle-edit-mode-btn.active {
    order: 999;
    margin-left: auto;
}

#delete-all-faq-btn {
    background: #e74c3c !important;
}

#delete-all-faq-btn:hover {
    background: #c0392b !important;
}

#analyze-content-btn {
    background: #9b59b6 !important;
}

#analyze-content-btn:hover {
    background: #8e44ad !important;
}

#customize-guide-btn {
    background: #27ae60 !important;
}

#customize-guide-btn:hover {
    background: #229954 !important;
}

#creative-mode-label {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 8px 16px;
    font-size: 12px;
    color: #ffffff;
    cursor: pointer;
    background: #7f8c8d;
    border-radius: 4px;
    border: none;
    transition: all 0.2s ease;
    user-select: none;
    line-height: 1;
    box-sizing: border-box;
    height: auto;
}

#creative-mode-label:hover {
    background: #95a5a6;
}

#creative-mode-label.active {
    background: #27ae60;
}

#creative-mode-label.active:hover {
    background: #2ecc71;
}

#creative-mode-checkbox {
    display: none;
}

/* Make creative mode icon white */
.creative-mode-text {
    filter: grayscale(1) brightness(0) invert(1);
}

#faq-content {
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
}

#faq-actions {
    border-top: 1px solid #eee;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
}

#faq-info {
    flex: 1;
}

#faq-action-buttons {
    display: flex;
    gap: 10px;
}

#faq-container button {
    border: none !important;
}

.faq-edit-controls button {
    padding: inherit !important;
}

#faq-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#save-faq-btn {
    background: #28a745;
    color: white;
}

#save-faq-btn:hover {
    background: #218838;
}

#cancel-faq-btn {
    background: #6c757d;
    color: white;
}

#cancel-faq-btn:hover {
    background: #5a6268;
}

/* FAQ Accordion */
.faq-accordion {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
}

.faq-item {
    border-bottom: 1px solid #e1e5e9;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    background: #34495e;
    color: white;
    padding: 18px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
    outline: none;
}

.faq-question:hover,
.faq-question:focus {
    background: #3d566e;
}

.faq-question.active {
    background: #1e3a5f;
    border-left: 4px solid #3498db;
}

.faq-question-text {
    font-weight: 600;
    color: #000000;
    flex: 1;
    font-size: 16px;
    line-height: 1.4;
}

.faq-toggle {
    font-size: 20px;
    font-weight: bold;
    color: #3498db;
    margin-left: 15px;
    transition: transform 0.2s ease;
}

.faq-question.active .faq-toggle {
    transform: rotate(45deg);
}

.faq-answer {
    background: #2c3e50;
    color: white;
    padding: 20px;
    border-left: 4px solid #34495e;
}

.faq-answer p {
    margin: 0;
    color: #000000;
    line-height: 1.6;
    font-size: 15px;
}

/* Edit Controls */
.faq-edit-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    background: #2c3e50;
    border-bottom: 1px solid #2c3e50;
    justify-content: flex-end;
}

.faq-edit-controls button {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    padding: 4px 8px;
    border-radius: 5px !important;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.faq-edit-controls span {
    background: transparent !important;
    border: none !important;
    color: #ffffff !important;
    padding: 4px 8px;
    border-radius: 5px !important;
    font-size: 14px;
    transition: all 0.2s ease;
}

.faq-edit-controls button:hover {
    opacity: 0.4;
}

.faq-edit-controls .faq-edit-btn:hover {
    opacity: 0.4;
}

.faq-edit-controls .faq-delete-btn:hover {
    opacity: 0.4;
}

.faq-drag-handle {
    cursor: move;
    color: #ffffff !important;
    padding: 4px 8px;
    font-size: 14px;
    user-select: none;
    background: transparent !important;
    border: none !important;
    border-radius: 5px !important;
    transition: all 0.2s ease;
}

.faq-drag-handle:hover {
    opacity: 0.4;
}

/* Lock button styling */
.faq-lock-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 3px;
    transition: all 0.2s ease;
    color: #ffffff !important;
}

.faq-lock-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Locked item styling - only show in FAQ container popup, not on website */
#faq-container .faq-item.faq-locked {
    border-left: 4px solid #e74c3c !important;
}

/* Sortable states */
.faq-accordion.edit-mode .faq-item {
    border: 2px dashed transparent;
    transition: border-color 0.2s ease;
}

.faq-accordion.edit-mode .faq-item:hover {
    border-color: #3498db;
}

.ui-sortable-helper {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3) !important;
    transform: rotate(2deg);
}

.ui-sortable-placeholder {
    background: #34495e !important;
    border: 2px dashed #3498db !important;
    min-height: 60px;
}

/* FAQ Item Modal */
#faq-item-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#faq-modal-content {
    background: #2c3e50;
    color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#faq-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #34495e;
}

#faq-modal-header h4 {
    margin: 0;
    font-size: 18px;
}

#faq-modal-close {
    font-size: 24px;
    cursor: pointer;
    color: #95a5a6;
    line-height: 1;
}

#faq-modal-close:hover {
    color: #ecf0f1;
}

#faq-modal-body {
    padding: 20px;
}

.faq-form-group {
    margin-bottom: 20px;
}

.faq-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #ecf0f1;
}

.faq-form-group input,
.faq-form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #34495e;
    border-radius: 4px;
    background: #34495e;
    color: #ecf0f1;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
}

.faq-form-group input:focus,
.faq-form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.faq-form-group textarea {
    resize: vertical;
    min-height: 100px;
}

#faq-modal-actions {
    padding: 20px;
    border-top: 1px solid #34495e;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

#faq-modal-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#faq-modal-save-btn {
    background: #27ae60;
    color: white;
}

#faq-modal-save-btn:hover {
    background: #229954;
}

#faq-modal-cancel-btn {
    background: #95a5a6;
    color: white;
}

#faq-modal-cancel-btn:hover {
    background: #7f8c8d;
}

/* Notices */
.faq-notice {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 25px;
    border-radius: 6px;
    font-weight: 600;
    z-index: 1000000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.faq-notice.faq-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.faq-notice.faq-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Responsive Design */
@media (max-width: 768px) {
    #faq-assistant-button {
        bottom: 20px;
        right: 20px;
    }
    
    #generate-faq-btn {
        padding: 12px 20px;
        font-size: 13px;
    }
    
    #faq-container {
        width: 95vw;
        max-height: 85vh;
    }
    
    .faq-question {
        padding: 15px;
    }
    
    .faq-question-text {
        font-size: 15px;
    }
    
    .faq-answer {
        padding: 15px;
    }
    
    .faq-answer p {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    #generate-faq-btn {
        padding: 10px 16px;
        font-size: 12px;
    }
    
    .faq-icon {
        font-size: 14px;
    }
    
    #faq-actions {
        flex-direction: column;
    }
    
    #faq-actions button {
        width: 100%;
        margin-bottom: 5px;
    }
}

/* Animation for FAQ container */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

#faq-container {
    animation: slideInUp 0.3s ease-out;
}

/* Accessibility improvements */
.faq-question:focus {
    outline: none;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    #faq-container {
        background: #2c3e50;
        color: white;
    }
    
    .faq-question {
        background: #34495e;
        color: white;
    }
    
    .faq-question:hover,
    .faq-question:focus {
        background: #3d566e;
    }
    
    .faq-question.active {
        background: #1e3a5f;
    }
    
    .faq-answer {
        background: #2c3e50;
        border-left-color: #34495e;
    }
    
    .faq-answer p {
        color: #000000;
    }
    
    #faq-actions {
        background: #34495e;
        border-top-color: #4a5f7a;
    }
}

/* Loading animation */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

#faq-loading {
    animation: pulse 1.5s infinite;
}

/* Smooth scrolling for FAQ items */
.faq-answer {
    transition: max-height 0.3s ease-in-out;
}

/* Custom scrollbar for FAQ content */
#faq-content::-webkit-scrollbar {
    width: 8px;
}

#faq-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#faq-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#faq-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Draggable popup styles */
.dragging-popup {
    user-select: none;
    cursor: move;
}

#faq-header {
    cursor: move;
}

#faq-header:active {
    cursor: grabbing;
}

/* Custom guide selector styles */
#guide-mode-selector {
    font-family: inherit;
    transition: all 0.2s ease;
}

#guide-mode-selector:focus {
    outline: none;
    border-color: #3498db !important;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

#guide-mode-selector:hover {
    border-color: #5a6c7d;
}

/* Custom guide container styles */
#custom-guide-container {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 300px;
        padding-top: 20px;
        padding-bottom: 20px;
    }
}