/* Click-to-Call Plugin Styles */

/* Clickable phone numbers */
.ctc-enabled {
    cursor: pointer;
    transition: all 0.2s ease;
    color: #007bff;
}

.ctc-enabled:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Phone numbers detected in text */
.ctc-phone-number {
    display: inline;
}

.ctc-phone-number.ctc-enabled {
    color: #007bff;
    cursor: pointer;
    position: relative;
}

.ctc-phone-number.ctc-enabled::before {
    content: "📞 ";
    font-size: 0.85em;
}

.ctc-phone-number.ctc-enabled:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Tel links */
a[href^="tel:"].ctc-enabled {
    color: #007bff;
}

a[href^="tel:"].ctc-enabled::before {
    content: "📞 ";
    font-size: 0.85em;
}

a[href^="tel:"].ctc-enabled:hover {
    color: #0056b3;
}

/* Notification popups */
.ctc-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: #fff;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: ctc-slide-in 0.3s ease;
    max-width: 350px;
    font-size: 14px;
}

.ctc-notification-calling {
    background: #17a2b8;
}

.ctc-notification-success {
    background: #28a745;
}

.ctc-notification-error {
    background: #dc3545;
}

.ctc-notification-warning {
    background: #ffc107;
    color: #333;
}

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

/* Dial Pad Modal */
.ctc-dialpad-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    justify-content: center;
    align-items: center;
    animation: ctc-fade-in 0.2s ease;
}

@keyframes ctc-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ctc-dialpad-content {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 320px;
    max-width: 95vw;
    overflow: hidden;
    animation: ctc-scale-in 0.2s ease;
}

@keyframes ctc-scale-in {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.ctc-dialpad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.ctc-dialpad-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.ctc-dialpad-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ctc-dialpad-close:hover {
    opacity: 1;
}

.ctc-dialpad-body {
    padding: 20px;
}

.ctc-phone-display {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    gap: 8px;
}

.ctc-phone-input {
    flex: 1;
    padding: 10px 12px;
    font-size: 18px;
    font-weight: 500;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    text-align: center;
    letter-spacing: 1px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    min-width: 0;
}

.ctc-phone-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.ctc-phone-input::placeholder {
    font-size: 13px;
    color: #aaa;
    letter-spacing: 0;
}

.ctc-backspace {
    background: #f5f5f5;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.2s;
}

.ctc-backspace:hover {
    background: #e0e0e0;
    color: #333;
}

.ctc-backspace:active {
    transform: scale(0.95);
}

.ctc-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.ctc-key {
    background: #f8f9fa;
    border: none;
    border-radius: 50%;
    width: 72px;
    height: 72px;
    margin: 0 auto;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ctc-key:hover {
    background: #e9ecef;
    transform: scale(1.05);
}

.ctc-key:active {
    background: #dee2e6;
    transform: scale(0.95);
}

.ctc-key-number {
    font-size: 26px;
    font-weight: 500;
    color: #333;
    line-height: 1;
}

.ctc-key-letters {
    font-size: 9px;
    color: #888;
    letter-spacing: 1px;
    margin-top: 2px;
    text-transform: uppercase;
}

.ctc-call-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.ctc-call-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

.ctc-call-btn:active {
    transform: translateY(0);
}

/* Top nav icon styling */
#ctc-dialpad-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    transition: color 0.2s;
}

#ctc-dialpad-trigger:hover {
    color: #28a745;
}

#ctc-dialpad-trigger.ctc-dnd-active {
    color: #dc3545 !important;
    position: relative;
}

.ctc-dnd-badge {
    position: absolute;
    top: -2px;
    right: -6px;
    background: #dc3545;
    color: white;
    font-size: 8px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
}

#ctc-dialpad-trigger svg {
    width: 22px;
    height: 22px;
}

/* Enhanced Dialpad Content */
.ctc-dialpad-enhanced {
    width: 340px;
}

/* DND Section */
.ctc-dnd-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.ctc-dnd-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ctc-dnd-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ctc-dnd-label {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.ctc-toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.ctc-toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.ctc-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}

.ctc-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.ctc-toggle-input:checked + .ctc-toggle-slider {
    background-color: #dc3545;
}

.ctc-toggle-input:checked + .ctc-toggle-slider:before {
    transform: translateX(20px);
}

.ctc-dnd-select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    background: white;
}

.ctc-dnd-select:disabled {
    opacity: 0.5;
}

.ctc-dnd-status {
    margin-top: 8px;
    font-size: 11px;
    color: #dc3545;
    font-weight: 500;
}

