/* Guest Support Integration Styles */

.smart-support-guest-option {
    margin-top: 20px;
    text-align: center;
}

.guest-divider {
    position: relative;
    margin: 20px 0;
    text-align: center;
}

.guest-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #ddd;
}

.guest-divider span {
    background: #fff;
    padding: 0 15px;
    color: #666;
    font-size: 14px;
}

#continue-as-guest-btn {
    width: 100%;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 500;
}

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

/* Modal Styles */
.smart-support-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

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

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

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

.modal-header h3,
.modal-header .modal-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.35;
    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;
}

/* Core create-ticket field sizing: .support-create-view .smart-support-form.page in public.css */
#smart-support-guest-modal .modal-body {
    padding: 24px 28px;
}

#smart-support-guest-modal .smart-support-guest-create.support-create-view {
    padding: 0;
    margin: 0;
}

#smart-support-guest-modal .support-create-view .smart-support-form.page {
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

#smart-support-guest-modal .form-row.guest-dept-priority-row .form-group {
    flex: 1 1 160px;
    min-width: 0;
    margin-bottom: 0;
}

#smart-support-guest-modal .guest-attachments-input {
    width: 100%;
    box-sizing: border-box;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#smart-support-guest-modal .guest-attachments-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#smart-support-guest-modal .file-upload-hint,
#smart-support-guest-modal .file-upload-hint.text-muted {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.45;
    margin-top: 8px;
    margin-bottom: 0;
}

#smart-support-guest-modal .form-actions,
.guest-reply-form .form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

#smart-support-guest-modal .form-actions .btn {
    min-height: 40px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Guest Ticket View Styles */
.smart-support-guest-ticket-view {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
}

.smart-support-guest-ticket-view h2 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
    border-bottom: 2px solid #007cba;
    padding-bottom: 10px;
}

.ticket-details {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 25px;
    border-left: 4px solid #007cba;
}

.ticket-details p {
    margin: 8px 0;
    font-size: 14px;
    color: #555;
}

.ticket-details strong {
    color: #333;
    font-weight: 600;
}

.ticket-message {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.ticket-message h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.message-content {
    font-size: 14px;
    line-height: 1.6;
    color: #444;
}

.ticket-replies {
    margin-bottom: 30px;
}

.ticket-replies h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.reply {
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.user-reply {
    background: #f0f8ff;
    border-left: 4px solid #007cba;
}

.agent-reply {
    background: #f8fff8;
    border-left: 4px solid #28a745;
}

.reply-header {
    margin-bottom: 10px;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.reply-content {
    color: #333;
    line-height: 1.6;
    font-size: 14px;
}

.guest-reply-form {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.guest-reply-form h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.guest-reply-form .form-group {
    margin-bottom: 0;
}

.guest-reply-form .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
}

.guest-reply-form .form-group .required {
    color: #b91c1c;
    font-weight: 600;
}

.guest-reply-form .form-actions .btn {
    min-height: 40px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Expiry Counter Styles */
.expiry-counter {
    margin: 10px 0;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.days-left {
    font-weight: 500;
    color: #666;
}

/* Reset Button Styles */
.token-reset-section {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 12px;
}

.token-reset-section .button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    padding: 6px 12px;
    height: auto;
    line-height: 1.4;
}

.token-reset-section .button:hover {
    background: #f0f0f1;
    border-color: #8c8f94;
}

.token-reset-section .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.token-reset-section .description {
    margin-top: 8px;
    line-height: 1.4;
}

/* Guest Badge Styles */
.guest-badge {
    background: #007cba;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.registered-badge {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Debug info styling */
.smart-support-guest-ticket-view div[style*="background: #f0f0f0"] {
    font-size: 12px !important;
    margin: 10px 0 !important;
}

.smart-support-guest-ticket-view div[style*="background: #e8f4f8"] {
    font-size: 11px !important;
    margin: 5px 0 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modal-content {
        margin: 20px;
        max-width: none;
    }
    
    .modal-header,
    .modal-body {
        padding: 20px;
    }

    #smart-support-guest-modal .modal-body {
        padding: 18px 16px;
    }

    #smart-support-guest-modal .form-row.guest-dept-priority-row {
        flex-direction: column;
    }

    #smart-support-guest-modal .form-row.guest-dept-priority-row .form-group {
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    .ticket-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .ticket-meta {
        flex-wrap: wrap;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .form-actions .btn {
        width: 100%;
        order: 2;
    }
    
    .form-actions .btn-primary {
        order: 1;
    }
    
    /* Stack form fields vertically on mobile */
    .modal-body .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .modal-body .form-group-half {
        margin-bottom: 20px;
    }
}

/* Loading States */
.guest-form-loading {
    opacity: 0.6;
    pointer-events: none;
}

.guest-form-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 #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* TinyMCE (align with core .editor-wrapper — public.css) */
#smart-support-guest-modal .editor-wrapper,
.guest-reply-form .editor-wrapper {
    border-radius: 6px;
}

#smart-support-guest-modal .wp-editor-wrap,
.guest-reply-form .wp-editor-wrap {
    margin-top: 0;
}

#smart-support-guest-modal .wp-editor-wrap .wp-editor-container,
.guest-reply-form .wp-editor-wrap .wp-editor-container {
    border: none;
    border-radius: 0;
}

#smart-support-guest-modal .wp-editor-wrap .mce-tinymce,
.guest-reply-form .wp-editor-wrap .mce-tinymce {
    border: none !important;
    border-radius: 0;
}

/* Error states for TinyMCE */
#smart-support-guest-modal .form-group.error .editor-wrapper,
.guest-reply-form .form-group.error .editor-wrapper {
    border: 1px solid #dc2626;
    border-radius: 6px;
}

/* Focus: core matches .editor-wrapper:focus-within in public.css */
#smart-support-guest-modal .editor-wrapper:focus-within,
.guest-reply-form .editor-wrapper:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Responsive TinyMCE */
@media (max-width: 768px) {
    #smart-support-guest-modal .wp-editor-wrap .mce-toolbar,
    .guest-reply-form .wp-editor-wrap .mce-toolbar {
        flex-wrap: wrap;
    }
    
    #smart-support-guest-modal .wp-editor-wrap .mce-toolbar .mce-btn-group,
    .guest-reply-form .wp-editor-wrap .mce-toolbar .mce-btn-group {
        margin-bottom: 5px;
    }
}
