/* FAQ Groups Admin Styling */

/* Main Container */
#faq-group-container {
    background: #fff;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    border-radius: 4px;
}

/* Header Section */
.faq-group-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
    border-radius: 4px 4px 0 0;
}

.faq-group-header .button {
    margin-right: 10px;
    margin-bottom: 0;
}

/* FAQ Question Rows */
.faq-question-row {
    border-bottom: 1px solid #eee;
    background: #fff;
    transition: all 0.3s ease;
    position: relative;
}

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

.faq-question-row:hover {
    background: #fafafa;
}

.faq-question-row.ui-sortable-helper {
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transform: rotate(2deg);
}

/* Question Header */
.faq-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9f9f9;
    cursor: move;
    border-bottom: 1px solid #eee;
    position: relative;
}

.faq-question-header::before {
    content: "⋮⋮";
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #ccc;
    font-size: 12px;
    line-height: 1;
}

.faq-question-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #23282d;
    margin-left: 15px;
}

.faq-question-actions {
    display: flex;
    align-items: center;
}

.faq-question-actions .button {
    margin-left: 5px;
    padding: 6px 10px;
    min-height: auto;
    border-radius: 3px;
    font-size: 12px;
}

.faq-toggle-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.faq-remove-btn {
    color: #d63638;
    border-color: #d63638;
}

.faq-remove-btn:hover {
    background: #d63638;
    color: white;
}

/* Question Content */
.faq-question-content {
    padding: 20px;
    background: #fff;
}

.faq-field {
    margin-bottom: 20px;
}

.faq-field:last-child {
    margin-bottom: 0;
}

.faq-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #23282d;
    font-size: 13px;
}

.faq-field input[type="text"],
.faq-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.faq-field input[type="text"]:focus,
.faq-field textarea:focus {
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
    outline: none;
}

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

/* Sortable Placeholder */
.faq-placeholder {
    height: 80px;
    background: #f0f0f0;
    border: 2px dashed #ccc;
    border-radius: 4px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-style: italic;
}

.faq-placeholder::before {
    content: "Drop FAQ here";
}

/* Shortcode Display */
.shortcode-display {
    padding: 15px;
}

.shortcode-display label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #23282d;
}

.shortcode-display input[type="text"] {
    width: 100%;
    margin: 10px 0;
    background: #f9f9f9;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    color: #0073aa;
}

.shortcode-display .description {
    margin-top: 5px;
    color: #666;
    font-size: 12px;
    font-style: italic;
}

/* Column Shortcode Display */
.shortcode-display-input {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.shortcode-display-input:hover {
    background: #e9ecef !important;
}

/* Modal Styles */
.ai-faq-modal {
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ai-faq-modal-content {
    background-color: #fff;
    margin: 5% auto;
    border: 1px solid #ccc;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
    max-height: 90vh;
    overflow: hidden;
}

@keyframes modalSlideIn {
    from { 
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ai-faq-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.ai-faq-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #23282d;
}

.ai-faq-modal-close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    transition: color 0.2s ease;
    line-height: 1;
    padding: 5px;
}

.ai-faq-modal-close:hover,
.ai-faq-modal-close:focus {
    color: #333;
}

.ai-faq-modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.ai-faq-field {
    margin-bottom: 25px;
}

.ai-faq-field:last-child {
    margin-bottom: 0;
}

.ai-faq-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #23282d;
    font-size: 14px;
}

.ai-faq-field input[type="text"],
.ai-faq-field textarea {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.ai-faq-field input[type="text"]:focus,
.ai-faq-field textarea:focus {
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
    outline: none;
}

.ai-faq-field .description {
    margin-top: 8px;
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

.ai-faq-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e5e5e5;
    text-align: right;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.ai-faq-modal-footer .button {
    margin-left: 10px;
    padding: 8px 16px;
    font-size: 14px;
}

/* Loading State */
#ai-faq-group-loading {
    text-align: center;
    padding: 30px 20px;
    color: #666;
}

#ai-faq-group-loading p {
    margin-bottom: 20px;
    font-size: 16px;
}

.ai-faq-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: ai-faq-spin 1s linear infinite;
}

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

/* Error State */
#ai-faq-group-error {
    margin-top: 15px;
    padding: 12px 15px;
    background: #fff2f2;
    border: 1px solid #ffcccc;
    border-radius: 4px;
}

