/* Voice Recorder Styles */
.voice-recorder-container {
    width: 100%;
    position: relative;
}

/* Input Row */
.input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.message-input {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
    background: #f5f5f5;
    font-family: 'MainFont', Arial, sans-serif;
}

.message-input:focus {
    border-color: #1976D2;
    background: white;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.message-field {
    flex: 1;
}

/* Action Buttons */
.action-btn {
    flex-shrink: 0;
    transition: all 0.2s ease;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    outline: none;
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn i {
    font-size: 24px;
}

.mic-btn {
    background-color: #1976D2 !important;
    color: white !important;
}

.mic-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.mic-btn:active {
    transform: scale(0.95);
}

.send-btn {
    transform: rotate(180deg);
}

.send-btn:hover {
    transform: rotate(180deg) scale(1.05);
}

/* Desktop Styles - Default */
@media (min-width: 769px) {
    .recording-overlay {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        background: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        pointer-events: none;
    }

    .recording-backdrop {
        display: none;
    }

    .recording-container {
        position: relative;
        width: 100%;
        max-width: none;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        pointer-events: auto;
        margin-left: 0;
    }

    .recording-content {
        background: #f3f4f6;
        border-radius: 24px;
        padding: 0 24px;
        box-shadow: none;
        display: flex;
        align-items: center;
        gap: 16px;
        border: 1px solid #e0e0e0;
        height: 48px;
        box-sizing: border-box;
    }

    .timer-section {
        text-align: left;
        margin-bottom: 0;
        order: 2;
        min-width: 60px;
        display: flex;
        align-items: center;
    }

    .locked-title {
        display: none;
    }

    .timer {
        font-size: 16px;
        font-weight: 500;
        color: #1976D2;
        font-variant-numeric: tabular-nums;
        margin: 0;
    }

    .visualizer-section {
        margin-bottom: 0;
        order: 3;
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .visualizer {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 32px;
        gap: 2px;
        width: 100%;
    }

    .bar {
        width: 3px;
        background: linear-gradient(to top, #1976D2, #42A5F5);
        border-radius: 1px;
        transition: height 0.1s ease-out;
    }

    .actions-section {
        display: flex;
        justify-content: flex-start;
        order: 1;
        gap: 8px;
        min-width: 180px;
    }

    .mobile-controls {
        display: none;
    }

    .locked-actions {
        display: flex;
        gap: 8px;
        justify-content: flex-end;
        width: 100%;
    }

    .action-button {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 6px 20px;
        border: none;
        border-radius: 20px;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
        font-family: 'MainFont', Arial, sans-serif;
        flex: 1;
        justify-content: center;
        min-width: 80px;
        height: 32px;
    }

    .action-button i {
        font-size: 16px;
    }

    .delete-button {
        background: #ffebee;
        color: #f44336;
        min-width: auto;
    }

    .delete-button:hover {
        background: #f44336;
        color: white;
        transform: scale(1.05);
    }

    .send-button {
        background: #1976D2;
        color: white;
        min-width: auto;
    }

    .send-button:hover {
        background: #1565C0;
        transform: scale(1.05);
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .recording-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        display: flex;
        align-items: flex-end;
        justify-content: center;
        animation: overlay-enter 0.3s ease-out;
    }

    .recording-backdrop {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
        transition: background 0.3s ease;
    }

    .recording-container {
        position: relative;
        width: 100%;
        max-width: 360px;
        max-height: 22vh;
        margin: 0 20px 110px 20px;
        animation: container-fade-in 0.4s ease-out;
    }

    .recording-content {
        background: linear-gradient(145deg, 
            rgba(255, 255, 255, 0.98), 
            rgba(248, 250, 252, 0.95));
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-radius: 24px;
        padding: 20px 16px 20px;
        box-shadow: 
            0 -12px 40px rgba(0, 0, 0, 0.1),
            0 -4px 16px rgba(25, 118, 210, 0.06),
            0 1px 0 rgba(255, 255, 255, 0.8) inset;
        border: 1px solid rgba(255, 255, 255, 0.4);
        position: relative;
        overflow: hidden;
        height: 100%;
        display: flex;
        flex-direction: column;
        touch-action: none;
    }

    .recording-content::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: linear-gradient(90deg, 
            rgba(156, 163, 175, 0.6), 
            rgba(107, 114, 128, 0.8), 
            rgba(156, 163, 175, 0.6));
        border-radius: 2px;
        cursor: grab;
        z-index: 10;
        transition: all 0.2s ease;
    }

    .recording-content::before:active {
        cursor: grabbing;
        background: linear-gradient(90deg, 
            rgba(107, 114, 128, 0.8), 
            rgba(75, 85, 99, 1), 
            rgba(107, 114, 128, 0.8));
        transform: translateX(-50%) scale(1.1);
    }

    .cancel-indicator {
        position: absolute;
        top: 30px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        background: rgba(244, 67, 54, 0.9);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 600;
        z-index: 15;
        animation: pulse-indicator 1s ease-in-out infinite;
    }

    .cancel-indicator i {
        font-size: 16px;
    }

    .timer-section {
        text-align: center;
        margin-bottom: 12px;
        margin-top: 2px;
        flex-shrink: 0;
    }

    .locked-title {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        background: linear-gradient(135deg, #1976D2, #42A5F5);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        margin: 0 0 6px 0;
        font-size: 13px;
        font-weight: 600;
        letter-spacing: 0.2px;
    }

    .locked-title i {
        font-size: 15px;
        color: #1976D2;
        -webkit-text-fill-color: #1976D2;
    }

    .timer {
        font-size: 24px;
        font-weight: 200;
        background: linear-gradient(135deg, #1a202c, #2d3748);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        font-variant-numeric: tabular-nums;
        letter-spacing: 1px;
        font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    }

    .visualizer-section {
        margin-bottom: 14px;
        padding: 10px 8px;
        background: linear-gradient(135deg, 
            rgba(25, 118, 210, 0.05), 
            rgba(66, 165, 245, 0.03));
        border-radius: 12px;
        border: 1px solid rgba(25, 118, 210, 0.06);
        flex: 1;
        min-height: 45px;
        position: relative;
        overflow: hidden;
    }

    .visualizer {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 45px;
        gap: 2px;
        padding: 0 12px;
        position: relative;
        z-index: 1;
    }

    .bar {
        width: 3px;
        background: linear-gradient(to top, 
            #1976D2 0%, 
            #42A5F5 50%, 
            #64B5F6 100%);
        border-radius: 2px;
        transition: height 0.15s ease;
        box-shadow: 0 1px 4px rgba(25, 118, 210, 0.15);
    }

    .actions-section {
        display: flex;
        justify-content: center;
        flex-shrink: 0;
        margin-top: auto;
    }

    .locked-actions {
        display: none;
    }

    .mobile-controls {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 16px;
        width: 100%;
        padding: 0 8px;
    }

    .control-button {
        width: 52px;
        height: 52px;
        border-radius: 50%;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    }

    .control-button::before {
        content: '';
        position: absolute;
        top: -2px;
        left: -2px;
        right: -2px;
        bottom: -2px;
        border-radius: 50%;
        border: 2px solid transparent;
        background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
        animation: rotate-border 2s linear infinite;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .control-button:active::before {
        opacity: 1;
    }

    .control-button:active {
        transform: scale(0.95);
    }

    .control-button i {
        font-size: 22px;
        position: relative;
        z-index: 2;
    }

    .control-button span {
        position: absolute;
        bottom: -20px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 10px;
        font-weight: 600;
        white-space: nowrap;
        opacity: 0.8;
        z-index: 2;
    }

    .send-button {
        background: linear-gradient(135deg, #1976D2, #42A5F5);
        color: white;
        order: 1;
    }

    .send-button::before {
        background: linear-gradient(45deg, 
            transparent, 
            rgba(255, 255, 255, 0.4), 
            transparent);
    }

    .pause-button {
        background: linear-gradient(135deg, #FF9800, #FFB74D);
        color: white;
        order: 2;
    }

    .pause-button::before {
        background: linear-gradient(45deg, 
            transparent, 
            rgba(255, 255, 255, 0.4), 
            transparent);
    }

    .delete-button {
        background: linear-gradient(135deg, #F44336, #EF5350);
        color: white;
        order: 3;
    }

    .delete-button::before {
        background: linear-gradient(45deg, 
            transparent, 
            rgba(255, 255, 255, 0.4), 
            transparent);
    }
}

/* Touch Device Optimizations */
@media (hover: none) {
    .action-btn {
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
    
    .recording-container {
        touch-action: none;
    }

    .control-button {
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }

    .control-button:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    .bar {
        animation: pulse-glow 2.5s ease-in-out infinite;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    @media (max-width: 768px) {
        .recording-backdrop {
            background: rgba(0, 0, 0, 0.2);
        }
        
        .recording-content {
            background: linear-gradient(145deg, 
                rgba(30, 30, 30, 0.98), 
                rgba(40, 40, 40, 0.95));
            border: 1px solid rgba(255, 255, 255, 0.08);
            box-shadow: 
                0 -12px 40px rgba(0, 0, 0, 0.4),
                0 -4px 16px rgba(0, 0, 0, 0.2),
                0 1px 0 rgba(255, 255, 255, 0.1) inset;
        }
        
        .recording-content::before {
            background: linear-gradient(90deg, 
                rgba(156, 163, 175, 0.3), 
                rgba(107, 114, 128, 0.5), 
                rgba(156, 163, 175, 0.3));
        }
        
        .timer {
            background: linear-gradient(135deg, #f8fafc, #e2e8f0);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        .locked-title {
            background: linear-gradient(135deg, #42A5F5, #90CAF9);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .locked-title i {
            color: #42A5F5;
            -webkit-text-fill-color: #42A5F5;
        }

        .visualizer-section {
            background: linear-gradient(135deg, 
                rgba(66, 165, 245, 0.08), 
                rgba(144, 202, 249, 0.05));
            border: 1px solid rgba(66, 165, 245, 0.12);
        }

        .control-button {
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
        }
    }
    
    @media (min-width: 769px) {
        .recording-content {
            background: #1e1e1e;
            color: white;
        }
        
        .timer {
            color: white;
        }
    }
}

/* Animations */
@keyframes overlay-enter {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
    }
}

@keyframes container-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes rotate-border {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes slide-up {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes pulse-indicator {
    0%, 100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateX(-50%) scale(1.05);
        opacity: 0.8;
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 1px 4px rgba(25, 118, 210, 0.15);
    }
    50% {
        box-shadow: 0 2px 8px rgba(25, 118, 210, 0.3);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}