/* AI Voice Agent Manager - Frontend Styles */

/* ElevenLabs Widget Styles */
.avam-widget-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 400px;
}

.avam-widget-wrapper.avam-widget-fixed {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    width: auto;
    max-width: 350px;
}

.avam-widget-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    text-align: center;
}

.avam-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #6DB035;
    border-radius: 50%;
    animation: avam-spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes avam-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.avam-widget-loading p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.avam-widget-error {
    padding: 15px;
    background: #ffebee;
    border: 1px solid #f44336;
    border-radius: 4px;
    color: #c62828;
    text-align: center;
}

.avam-widget-error p {
    margin: 0;
    font-size: 14px;
}

.avam-error {
    padding: 10px 15px;
    background: #ffebee;
    border: 1px solid #f44336;
    border-radius: 4px;
    color: #c62828;
    margin: 10px 0;
    font-size: 14px;
}

/* Additional Widget Styles */

/* Agent Status Widget */
.avam-agent-status {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.avam-status-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.avam-status-header h4 {
    margin: 0;
    color: #23282d;
    font-size: 16px;
    font-weight: 600;
}

.avam-status-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.avam-status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.avam-status-label {
    font-weight: 500;
    color: #666;
    font-size: 14px;
}

.avam-status-value {
    font-weight: 600;
    font-size: 14px;
    color: #23282d;
}

.avam-status-value.avam-status-active {
    color: #28a745;
}

.avam-status-value.avam-status-inactive {
    color: #dc3545;
}

.avam-call-count {
    background: #6DB035;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Widget Status (for WordPress widgets) */
.avam-widget-status {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.avam-agent-info {
    margin-bottom: 15px;
}

.avam-agent-info h4 {
    margin: 0 0 8px 0;
    color: #23282d;
    font-size: 16px;
    font-weight: 600;
}

.avam-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.avam-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.avam-status-indicator.avam-status-online .avam-status-dot {
    background: #28a745;
    animation: avam-pulse 2s infinite;
}

.avam-status-indicator.avam-status-offline .avam-status-dot {
    background: #dc3545;
}

.avam-status-indicator.avam-status-online {
    color: #28a745;
}

.avam-status-indicator.avam-status-offline {
    color: #dc3545;
}

@keyframes avam-pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.avam-call-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.avam-stat-item {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.avam-stat-number {
    display: block;
    font-size: 20px;
    font-weight: bold;
    color: #6DB035;
    margin-bottom: 4px;
}

.avam-stat-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Call Summary Widget */
.avam-call-summary {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.avam-call-summary h4 {
    margin: 0 0 15px 0;
    color: #23282d;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.avam-calls-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.avam-call-item {
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.avam-call-item:hover {
    border-color: #6DB035;
    box-shadow: 0 2px 4px rgba(109, 176, 53, 0.1);
}

.avam-call-item.expanded {
    border-color: #6DB035;
}

.avam-call-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.avam-call-time {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.avam-call-duration {
    font-size: 12px;
    color: #666;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 10px;
}

.avam-call-status {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.avam-call-status.avam-status-completed {
    background: #d4edda;
    color: #155724;
}

.avam-call-status.avam-status-failed {
    background: #f8d7da;
    color: #721c24;
}

.avam-call-status.avam-status-in-progress {
    background: #fff3cd;
    color: #856404;
}

.avam-call-number {
    font-size: 13px;
    color: #23282d;
    font-weight: 500;
    margin-bottom: 8px;
}

.avam-call-transcript {
    margin-top: 10px;
    display: none;
}

.avam-call-item.expanded .avam-call-transcript {
    display: block;
}

.avam-call-transcript strong {
    color: #6DB035;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.avam-transcript-content {
    margin-top: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #6DB035;
}

.avam-transcript-content p {
    margin: 0 0 8px 0;
    font-size: 13px;
    line-height: 1.4;
}

.avam-transcript-content p:last-child {
    margin-bottom: 0;
}

.avam-transcript-content strong {
    color: #23282d;
    font-weight: 600;
}

/* Widget Calls List (for WordPress widgets) */
.avam-widget-calls {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.avam-widget-calls .avam-calls-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.avam-widget-calls .avam-call-item {
    list-style: none;
    border: none;
    border-bottom: 1px solid #eee;
    border-radius: 0;
    padding: 10px 0;
    cursor: default;
}

.avam-widget-calls .avam-call-item:last-child {
    border-bottom: none;
}

.avam-widget-calls .avam-call-item:hover {
    border-color: #eee;
    box-shadow: none;
    background: #f8f9fa;
}

.avam-widget-calls .avam-call-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.avam-widget-calls .avam-call-time {
    font-size: 11px;
    color: #666;
}

.avam-widget-calls .avam-call-status {
    font-size: 10px;
    padding: 1px 4px;
}

.avam-widget-calls .avam-call-status.avam-status-success {
    background: #d4edda;
    color: #155724;
}

.avam-widget-calls .avam-call-status.avam-status-failed {
    background: #f8d7da;
    color: #721c24;
}

.avam-widget-calls .avam-call-duration {
    font-size: 11px;
    color: #666;
    background: none;
    padding: 0;
}

.avam-widget-calls .avam-call-number {
    font-size: 11px;
    color: #23282d;
    margin-bottom: 0;
}

/* Error and Loading States */
.avam-error {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    font-size: 14px;
}

.avam-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #666;
}

.avam-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #6DB035;
    border-radius: 50%;
    animation: avam-spin 1s linear infinite;
}

@keyframes avam-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .avam-widget-wrapper.avam-widget-fixed {
        bottom: 10px;
        right: 10px;
        left: 10px;
        right: 10px;
    }
    
    .avam-call-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .avam-call-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .avam-status-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .avam-agent-status,
    .avam-call-summary,
    .avam-widget-status {
        padding: 15px;
    }
    
    .avam-stat-number {
        font-size: 18px;
    }
    
    .avam-call-item {
        padding: 10px;
    }
}

/* Accessibility */
.avam-call-item:focus {
    outline: 2px solid #6DB035;
    outline-offset: 2px;
}

.avam-status-indicator[aria-label] {
    cursor: help;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .avam-agent-status,
    .avam-call-summary,
    .avam-widget-status {
        border-width: 2px;
    }
    
    .avam-call-item:hover {
        border-width: 2px;
    }
    
    .avam-status-dot {
        border: 1px solid currentColor;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .avam-call-item,
    .avam-status-dot {
        transition: none;
        animation: none;
    }
}

/* Print Styles */
@media print {
    .avam-widget-wrapper.avam-widget-fixed {
        position: static;
    }
    
    .avam-call-item {
        break-inside: avoid;
    }
    
    .avam-status-dot {
        background: #000 !important;
    }
}