/**
 * Frontend CSS for PF Messaging Form.
 *
 * @package PFMessaging
 * @since 1.0.0
 */

/* Form Container */
.pf-contact-form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
    overflow: hidden;
}

/* Send Message Trigger */
.pf-send-message-trigger {
    text-align: center;
    padding: 40px 20px;
}

.pf-trigger-header {
    margin-bottom: 30px;
}

.pf-trigger-header h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.pf-trigger-header p {
    margin: 0;
    color: #666;
    font-size: 16px;
    line-height: 1.5;
}

.pf-btn-large {
    padding: 16px 32px;
    font-size: 16px;
    font-weight: 600;
    min-height: 56px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
    transition: all 0.3s ease;
}

.pf-btn-large:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 124, 186, 0.4);
}

.pf-btn-large .pf-btn-icon {
    font-size: 20px;
    margin-right: 8px;
}

/* Form Wrapper (initially hidden) */
.pf-form-wrapper {
    animation: pf-form-slide-in 0.4s ease-out;
}

@keyframes pf-form-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Prevent form submission issues */
.pf-message-form.pf-submitting {
    pointer-events: none;
    opacity: 0.7;
}

.pf-message-form.pf-submitting * {
    cursor: not-allowed;
}

/* Form Header */
.pf-form-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.pf-form-header h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.pf-form-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Form Steps */
.pf-form-step {
    display: none;
}

.pf-form-step.active {
    display: block;
}

/* Step Header */
.pf-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007cba;
}

.pf-step-header h4 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

/* Step Indicator */
.pf-step-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pf-step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: #ddd;
    color: #666;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pf-step-indicator.active .pf-step-number {
    background: #007cba;
    color: #fff;
}

.pf-step-indicator.completed .pf-step-number {
    background: #28a745;
    color: #fff;
}

.pf-step-indicator.completed .pf-step-number::after {
    content: '✓';
}

.pf-step-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* Form Fields */
.pf-form-fields {
    margin-bottom: 30px;
}

.pf-field-group {
    margin-bottom: 20px;
}

.pf-field-row {
    display: flex;
    gap: 15px;
}

.pf-field-half {
    flex: 1;
}

