/**
 * Multimodal Widget Styles
 *
 * Styles for media uploads, voice calls, and multimodal chat features
 *
 * @package Antek_Chat_Connector
 * @since 1.1.0
 */

/* ==========================================================================
   File Upload Drop Zone
   ========================================================================== */

#antek-chat-drop-zone {
    position: relative;
    padding: 20px;
    border: 2px dashed rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.02);
    text-align: center;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    display: none; /* Hidden by default, shown when attachment button clicked */
}

#antek-chat-drop-zone.active {
    display: block;
}

#antek-chat-drop-zone.antek-drag-over {
    border-color: var(--antek-primary, #FF6B4A);
    background: rgba(255, 107, 74, 0.05);
}

#antek-chat-drop-zone p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

#antek-file-input {
    display: none;
}

/* ==========================================================================
   File Preview Container
   ========================================================================== */

.antek-file-preview-container {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 10px;
    padding: 5px;
}

.antek-file-preview-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 8px;
    position: relative;
    transition: all 0.3s ease;
}

.antek-file-preview-item.antek-upload-complete {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.antek-file-preview-item.antek-upload-error {
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
}

/* ==========================================================================
   File Preview Content
   ========================================================================== */

.antek-file-preview-content {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 6px;
    margin-right: 12px;
    overflow: hidden;
}

.antek-file-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.antek-file-preview-content svg {
    width: 30px;
    height: 30px;
    color: #666;
}

/* ==========================================================================
   File Info
   ========================================================================== */

.antek-file-info {
    flex-grow: 1;
    min-width: 0;
}

.antek-file-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.antek-file-size {
    font-size: 12px;
    color: #999;
}

/* ==========================================================================
   Upload Progress
   ========================================================================== */

.antek-upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.antek-upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--antek-primary, #FF6B4A), var(--antek-secondary, #8FA68E));
    transition: width 0.3s ease;
    width: 0;
}

/* ==========================================================================
   File Actions
   ========================================================================== */

.antek-file-cancel {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: #666;
    transition: all 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.antek-file-cancel:hover {
    background: rgba(244, 67, 54, 0.8);
    color: #fff;
}

/* ==========================================================================
   Upload Errors
   ========================================================================== */

.antek-upload-error-message {
    position: absolute;
    bottom: 4px;
    left: 10px;
    right: 40px;
    font-size: 11px;
    color: #f44336;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
}

.antek-upload-error-toast {
    padding: 10px 15px;
    background: #f44336;
    color: #fff;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 13px;
    animation: slideInDown 0.3s ease;
}

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

/* ==========================================================================
   Chat Controls Bar
   ========================================================================== */

.antek-chat-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

#antek-attach-button,
#antek-voice-call-button {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#antek-attach-button:hover,
#antek-voice-call-button:hover {
    background: rgba(0, 0, 0, 0.1);
}

#antek-voice-call-button.connected {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

#antek-voice-call-button.connecting {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* ==========================================================================
   Attachment Counter
   ========================================================================== */

#antek-attachment-counter {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    background: var(--antek-primary, #FF6B4A);
    color: #fff;
    border-radius: 9px;
    font-size: 11px;
    font-weight: bold;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

#antek-attachment-counter.show {
    display: flex;
}

/* ==========================================================================
   Voice Status Indicator
   ========================================================================== */

#antek-voice-status {
    flex-grow: 1;
    font-size: 12px;
    color: #999;
    text-align: center;
    display: none;
}

#antek-voice-status.active {
    display: block;
}

#antek-voice-status.user-speaking {
    color: #2196f3;
    font-weight: 500;
}

#antek-voice-status.agent-speaking {
    color: #4caf50;
    font-weight: 500;
}

/* ==========================================================================
   Media in Messages
   ========================================================================== */

.antek-message-media {
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.antek-media-preview {
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.02);
}

.antek-media-image {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.antek-media-image:hover {
    transform: scale(1.02);
}

.antek-media-audio,
.antek-media-video {
    max-width: 100%;
    border-radius: 8px;
    display: block;
}

.antek-media-audio {
    height: 40px;
}

.antek-media-video {
    max-height: 300px;
}

.antek-media-document {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    color: var(--antek-primary, #FF6B4A);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
}

.antek-media-document:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: translateX(2px);
}

/* ==========================================================================
   System Messages
   ========================================================================== */

.antek-chat-message-system {
    text-align: center;
    font-size: 12px;
    color: #999;
    font-style: italic;
    padding: 8px 12px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
}

/* ==========================================================================
   Error Messages
   ========================================================================== */

.antek-chat-error {
    padding: 10px 15px;
    background: rgba(244, 67, 54, 0.1);
    border-left: 3px solid #f44336;
    color: #d32f2f;
    border-radius: 6px;
    margin: 10px 0;
    font-size: 13px;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 480px) {
    .antek-file-preview-container {
        max-height: 150px;
    }

    .antek-file-preview-content {
        width: 40px;
        height: 40px;
    }

    .antek-file-name {
        font-size: 13px;
    }

    .antek-media-video {
        max-height: 200px;
    }

    #antek-attach-button,
    #antek-voice-call-button {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    #antek-chat-drop-zone {
        border-color: rgba(255, 255, 255, 0.2);
        background: rgba(255, 255, 255, 0.05);
    }

    #antek-chat-drop-zone p {
        color: #aaa;
    }

    .antek-file-preview-item {
        background: rgba(255, 255, 255, 0.05);
    }

    .antek-file-preview-content {
        background: rgba(255, 255, 255, 0.1);
    }

    .antek-file-name {
        color: #eee;
    }

    .antek-file-size {
        color: #999;
    }

    #antek-attach-button,
    #antek-voice-call-button {
        background: rgba(255, 255, 255, 0.1);
    }

    #antek-attach-button:hover,
    #antek-voice-call-button:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    .antek-media-preview {
        background: rgba(255, 255, 255, 0.05);
    }

    .antek-media-document {
        background: rgba(255, 255, 255, 0.1);
    }

    .antek-chat-message-system {
        background: rgba(255, 255, 255, 0.05);
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.antek-file-cancel:focus,
#antek-attach-button:focus,
#antek-voice-call-button:focus {
    outline: 2px solid var(--antek-primary, #FF6B4A);
    outline-offset: 2px;
}

/* Screen reader only */
.antek-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
