/* CAA Communications Hub - Custom Styles */

/* Base transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(26, 26, 26, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 26, 26, 0.3);
}

/* Contact item styles */
.contact-item {
    cursor: pointer;
    border-left: 3px solid transparent;
}

.contact-item:hover {
    background-color: rgba(245, 240, 232, 0.5);
}

.contact-item.active {
    background-color: rgba(224, 120, 48, 0.08);
    border-left-color: #e07830;
}

.contact-item.unread {
    background-color: rgba(224, 120, 48, 0.05);
}

.contact-item .unread-dot {
    width: 8px;
    height: 8px;
    background-color: #e07830;
    border-radius: 50%;
}

/* Message bubble styles */
.message-bubble {
    max-width: 70%;
    animation: messageIn 0.2s ease-out;
}

.message-bubble.inbound {
    background-color: white;
    border: 1px solid rgba(232, 224, 212, 0.5);
    border-radius: 16px 16px 16px 4px;
}

.message-bubble.outbound {
    background-color: #1a1a1a;
    color: #f5f0e8;
    border-radius: 16px 16px 4px 16px;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Channel badge styles */
.channel-badge {
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(26, 26, 26, 0.05);
}

/* Status dot animations */
.status-dot {
    animation: pulse 2s infinite;
}

.status-dot.available {
    background-color: #4ade80;
}

.status-dot.on_call, .status-dot.in_conversation {
    background-color: #60a5fa;
    animation: pulse 1s infinite;
}

.status-dot.away {
    background-color: #facc15;
}

.status-dot.dnd {
    background-color: #f87171;
    animation: none;
}

.status-dot.offline {
    background-color: #9ca3af;
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Team member card */
.team-member {
    padding: 12px;
    border-radius: 12px;
    margin: 4px;
    background: rgba(245, 240, 232, 0.3);
}

.team-member:hover {
    background: rgba(245, 240, 232, 0.6);
}

/* Template item styles */
.template-item {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    margin: 2px 0;
}

.template-item:hover {
    background-color: rgba(245, 240, 232, 0.8);
}

.template-item.selected {
    background-color: rgba(224, 120, 48, 0.1);
    border: 1px solid rgba(224, 120, 48, 0.3);
}

/* Channel button active state */
.channel-btn.active {
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Filter tab active state */
.filter-tab.active {
    background-color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Status dropdown */
#status-dropdown {
    animation: dropdownIn 0.15s ease-out;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(26, 26, 26, 0.05) 25%, 
        rgba(26, 26, 26, 0.1) 50%, 
        rgba(26, 26, 26, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: #1a1a1a;
    color: #f5f0e8;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    animation: toastIn 0.3s ease-out;
}

.toast.error {
    background: #dc2626;
}

.toast.success {
    background: #16a34a;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Message timestamp */
.message-time {
    font-size: 11px;
    color: rgba(26, 26, 26, 0.4);
}

.outbound .message-time {
    color: rgba(245, 240, 232, 0.6);
}

/* Focus states */
input:focus, textarea:focus, button:focus {
    outline: none;
}

/* Smooth scroll for messages */
#messages-container {
    scroll-behavior: smooth;
}

/* New message indicator */
.new-message-indicator {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: #1a1a1a;
    color: #f5f0e8;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    animation: bounceIn 0.3s ease-out;
}

@keyframes bounceIn {
    0% {
        transform: translateX(-50%) translateY(16px);
        opacity: 0;
    }
    50% {
        transform: translateX(-50%) translateY(-4px);
    }
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .w-80 {
        width: 280px;
    }
    .w-64 {
        width: 220px;
    }
}

@media (max-width: 768px) {
    /* Mobile layout would go here */
}

/* Print styles */
@media print {
    header, aside {
        display: none !important;
    }
    #conversation-container {
        display: block !important;
    }
}

/* Sentiment badge styles */
.sentiment-badge {
    display: inline-flex;
    align-items: center;
    font-size: 12px;
}

.sentiment-badge.text-xs {
    font-size: 11px;
}

/* AI Suggestions panel */
#ai-suggestions-panel {
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.suggestion-btn {
    width: 100%;
    cursor: pointer;
}

.suggestion-btn:hover {
    transform: translateX(4px);
}

.suggestion-btn:active {
    transform: translateX(2px) scale(0.99);
}

/* Sentiment colors in message bubbles */
.message-bubble.inbound .sentiment-positive {
    color: #16a34a;
}

.message-bubble.inbound .sentiment-negative {
    color: #dc2626;
}

/* ==========================================
   Voice/Call UI Styles
   ========================================== */

/* Active call indicator in header */
#active-call-indicator {
    animation: callPulse 2s ease-in-out infinite;
}

@keyframes callPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(74, 222, 128, 0);
    }
}

/* Incoming call popup animation */
#incoming-call-popup .animate-bounce-slow {
    animation: bounceSlow 1s ease-in-out infinite;
}

@keyframes bounceSlow {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

/* Ringing animation for incoming call */
#incoming-call-popup .animate-ping {
    animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Call button pulse */
#call-contact-btn {
    position: relative;
}

#call-contact-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.2s;
}

#call-contact-btn:hover::before {
    opacity: 1;
    animation: buttonPulse 1s ease-out infinite;
}

@keyframes buttonPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
    }
    100% {
        box-shadow: 0 0 0 12px rgba(34, 197, 94, 0);
    }
}

/* Call message styling */
.call-message {
    transition: all 0.2s ease;
}

.call-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Audio player custom styling */
.call-message audio {
    border-radius: 8px;
    background: rgba(26, 26, 26, 0.05);
}

.call-message audio::-webkit-media-controls-panel {
    background: transparent;
}

/* Muted state for mute button */
#active-call-mute-btn.muted {
    background-color: rgba(239, 68, 68, 0.3);
}

#active-call-mute-btn.muted svg {
    stroke: #ef4444;
}

/* Transcribe button */
.transcribe-btn {
    transition: all 0.2s ease;
}

.transcribe-btn:hover {
    transform: translateX(4px);
}

.transcribe-btn.loading {
    opacity: 0.5;
    pointer-events: none;
}

.transcribe-btn.loading::after {
    content: '...';
    animation: loadingDots 1s steps(4) infinite;
}

@keyframes loadingDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* Call status indicators */
.call-status-ringing {
    animation: ringingPulse 1s ease-in-out infinite;
}

@keyframes ringingPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.call-status-connecting {
    animation: connectingDots 1.5s ease-in-out infinite;
}

@keyframes connectingDots {
    0%, 20% {
        opacity: 0.2;
    }
    50% {
        opacity: 1;
    }
    80%, 100% {
        opacity: 0.2;
    }
}

/* Voicemail badge */
.voicemail-badge {
    background: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}