.pf-field-label {
    display: block;
    margin-bottom: 6px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.pf-field-input,
.pf-field-textarea,
.pf-field-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

.pf-field-input:focus,
.pf-field-textarea:focus,
.pf-field-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.pf-field-input.error,
.pf-field-textarea.error,
.pf-field-select.error {
    border-color: #dc3545;
}

.pf-field-textarea {
    resize: vertical;
    min-height: 100px;
}

.pf-field-error {
    display: none;
    margin-top: 5px;
    color: #dc3545;
    font-size: 12px;
    font-weight: 500;
}

/* File Upload */
.pf-file-upload-area {
    position: relative;
    border: 2px dashed #e1e5e9;
    border-radius: 6px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.pf-file-upload-area:hover,
.pf-file-upload-area.drag-over {
    border-color: #007cba;
    background: #f0f8ff;
}

.pf-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.pf-file-upload-content {
    pointer-events: none;
}

.pf-file-upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.6;
}

.pf-file-upload-text strong {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-size: 16px;
}

.pf-file-upload-text span {
    color: #666;
    font-size: 14px;
}

.pf-file-upload-info {
    margin-top: 10px;
    color: #999;
    font-size: 12px;
}

/* File Preview */
.pf-file-preview {
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.pf-file-item {
    position: relative;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.pf-file-thumbnail {
    width: 100%;
    height: 100px;
    object-fit: cover;
}

.pf-file-info {
    padding: 8px;
}

.pf-file-name {
    font-size: 12px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-file-size {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

.pf-file-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.pf-file-remove:hover {
    background: #dc3545;
}

/* Consent Checkbox */
.pf-consent-checkbox {
    margin: 20px 0;
}

.pf-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
}

.pf-checkbox-label input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
}

.pf-checkbox-text {
    color: #333;
}

.pf-checkbox-text a {
    color: #007cba;
    text-decoration: none;
}

.pf-checkbox-text a:hover {
    text-decoration: underline;
}

/* Form Summary */
.pf-form-summary {
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #28a745;
}

.pf-form-summary h5 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.pf-summary-item {
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
}

.pf-summary-item:last-child {
    margin-bottom: 0;
}

.pf-summary-item strong {
    color: #333;
    font-weight: 600;
}

/* Form Actions */
.pf-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid #e1e5e9;
}

/* Buttons */
.pf-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
}

.pf-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.pf-btn-primary {
    background: #007cba;
    color: #fff;
}

.pf-btn-primary:hover:not(:disabled) {
    background: #005a87;
    transform: translateY(-1px);
}

.pf-btn-secondary {
    background: #6c757d;
    color: #fff;
}

.pf-btn-secondary:hover:not(:disabled) {
    background: #545b62;
    transform: translateY(-1px);
}

.pf-btn-icon {
    font-size: 16px;
}

.pf-btn-loading {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Success/Error Messages */
.pf-form-success,
.pf-form-error {
    text-align: center;
    padding: 40px 20px;
    border-radius: 8px;
}

.pf-form-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.pf-form-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.pf-success-icon,
.pf-error-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.pf-form-success h4,
.pf-form-error h4 {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 600;
}

.pf-form-success p,
.pf-form-error p {
    margin: 0 0 20px 0;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pf-contact-form-container {
        margin: 10px;
        padding: 15px;
    }
    
    .pf-send-message-trigger {
        padding: 30px 15px;
    }
    
    .pf-trigger-header h3 {
        font-size: 20px;
    }
    
    .pf-trigger-header p {
        font-size: 14px;
    }
    
    .pf-btn-large {
        width: 100%;
        padding: 14px 24px;
        font-size: 15px;
    }
    
    .pf-step-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .pf-field-row {
        flex-direction: column;
        gap: 0;
    }
    
    .pf-form-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .pf-btn {
        width: 100%;
        justify-content: center;
    }
    
    .pf-file-preview {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .pf-form-header h3 {
        font-size: 20px;
    }
    
    .pf-step-header h4 {
        font-size: 16px;
    }
    
    .pf-field-input,
    .pf-field-textarea,
    .pf-field-select {
        padding: 10px 12px;
    }
    
    .pf-file-upload-area {
        padding: 20px 15px;
    }
    
    .pf-file-upload-icon {
        font-size: 36px;
    }
}

/* Print Styles */
@media print {
    .pf-contact-form-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .pf-form-actions,
    .pf-file-upload-area,
    .pf-file-preview {
        display: none;
    }
    
    .pf-form-step {
        display: block !important;
    }
    
    .pf-step-header {
        background: #f0f0f0 !important;
        border-left-color: #333 !important;
    }
}

/* Login Popup Styles */
.pf-login-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.pf-login-popup {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: pf-popup-slide-in 0.3s ease-out;
}

@keyframes pf-popup-slide-in {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.pf-login-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
}

.pf-login-popup-header h4 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.pf-login-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.pf-login-popup-close:hover {
    background: #e9ecef;
    color: #333;
}

.pf-login-popup-content {
    padding: 30px 25px;
    text-align: center;
}

.pf-login-icon {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.8;
}

.pf-login-popup-content p {
    margin: 0 0 25px 0;
    color: #555;
    font-size: 15px;
    line-height: 1.5;
}

.pf-login-popup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.pf-login-btn {
    background: #007cba;
    color: #fff;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
}

.pf-login-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

.pf-login-cancel {
    background: #6c757d;
    color: #fff;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.pf-login-cancel:hover {
    background: #545b62;
    transform: translateY(-1px);
}

/* Prevent body scroll when popup is open */
body.pf-popup-open {
    overflow: hidden;
}

/* Mobile responsive for login popup */
@media (max-width: 480px) {
    .pf-login-popup {
        width: 95%;
        margin: 20px;
    }
    
    .pf-login-popup-header {
        padding: 15px 20px;
    }
    
    .pf-login-popup-content {
        padding: 25px 20px;
    }
    
    .pf-login-popup-actions {
        flex-direction: column;
    }
    
    .pf-login-btn,
    .pf-login-cancel {
        width: 100%;
    }
}