/* AI Assistant Panel Styles */

.ai-content {
    flex: 1;
    min-height: 0; /* Critical for flex children to respect overflow */
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--panel-padding);
    padding-bottom: 24px; /* Extra padding at bottom for last card visibility */
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth; /* Smooth scroll when content is added */
}

/* AI Waiting State */
.ai-waiting {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--color-text-muted);
    font-size: 13px;
}

.ai-pulse-ring {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--color-ai);
    animation: ai-pulse-ring 2s ease-out infinite;
}

@keyframes ai-pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* AI Detection Banner */
.ai-detection {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(127, 63, 191, 0.1) 0%, rgba(127, 63, 191, 0.05) 100%);
    border: 1px solid rgba(127, 63, 191, 0.3);
    border-radius: var(--border-radius);
    animation: detection-slide-down 0.3s ease-out;
    flex-shrink: 0; /* Prevent shrinking in flex container */
}

@keyframes detection-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.detection-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-ai);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detection-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.detection-content {
    flex: 1;
}

.detection-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-ai);
    margin-bottom: 2px;
}

.detection-type {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
}

/* AI Procedure Card */
.ai-procedure {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 16px;
    animation: card-appear 0.4s ease-out;
    flex-shrink: 0; /* Prevent shrinking in flex container */
}

@keyframes card-appear {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.procedure-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: 10px;
}

.procedure-header svg {
    width: 16px;
    height: 16px;
}

.procedure-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 16px;
}

.procedure-checklist {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.proc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--color-surface);
    border-radius: var(--border-radius);
    font-size: 13px;
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.proc-check {
    width: 18px;
    height: 18px;
    border: 2px solid var(--color-border-dark);
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    transition: all var(--transition-base);
}

.proc-item.completed .proc-check {
    background: var(--color-success);
    border-color: var(--color-success);
}

.proc-item.completed .proc-check::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 5px;
    width: 4px;
    height: 7px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    animation: check-spring 0.3s ease-out;
}

@keyframes check-spring {
    0% { transform: rotate(45deg) scale(0); }
    60% { transform: rotate(45deg) scale(1.3); }
    100% { transform: rotate(45deg) scale(1); }
}

.proc-item.completed {
    color: var(--color-text-primary);
    background: rgba(46, 132, 74, 0.05);
}

/* AI Auto-fill Preview */
.ai-autofill {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    animation: card-appear 0.4s ease-out;
    flex-shrink: 0; /* Prevent shrinking in flex container */
}

.autofill-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.autofill-header svg {
    width: 16px;
    height: 16px;
}

.autofill-badge {
    margin-left: auto;
    padding: 3px 8px;
    background: var(--color-ai);
    color: white;
    border-radius: 10px;
    font-size: 10px;
}

.autofill-form {
    padding: 16px;
}

.form-row {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.form-row:last-child {
    border-bottom: none;
}

.form-row label {
    width: 120px;
    font-size: 12px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.form-value {
    flex: 1;
    font-size: 14px;
    color: var(--color-text-primary);
    font-weight: 500;
}

.form-value.ai-filled {
    position: relative;
    padding-right: 32px;
}

.form-value.ai-filled::after {
    content: 'AI';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    padding: 2px 6px;
    background: var(--color-ai-glow);
    color: var(--color-ai);
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
}

.form-value.filling {
    animation: field-glow 0.5s ease-out;
}

@keyframes field-glow {
    0% {
        background: rgba(127, 63, 191, 0.2);
    }
    100% {
        background: transparent;
    }
}

/* AI Notification Banner */
.ai-notification {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(255, 179, 0, 0.15) 0%, rgba(255, 179, 0, 0.05) 100%);
    border: 2px solid var(--color-warning);
    border-radius: var(--border-radius);
    animation: notification-pulse 0.5s ease-out, notification-glow 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes notification-pulse {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    50% {
        transform: translateY(2px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes notification-glow {
    0%, 100% {
        box-shadow: 0 0 8px rgba(255, 179, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 179, 0, 0.5);
    }
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-warning);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: bell-ring 0.5s ease-out 0.3s;
}

@keyframes bell-ring {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(15deg); }
    40% { transform: rotate(-15deg); }
    60% { transform: rotate(10deg); }
    80% { transform: rotate(-10deg); }
}

.notification-icon svg {
    width: 22px;
    height: 22px;
    color: white;
}

.notification-content {
    flex: 1;
}

.notification-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-warning);
    margin-bottom: 4px;
}

.notification-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
    line-height: 1.4;
}

/* AI Recommendation */
.ai-recommendation {
    position: relative;
    background: linear-gradient(135deg, rgba(127, 63, 191, 0.15) 0%, rgba(127, 63, 191, 0.05) 100%);
    border: 2px solid var(--color-ai);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    animation: recommendation-appear 0.5s ease-out;
    overflow: hidden;
    flex-shrink: 0; /* Prevent card from shrinking and getting cut off */
}

@keyframes recommendation-appear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.recommendation-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--color-ai-glow) 0%, transparent 70%);
    animation: glow-pulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

.recommendation-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-ai);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.recommendation-icon svg {
    width: 24px;
    height: 24px;
    color: white;
}

.recommendation-content {
    position: relative;
    z-index: 1;
    margin-bottom: 16px;
}

.recommendation-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-ai);
    margin-bottom: 6px;
}

.recommendation-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-primary);
}

.recommendation-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--color-ai);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    z-index: 1;
}

.recommendation-action:hover {
    background: var(--color-ai-dark);
    transform: translateY(-1px);
}

.recommendation-action svg {
    width: 16px;
    height: 16px;
}

/* AI Summary */
.ai-summary {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-success);
    border-radius: var(--border-radius);
    overflow: hidden;
    animation: card-appear 0.4s ease-out;
    flex-shrink: 0; /* Prevent shrinking in flex container */
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(46, 132, 74, 0.1);
    border-bottom: 1px solid var(--color-success);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-success);
}

.summary-header svg {
    width: 18px;
    height: 18px;
}

.summary-content {
    padding: 16px;
}

.summary-section {
    margin-bottom: 16px;
}

.summary-section:last-child {
    margin-bottom: 0;
}

.summary-section h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: 10px;
}

.summary-section ul {
    list-style: none;
}

.summary-section li {
    position: relative;
    padding-left: 18px;
    padding-bottom: 8px;
    font-size: 13px;
    color: var(--color-text-primary);
}

.summary-section li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--color-success);
    font-weight: bold;
}

.summary-section:last-child li::before {
    content: '•';
    color: var(--color-warning);
}