#ai-faq-group-error p {
    margin: 0;
    color: #d63638;
    font-size: 14px;
}

/* Empty State */
#faq-questions-list:empty::before {
    content: "No FAQs added yet. Click 'Generate FAQs with AI' or 'Add Question Manually' to get started.";
    display: block;
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 4px;
    margin: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-faq-modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .faq-question-header {
        padding: 12px 15px;
    }
    
    .faq-question-content {
        padding: 15px;
    }
    
    .ai-faq-modal-body {
        padding: 20px;
    }
    
    .ai-faq-modal-header,
    .ai-faq-modal-footer {
        padding: 15px 20px;
    }
    
    .faq-group-header {
        padding: 15px;
    }
    
    .faq-group-header .button {
        display: block;
        width: 100%;
        margin-bottom: 10px;
        margin-right: 0;
        text-align: center;
    }
}

/* WordPress Admin Compatibility */
.post-type-logicrays_aifaq_group .wp-list-table .column-shortcode {
    width: 250px;
}

.post-type-logicrays_aifaq_group #poststuff h2 {
    margin-bottom: 15px;
}

/* Accessibility Improvements */
.faq-question-row:focus-within {
    box-shadow: 0 0 0 2px #007cba;
    border-radius: 4px;
}

.button:focus {
    box-shadow: 0 0 0 2px #007cba;
}

/* Animation for adding/removing FAQ items */
.faq-question-row {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Success State */
.faq-success-message {
    background: #f0f6fc;
    border: 1px solid #c3e6ff;
    color: #0073aa;
    padding: 12px 15px;
    border-radius: 4px;
    margin: 15px 0;
    animation: slideDown 0.3s ease;
}

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

/**
 * FAQ Groups Admin Styles
 *
 * @package Logicrays_AI_FAQ_Builder
 */

/* Current Settings Info */
.faq-current-settings {
    background: #f9f9f9;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* FAQ Group Container */
#faq-group-container {
    margin-top: 20px;
}

.faq-group-header {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

/* FAQ Questions List */
#faq-questions-list {
    margin-top: 20px;
}

.faq-question-row {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 15px;
    padding: 15px;
}

.faq-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.faq-question-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.faq-question-actions {
    display: flex;
    gap: 5px;
}

.faq-toggle-btn,
.faq-remove-btn {
    padding: 4px 8px !important;
    min-height: 30px;
    line-height: 1;
}

.faq-question-content {
    display: none;
}

.faq-field {
    margin-bottom: 15px;
}

.faq-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.faq-field input[type="text"],
.faq-field textarea {
    width: 100%;
}

.faq-answer-textarea {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* AI Modal */
.ai-faq-modal {
    display: none;
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.ai-faq-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.ai-faq-modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.ai-faq-modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.ai-faq-modal-close:hover,
.ai-faq-modal-close:focus {
    color: #000;
}

.ai-faq-modal-body {
    padding: 20px;
}

.ai-faq-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #ddd;
    text-align: right;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.ai-faq-field {
    margin-bottom: 20px;
}

.ai-faq-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.ai-faq-field input[type="text"],
.ai-faq-field textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.ai-faq-field .description {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* Loading Spinner */
#ai-faq-group-loading {
    text-align: center;
    padding: 20px 0;
}

.ai-faq-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 10px auto;
}

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

/* Error Display */
#ai-faq-group-error {
    margin-top: 15px;
    padding: 10px;
}

/* Shortcode Display */
.shortcode-display {
    padding: 10px;
}

.shortcode-display input[type="text"] {
    font-family: monospace;
    background: #f9f9f9;
    padding: 8px;
    margin: 10px 0;
}

.shortcode-display h4 {
    margin-top: 15px;
    margin-bottom: 10px;
}

.shortcode-display code {
    background: #f9f9f9;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

/* FAQ Count Badge */
.faq-count-badge {
    display: inline-block;
    background: #2271b1;
    color: #fff;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
}

/* Settings Notice */
.faq-settings-notice ul {
    list-style: disc;
    padding-left: 20px;
    margin: 10px 0;
}

.faq-settings-notice h4 {
    margin-top: 15px;
    margin-bottom: 10px;
}