/**
 * AI Assist System - Styles
 * ==========================
 * Styles for the AI Assist panel, modals, and inline buttons
 */

/* ========================
   AI ASSIST PANEL
   ======================== */
.ai-assist-panel {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px dashed #22c55e;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.ai-assist-panel h3 {
    color: #166534;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
}

.ai-assist-panel h3 i {
    color: #22c55e;
}

.ai-assist-panel .ai-subtitle {
    color: #4b5563;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.ai-assist-inputs {
    display: grid;
    gap: 1rem;
}

.ai-assist-inputs .ai-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .ai-assist-inputs .ai-row {
        grid-template-columns: 1fr;
    }
}

.ai-assist-inputs label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.35rem;
}

.ai-assist-inputs input,
.ai-assist-inputs textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-assist-inputs input:focus,
.ai-assist-inputs textarea:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.ai-assist-inputs textarea {
    min-height: 80px;
    resize: vertical;
}

.ai-optional-toggle {
    padding: 0.5rem 0;
}

.ai-optional-toggle button {
    background: none;
    border: none;
    color: #166534;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ai-optional-toggle button:hover {
    text-decoration: underline;
}

.ai-optional-fields {
    display: none;
    padding-top: 0.5rem;
}

.ai-optional-fields.show {
    display: block;
}

/* AI Extract Button & Actions */
.ai-actions-row {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.ai-extract-btn {
    flex: 2;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    padding: 0.9rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-copy-prompt-btn {
    flex: 1;
    background: white;
    color: #4b5563;
    border: 2px solid #e5e7eb;
    padding: 0.9rem 1rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.ai-copy-prompt-btn:hover {
    border-color: #3b82f6;
    color: #1d4ed8;
    background: #eff6ff;
}

.ai-extract-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.ai-extract-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ai-extract-btn.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Completeness Meter */
.ai-completeness {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.ai-completeness.show {
    display: block;
}

.ai-completeness-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.ai-completeness-header span {
    font-size: 0.9rem;
    color: #374151;
}

.ai-completeness-header strong {
    color: #22c55e;
}

.ai-completeness-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.ai-completeness-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.ai-completeness-message {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* Status Message */
.ai-status {
    display: none;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}

.ai-status.show {
    display: block;
}

.ai-status.success {
    background: #dcfce7;
    color: #166534;
}

.ai-status.error {
    background: #fee2e2;
    color: #991b1b;
}

.ai-status.info {
    background: #dbeafe;
    color: #1e40af;
}

/* ========================
   SUGGEST BUTTONS (inline)
   ======================== */
.ai-suggest-btn {
    display: none;
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    margin-left: 0.5rem;
    transition: all 0.2s;
}

.ai-suggest-btn:hover {
    background: #dcfce7;
    border-color: #22c55e;
}

.ai-suggest-btn.show {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* AI Improve Button (for textareas) */
.ai-improve-btn {
    display: none;
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: #1d4ed8;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.2s;
}

.ai-improve-btn:hover {
    background: #dbeafe;
    border-color: #3b82f6;
}

.ai-improve-btn.show {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* ========================
   MODAL STYLES
   ======================== */
.ai-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ai-modal-overlay.show {
    display: flex;
}

.ai-modal {
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ai-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #1f2937;
}

.ai-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.ai-modal-close:hover {
    color: #4b5563;
}

.ai-modal-body {
    padding: 1.5rem;
}

.ai-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Confidence Badge */
.ai-confidence {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.ai-confidence.high {
    background: #dcfce7;
    color: #166534;
}

.ai-confidence.medium {
    background: #fef3c7;
    color: #92400e;
}

.ai-confidence.low {
    background: #fee2e2;
    color: #991b1b;
}

/* Suggestion Preview */
.ai-suggestion-preview {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    white-space: pre-wrap;
    font-size: 0.9rem;
    max-height: 200px;
    overflow-y: auto;
}

/* Variant Cards */
.ai-variants {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.ai-variant-card {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-variant-card:hover {
    border-color: #22c55e;
    background: #f0fdf4;
}

.ai-variant-card.selected {
    border-color: #22c55e;
    background: #dcfce7;
}

.ai-variant-card p {
    margin: 0;
    font-size: 0.9rem;
    white-space: pre-wrap;
}

.ai-variant-label {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

/* Tone Selector */
.ai-tone-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ai-tone-btn {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #4b5563;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-tone-btn:hover {
    border-color: #22c55e;
}

.ai-tone-btn.active {
    border-color: #22c55e;
    background: #f0fdf4;
    color: #166534;
}

/* Length Selector */
.ai-length-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ai-length-btn {
    flex: 1;
    padding: 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #4b5563;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-length-btn:hover {
    border-color: #3b82f6;
}

.ai-length-btn.active {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #1d4ed8;
}

/* Modal Buttons */
.ai-btn {
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-btn-primary {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    color: white;
}

.ai-btn-primary:hover {
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

.ai-btn-secondary {
    background: white;
    border: 2px solid #e5e7eb;
    color: #4b5563;
}

.ai-btn-secondary:hover {
    border-color: #9ca3af;
}

.ai-btn-danger {
    background: white;
    border: 2px solid #fca5a5;
    color: #dc2626;
}

.ai-btn-danger:hover {
    background: #fee2e2;
}

/* Replace Warning */
.ai-replace-warning {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #92400e;
}

.ai-replace-warning i {
    color: #f59e0b;
}

/* Loading Spinner */
.ai-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6b7280;
}

.ai-loading i {
    font-size: 1.5rem;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

/* Limits Warning */
.ai-limits-warning {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #991b1b;
}

/* ========================
   AI SUGGESTED FIELDS
   ======================== */

/* Form fields with AI suggestions - highlighted border */
input.ai-suggested,
textarea.ai-suggested,
select.ai-suggested {
    border: 2px solid #22c55e !important;
    background: linear-gradient(to right, #f0fdf4, white) !important;
    animation: ai-pulse 2s ease-in-out;
}

@keyframes ai-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

/* Accepted fields - solid green */
input.ai-accepted,
textarea.ai-accepted,
select.ai-accepted {
    border: 2px solid #16a34a !important;
    background: white !important;
}

/* Checkbox items with AI suggestions */
.checkbox-item.ai-suggested {
    border-color: #22c55e !important;
    background: #f0fdf4 !important;
}

.checkbox-item.ai-accepted {
    border-color: #16a34a !important;
    background: #dcfce7 !important;
}

/* ========================
   FIELD CONTROLS (Accept/Clear)
   ======================== */
.ai-field-controls {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.ai-accept-btn {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s;
}

.ai-accept-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

.ai-clear-btn {
    background: white;
    color: #dc2626;
    border: 1px solid #fca5a5;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s;
}

.ai-clear-btn:hover {
    background: #fee2e2;
    border-color: #dc2626;
}

.ai-field-confidence {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-left: auto;
}

.ai-field-confidence.high {
    background: #dcfce7;
    color: #166534;
}

.ai-field-confidence.medium {
    background: #fef3c7;
    color: #92400e;
}

.ai-field-confidence.low {
    background: #fee2e2;
    color: #991b1b;
}

/* Checkbox controls positioning */
.ai-checkbox-controls {
    margin-top: 1rem;
    justify-content: flex-start;
}

/* Accept All Button */
.ai-accept-all-btn {
    width: 100%;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    transition: all 0.2s;
}

.ai-accept-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}