/* 기존 chat.htm 스타일과 호환성을 위한 CSS */

.voice-mic-container {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    box-sizing: border-box;
    /* 버튼 스타일 - 기존 chat.htm의 sendMessagea 버튼과 유사 */
    border: 1px solid currentColor;
    border-radius: 15px;
    padding: 16px 8px;
	width: 48px;
    /* 모바일 터치 최적화 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
    /* 테마 색상과 동기화 (동적으로 업데이트됨) */
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

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

/* 호버 효과 - 녹음 중이 아닐 때만 적용 */
.voice-mic-container:hover:not(.mic-recording):not(.mic-processing) {
    opacity: 0.8;
    background-color: rgba(128, 128, 128, 0.1);
    border-color: currentColor;
}

/* 클릭/활성 상태 효과 */
.voice-mic-container:active {
    opacity: 0.6;
    transform: scale(0.95);
}

.voice-mic-icon {
    object-fit: contain;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    display: block;
    margin: auto;
    /* 기존 chat.htm과 동일한 크기 */
    width: 30px;
    height: 30px;
    max-width: 100%;
    max-height: 100%;
}

/* SVG 아이콘 색상 제어 */
.voice-mic-icon[src*=".svg"] {
    filter: none; /* SVG는 CSS color로 제어 */
}

/* 녹음 중 상태 - 테두리 색상 변경 */
.voice-mic-container.mic-recording {
    animation: pulse 1.5s ease-in-out infinite;
    border-color: rgba(255, 0, 0, 0.6);
    background-color: rgba(255, 0, 0, 0.1);
}

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

/* 처리 중 상태 */
.voice-mic-container.mic-processing {
    opacity: 0.7;
    border-color: rgba(138, 139, 139, 0.5);
    background-color: rgba(255, 255, 255, 0.1);
}


/* 로딩 스피너 애니메이션 */
.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.spinner-circle {
    animation: spinner-dash 1.5s ease-in-out infinite;
}

@keyframes spinner-dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* 모바일 반응형 미디어 쿼리 */
@media screen and (max-width: 480px) {
    .voice-mic-container {
        padding: 2px;
        width: 52px;
        height: 30px;
        border-radius: 5px;
        margin-right: 3px;
    }
    
    .voice-mic-icon {
        width: 36px;
        height: 36px;
    }
}

/* 고해상도 디스플레이 최적화 */
@media screen and (-webkit-min-device-pixel-ratio: 2),
       screen and (min-resolution: 192dpi) {
    .voice-mic-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ========================================
   Circle Variant - 검색 페이지용
   ======================================== */

/* 기본 Circle 스타일 */
.voice-mic-container--circle {
    border: none !important;
    border-radius: 50% !important;
    padding: 8px !important;
    width: 40px !important;
    height: 40px !important;
    background-color: transparent;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

/* Circle 호버 효과 */
.voice-mic-container--circle:hover:not(.mic-recording):not(.mic-processing) {
    background-color: rgba(128, 128, 128, 0.08);
    transform: scale(1.05);
    opacity: 1;
}

/* Circle 클릭 효과 */
.voice-mic-container--circle:active {
    transform: scale(0.95);
    background-color: rgba(128, 128, 128, 0.15);
}

/* Circle 녹음 중 - 동그란 빨간 배경 */
.voice-mic-container--circle.mic-recording {
    background-color: rgba(255, 0, 0, 0.15) !important;
    animation: pulse-circle 1.5s ease-in-out infinite;
    border: none !important;
}

/* Circle 전용 펄스 애니메이션 */
@keyframes pulse-circle {
    0%, 100% {
        background-color: rgba(255, 0, 0, 0.15);
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.4);
    }
    50% {
        background-color: rgba(255, 0, 0, 0.25);
        box-shadow: 0 0 0 8px rgba(255, 0, 0, 0);
    }
}

/* Circle 처리 중 */
.voice-mic-container--circle.mic-processing {
    background-color: rgba(200, 200, 200, 0.1);
    opacity: 1;
}

/* Circle의 아이콘 크기 조정 */
.voice-mic-container--circle .voice-mic-icon {
    width: 24px;
    height: 24px;
}

/* 모바일에서 Circle variant */
@media screen and (max-width: 480px) {
    .voice-mic-container--circle {
        width: 44px !important;
        height: 44px !important;
        padding: 10px !important;
    }
    
    .voice-mic-container--circle .voice-mic-icon {
        width: 24px;
        height: 24px;
    }
}

/* ========================================
   Minimal Variant - 미래 확장용
   ======================================== */

.voice-mic-container--minimal {
    border: none !important;
    border-radius: 8px !important;
    padding: 6px !important;
    width: auto !important;
    background-color: transparent;
    transition: background-color 0.3s ease;
}

.voice-mic-container--minimal:hover:not(.mic-recording):not(.mic-processing) {
    background-color: rgba(128, 128, 128, 0.06);
}

.voice-mic-container--minimal.mic-recording {
    background-color: rgba(255, 0, 0, 0.1) !important;
    animation: pulse 1.5s ease-in-out infinite;
}