/**
 * Pbc_ProductQuestions Extension
 * 
 * Frontend CSS styles - Porto Theme Integration
 * 
 * @category   Pbc
 * @package    Pbc_ProductQuestions
 * @copyright  Copyright (c) 2025 PBC
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */

/* Porto Theme Integration */
.product-faq-section {
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Product Questions Main Container */
.product-questions {
    padding: 20px 0;
    font-family: inherit;
}

/* Questions Summary */
.questions-summary {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.questions-title {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.questions-count {
    font-size: 18px;
    color: #666;
    font-weight: normal;
}

.questions-description {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Questions List */
.questions-list {
    margin-bottom: 30px;
}

.question-item {
    margin-bottom: 25px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.question-item.answered {
    border-left: 4px solid #4CAF50;
}

.question-item.unanswered {
    border-left: 4px solid #FFC107;
}

/* Question Styles */
.question {
    margin-bottom: 15px;
}

.question-text {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.question-icon {
    color: #2196F3;
    font-weight: bold;
    font-size: 20px;
    flex-shrink: 0;
}

.question-meta {
    font-size: 13px;
    color: #999;
    margin-left: 30px;
}

.question-author,
.question-date {
    margin-right: 15px;
}

/* Answer Styles */
.answer {
    padding-left: 15px;
    border-left: 2px solid #f0f0f0;
}

.answer.pending {
    border-left-color: #FFC107;
}

.answer-text {
    font-size: 16px;
    font-weight: normal;
    color: #333;
    margin: 0 0 8px 0;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.answer-icon {
    color: #4CAF50;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
}

.answer-meta {
    font-size: 13px;
    color: #999;
    margin-left: 28px;
}

.answer-author,
.answer-date {
    margin-right: 15px;
}

.answer-pending {
    color: #999;
    font-style: italic;
    margin: 0;
    margin-left: 28px;
}

/* No Questions State */
.no-questions {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.no-questions-message {
    font-size: 16px;
    margin: 10px 0;
}

/* Ask Question Section */
.ask-question-section {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.ask-question-header h4 {
    font-size: 20px;
    color: #333;
    margin: 0 0 10px 0;
}

.ask-question-header p {
    color: #666;
    margin: 0 0 20px 0;
    font-size: 14px;
}

.ask-question-button {
    background: #2196F3;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.ask-question-button:hover {
    background: #1976D2;
}

.ask-question-button span {
    display: inline;
}

/* Question Form Modal */
.question-form-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

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

.modal-header h3 {
    margin: 0;
    font-size: 22px;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 25px 25px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Form Fields */
.field {
    margin-bottom: 20px;
}

.field label {
    display: block;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    font-size: 14px;
}

.field label em {
    color: #e74c3c;
    font-style: normal;
}

.input-box {
    position: relative;
}

.input-text {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.input-text:focus {
    border-color: #2196F3;
    outline: none;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.2);
}

textarea.input-text {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.input-box small {
    display: block;
    color: #666;
    font-size: 12px;
    margin-top: 5px;
}

/* Character Counter */
.char-counter {
    position: absolute;
    bottom: -20px;
    right: 0;
    font-size: 12px;
    color: #666;
}

.char-counter.warning {
    color: #ff9800;
}

.char-counter.error {
    color: #f44336;
}

/* Buttons */
.button {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.button:hover {
    background: #e0e0e0;
    text-decoration: none;
}

.button.submit {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.button.submit:hover {
    background: #45a049;
    border-color: #45a049;
}

.button.cancel {
    background: #f44336;
    color: white;
    border-color: #f44336;
}

.button.cancel:hover {
    background: #da190b;
    border-color: #da190b;
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button span {
    display: inline;
}

/* Porto Theme Integration */
.product-tabs .tab-title.questions {
    position: relative;
}

.product-tabs .tab-title.questions .questions-count {
    background: #2196F3;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .product-questions {
        padding: 15px 0;
    }
    
    .questions-title {
        font-size: 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .question-item {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .question-text {
        font-size: 16px;
        flex-direction: column;
        gap: 5px;
    }
    
    .question-icon,
    .answer-icon {
        align-self: flex-start;
    }
    
    .question-meta,
    .answer-meta {
        margin-left: 0;
        margin-top: 5px;
    }
    
    .answer-pending {
        margin-left: 0;
    }
    
    .ask-question-section {
        padding: 20px 15px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .button {
        width: 100%;
        text-align: center;
    }
}

@media screen and (max-width: 480px) {
    .question-text,
    .answer-text {
        flex-direction: column;
        gap: 0;
    }
    
    .question-icon,
    .answer-icon {
        margin-bottom: 5px;
    }
    
    .char-counter {
        position: static;
        margin-top: 5px;
        text-align: right;
    }
}

/* Print Styles */
@media print {
    .ask-question-section,
    .question-form-modal {
        display: none !important;
    }
    
    .question-item {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
    
    .questions-title {
        color: #000;
    }
    
    .question-text,
    .answer-text {
        color: #000;
    }
}

/* Accessibility Improvements */
.question-form-modal:focus-within .modal-content {
    outline: 2px solid #2196F3;
    outline-offset: 2px;
}

.button:focus,
.input-text:focus {
    outline: 2px solid #2196F3;
    outline-offset: 2px;
}

/* Animation for smooth transitions */
.question-form-modal {
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.modal-content {
    transform: scale(0.9);
    animation: scaleIn 0.3s ease forwards;
}

@keyframes scaleIn {
    to {
        transform: scale(1);
    }
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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