/**
 * Frontend CSS for WPForms AI Biography Generator
 * 
 * @package WPForms_AI_Bio_Generator
 * @since 4.0
 */

/* ==========================================================================
   AI Biography Generator - Frontend Styles
   ========================================================================== */

/* Main Container Styles */
.ai-biography-container {
    margin: 15px 0;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    border-left: 4px solid #1d73be;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    font-family: inherit;
    line-height: 1.6;
    transition: all 0.3s ease;
}

.ai-biography-container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.ai-biography-container p {
    margin: 0;
    color: #333;
    font-size: 16px;
    line-height: 1.7;
}

/* Auto Biography Container */
.ai-auto-biography-container {
    min-height: 80px;
    margin: 15px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.ai-auto-biography-container.generating {
    background: #fff5f5;
    border-color: #1d73be;
}

/* Button Styles */
.ai-bio-button {
    background: linear-gradient(135deg, #1d73be 0%, #1557a0 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(29, 115, 190, 0.2);
    position: relative;
    overflow: hidden;
}

.ai-bio-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.ai-bio-button:hover {
    background: linear-gradient(135deg, #1557a0 0%, #134d87 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 115, 190, 0.3);
}

.ai-bio-button:hover:before {
    left: 100%;
}

.ai-bio-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(29, 115, 190, 0.2);
}

.ai-bio-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none;
    opacity: 0.7;
}

.ai-bio-button:disabled:hover {
    background: #6c757d;
    transform: none;
    box-shadow: none;
}

/* Enhanced disabled state for WPForms buttons during generation */
/* Only disable page navigation buttons (next/prev), not submit buttons */
.wpforms-page-button.wpforms-page-next:disabled,
.wpforms-page-button.wpforms-page-prev:disabled,
.wpforms-page-button.wpforms-page-next[disabled],
.wpforms-page-button.wpforms-page-prev[disabled] {
    opacity: 0.6 !important;
    cursor: wait !important;
    pointer-events: none !important;
}

/* Keep submit buttons functional during AI generation */
.wpforms-submit:disabled,
.wpforms-submit[disabled] {
    opacity: 0.8 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* MINIMAL SUBMIT BUTTON PROTECTION: Only prevent accidental hiding during AI generation */
/* Let WPForms handle all positioning and visibility logic naturally */

/* Only protect against opacity/pointer-events being disabled during AI generation */
/* This ensures submit buttons work when they SHOULD be visible, without forcing visibility */
.wpforms-submit:disabled,
.wpforms-submit[disabled] {
    /* Allow WPForms to control display/visibility, only fix interaction issues */
    cursor: default !important;
    pointer-events: auto !important;
}

/* Ensure our AI generation doesn't accidentally disable submit buttons */
.wpforms-form.ai-bio-generating .wpforms-submit {
    /* Don't disable submit buttons during AI generation */
    pointer-events: auto !important;
}

/* Button Container */
.ai-biography-button-container {
    margin: 15px 0;
}

/* Loading Styles */
.ai-biography-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px dashed #dee2e6;
    margin: 10px 0;
}

/* Content Styles */
.ai-biography-content {
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.ai-biography-content.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.ai-biography-content p {
    margin: 0;
    padding: 0;
    line-height: 1.7;
    color: #2c3e50;
}

/* Error Styles */
.ai-bio-error,
.ai-biography-error {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 6px;
    padding: 15px;
    margin: 10px 0;
    color: #c53030;
    font-size: 14px;
    text-align: center;
    position: relative;
}

.ai-bio-error:before,
.ai-biography-error:before {
    content: '⚠';
    margin-right: 8px;
    font-size: 16px;
}

/* Spinner Animations */
.ai-bio-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #1d73be;
    border-radius: 50%;
    animation: ai-bio-spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

.ai-bio-spinner-large {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1d73be;
    border-radius: 50%;
    animation: ai-bio-spin 1s linear infinite;
    margin-right: 12px;
    vertical-align: middle;
}

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

/* Pulse Animation for Loading */
.ai-biography-loading {
    animation: ai-bio-pulse 2s infinite;
}

@keyframes ai-bio-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Success Animation */
.ai-biography-success {
    animation: ai-bio-success 0.6s ease-out;
}

@keyframes ai-bio-success {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    60% {
        transform: scale(1.02) translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Message Styles */
.ai-bio-message,
.ai-bio-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 350px;
    word-wrap: break-word;
    white-space: pre-line;
    animation: ai-bio-slide-in 0.3s ease-out;
}

@keyframes ai-bio-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.ai-bio-message-success,
.ai-bio-notification-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.ai-bio-message-error,
.ai-bio-notification-error {
    background: linear-gradient(135deg, #dc3545 0%, #e74c3c 100%);
}

.ai-bio-message-warning,
.ai-bio-notification-warning {
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    color: white;
}

.ai-bio-message-info {
    background: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
}

/* Form Integration Styles */
.wpforms-container .ai-biography-container {
    margin-top: 20px;
    margin-bottom: 20px;
}

.wpforms-container .ai-bio-button {
    font-family: inherit;
}

.wpforms-field[class*="ai-biography"] {
    margin-bottom: 0;
}

/* Copy Fields Highlighting */
.ai-biography-copy {
    transition: all 0.3s ease;
}

.ai-biography-copy.ai-bio-copied {
    background-color: #d4edda !important;
    border-color: #c3e6cb !important;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

.ai-biography-copy.ai-bio-copied:focus {
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25) !important;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .ai-biography-container {
        background: #2d3748;
        border-left-color: #4299e1;
        color: #e2e8f0;
    }
    
    .ai-biography-container p {
        color: #e2e8f0;
    }
    
    .ai-auto-biography-container {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .ai-biography-loading {
        background: #2d3748;
        border-color: #4a5568;
        color: #a0aec0;
    }
    
    .ai-bio-error,
    .ai-biography-error {
        background: #2d1b1b;
        border-color: #e53e3e;
        color: #fed7d7;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-biography-container {
        margin: 10px 0;
        padding: 15px;
        border-radius: 6px;
    }
    
    .ai-auto-biography-container {
        margin: 10px 0;
        padding: 15px;
    }
    
    .ai-bio-button {
        padding: 10px 18px;
        font-size: 13px;
        width: 100%;
        text-align: center;
    }
    
    .ai-biography-button-container {
        margin: 10px 0;
    }
    
    .ai-biography-loading {
        padding: 15px;
        font-size: 13px;
    }
    
    .ai-bio-message {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        font-size: 13px;
        padding: 10px 15px;
    }
    
    .ai-biography-content p {
        font-size: 15px;
        line-height: 1.6;
    }
}

@media (max-width: 480px) {
    .ai-biography-container {
        padding: 12px;
        margin: 8px 0;
    }
    
    .ai-auto-biography-container {
        padding: 12px;
        margin: 8px 0;
    }
    
    .ai-bio-button {
        padding: 8px 15px;
        font-size: 12px;
    }
    
    .ai-biography-loading {
        padding: 12px;
        font-size: 12px;
    }
    
    .ai-biography-content p {
        font-size: 14px;
    }
}

/* High DPI Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .ai-bio-spinner,
    .ai-bio-spinner-large {
        border-width: 1px;
    }
}

/* Print Styles */
@media print {
    .ai-bio-button,
    .ai-biography-loading,
    .ai-bio-error,
    .ai-biography-error,
    .ai-bio-message {
        display: none !important;
    }
    
    .ai-biography-container,
    .ai-auto-biography-container {
        box-shadow: none;
        border: 1px solid #000;
        background: white;
        color: black;
    }
    
    .ai-biography-content p {
        color: black;
    }
}

/* Accessibility Improvements */
.ai-bio-button:focus {
    outline: 2px solid #4285f4;
    outline-offset: 2px;
}

.ai-biography-container:focus-within {
    box-shadow: 0 0 0 2px rgba(29, 115, 190, 0.2);
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .ai-bio-button,
    .ai-biography-container,
    .ai-biography-content,
    .ai-biography-loading,
    .ai-bio-message {
        transition: none;
        animation: none;
    }
    
    .ai-bio-spinner,
    .ai-bio-spinner-large {
        animation: none;
        border-top-color: transparent;
    }
}

/* Custom Scrollbar for Containers */
.ai-biography-container::-webkit-scrollbar,
.ai-auto-biography-container::-webkit-scrollbar {
    width: 6px;
}

.ai-biography-container::-webkit-scrollbar-track,
.ai-auto-biography-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ai-biography-container::-webkit-scrollbar-thumb,
.ai-auto-biography-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ai-biography-container::-webkit-scrollbar-thumb:hover,
.ai-auto-biography-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
} 