/* Quick Actions */
.ctc-quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.ctc-quick-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.ctc-quick-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.ctc-quick-btn svg {
    width: 16px;
    height: 16px;
}

.ctc-vm-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* Recent Calls Section */
.ctc-recent-section {
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 12px;
    max-height: 200px;
    overflow: hidden;
}

.ctc-recent-header {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    border-bottom: 1px solid #e9ecef;
}

.ctc-recent-list {
    max-height: 160px;
    overflow-y: auto;
}

.ctc-recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.ctc-recent-item:last-child {
    border-bottom: none;
}

.ctc-recent-item:hover {
    background: #e9ecef;
}

.ctc-recent-dir {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.ctc-recent-dir.inbound {
    background: #dcfce7;
    color: #16a34a;
}

.ctc-recent-dir.outbound {
    background: #dbeafe;
    color: #2563eb;
}

.ctc-recent-info {
    flex: 1;
    min-width: 0;
}

.ctc-recent-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ctc-recent-phone {
    font-size: 11px;
    color: #888;
}

.ctc-recent-time {
    font-size: 10px;
    color: #aaa;
    white-space: nowrap;
}

.ctc-recent-loading,
.ctc-recent-empty {
    padding: 20px;
    text-align: center;
    color: #888;
    font-size: 13px;
}

/* Floating dial button (fallback) */
#ctc-floating-dial {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

#ctc-floating-dial:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

#ctc-floating-dial:active {
    transform: scale(0.95);
}

/* Mobile responsiveness for dial pad */
@media (max-width: 360px) {
    .ctc-dialpad-content {
        width: 100%;
        border-radius: 0;
        height: 100vh;
    }
    
    .ctc-key {
        width: 60px;
        height: 60px;
    }
    
    .ctc-key-number {
        font-size: 22px;
    }
}

/* Transcript Chat Styles */
.transcript-chat-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.chat-bubble {
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.segment-bubble {
    transition: opacity 0.2s ease;
}

.segment-bubble:hover {
    opacity: 0.9;
}

.segment-bubble.active {
    animation: pulse-highlight 0.5s ease;
}

@keyframes pulse-highlight {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.timestamp-link {
    color: #6c757d;
    font-size: 11px;
}

.timestamp-link:hover {
    color: #0d6efd;
}

/* Words transcript styles */
.transcript-words {
    line-height: 1.8;
}

.transcript-word {
    cursor: pointer;
    padding: 2px 3px;
    border-radius: 3px;
    transition: all 0.15s ease;
}

.transcript-word:hover {
    background-color: #e3f2fd;
}

.transcript-word.active-word {
    background-color: #fff3cd;
    font-weight: 600;
}

/* =========================================================================
   SCHEDULED CALLBACK POPUP
   ========================================================================= */

.ctc-callback-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 320px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    overflow: hidden;
    animation: ctc-slide-in 0.3s ease-out;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

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

.ctc-callback-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 12px 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ctc-callback-header i {
    margin-right: 8px;
}

.ctc-callback-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
    line-height: 1;
    padding: 0;
}

.ctc-callback-close:hover {
    opacity: 1;
}

.ctc-callback-body {
    padding: 16px;
}

.ctc-callback-contact {
    font-size: 16px;
    margin-bottom: 8px;
}

.ctc-callback-phone {
    font-size: 18px;
    color: #007bff;
    margin-bottom: 8px;
}

.ctc-callback-phone i {
    margin-right: 6px;
}

.ctc-callback-notes {
    background: #f8f9fa;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    color: #666;
    font-style: italic;
}

.ctc-callback-time {
    color: #888;
}

.ctc-callback-actions {
    padding: 12px 16px;
    background: #f8f9fa;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid #eee;
}

.ctc-callback-actions .btn {
    flex: 1;
    min-width: 70px;
}

.ctc-callback-actions .btn-success {
    flex: 2;
}

/* Pulse animation for urgent callbacks */
.ctc-callback-popup.urgent {
    animation: ctc-slide-in 0.3s ease-out, ctc-pulse 2s infinite;
}

@keyframes ctc-pulse {
    0% {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 8px 32px rgba(40, 167, 69, 0.4), 0 2px 8px rgba(40, 167, 69, 0.2);
    }
    100% {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.15);
    }
}

/* Schedule Callback Button */
.btn-schedule-callback {
    margin-left: 4px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .ctc-callback-popup {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .ctc-callback-body {
        color: #e2e8f0;
    }
    
    .ctc-callback-notes {
        background: #1a202c;
        color: #a0aec0;
    }
    
    .ctc-callback-actions {
        background: #1a202c;
        border-color: #4a5568;
    }
}
