/* Audio Chat Page Styles */

.audio-chat-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    touch-action: manipulation; /* Prevent double-tap zoom */
}

/* Auto-Reconnect Notice */
.auto-reconnect-notice {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    font-size: 15px;
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.reconnect-timer {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 700;
    animation: pulse 1s ease-in-out infinite;
}

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

.cancel-auto-find-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ff4757;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.cancel-auto-find-btn:hover {
    background: #ff3838;
    transform: scale(1.1);
}

.cancel-auto-find-btn svg {
    stroke: white;
}

/* Audio Chat Header - Mobile First */
.audio-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    min-height: 60px;
    z-index: 10;
    position: relative;
}

/* Adjust header position when auto-reconnect notice is visible */
.audio-chat-container.has-auto-reconnect .audio-chat-header {
    margin-top: 48px; /* Height of auto-reconnect notice */
}

/* Contact Info Section */
.contact-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00a884 0%, #00c9a0 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.contact-name {
    margin: 0;
    font-size: 0.95rem;
    color: #1a202c;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-status {
    font-size: 0.8rem;
    font-weight: 500;
}

    .contact-status.online {
        color: #10b981;
    }

    .contact-status.offline {
        color: #6b7280;
    }

    .contact-status.searching {
        color: #00a884;
        animation: pulse 2s ease-in-out infinite;
    }

/* Online Users Badge */
.online-users-badge {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.475rem 0.95rem;
    background: linear-gradient(135deg, #00a884 0%, #00c9a0 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
    animation: fadeIn 0.3s ease-out;
}

    .online-users-badge svg {
        width: 16px;
        height: 16px;
        stroke: white;
    }

.online-count {
    font-size: 0.85rem;
    font-weight: 600;
}

.audio-chat-actions, .chat-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.audio-chat-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.online-count {
    font-weight: 600;
}

/* Buttons - Touch-Friendly for Mobile */
.btn-find-partner {
    padding: 0.875rem 1.75rem;
    background: linear-gradient(135deg, #00a884 0%, #00c9a0 100%);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 168, 132, 0.3);
    min-height: 44px;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

    .btn-find-partner:active {
        transform: scale(0.98);
        box-shadow: 0 2px 8px rgba(0, 168, 132, 0.4);
    }

@media (hover: hover) {
    .btn-find-partner:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(0, 168, 132, 0.5);
    }
}

.btn-cancel-search {
    padding: 0.875rem 1.75rem;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

    .btn-cancel-search:active {
        transform: scale(0.98);
        background: #ff3838;
    }

@media (hover: hover) {
    .btn-cancel-search:hover {
        background: #ff3838;
        transform: translateY(-2px);
    }
}

.icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    -webkit-tap-highlight-color: transparent;
}

    .icon-btn:active {
        transform: scale(0.95);
        background: #e5e7eb;
    }

@media (hover: hover) {
    .icon-btn:hover {
        background: #e5e7eb;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    }
}

.icon-btn.btn-leave {
    background: #ff4757;
}

    .icon-btn.btn-leave:active {
        background: #ff3838;
    }

@media (hover: hover) {
    .icon-btn.btn-leave:hover {
        background: #ff3838;
    }
}

.icon-btn svg, .icon-btn .icon {
    width: 20px;
    height: 20px;
    stroke: #4b5563;
}

.icon-btn.btn-leave svg, .icon-btn.btn-leave .icon {
    stroke: white;
}

/* Searching Animation */
.searching-pulse {
    animation: searchPulse 2s ease-in-out infinite;
}

@keyframes searchPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
}

/* Find Partner Center Card */
.find-partner-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    min-height: 400px;
}

.find-partner-card {
    background: white;
    border-radius: 24px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    max-width: 420px;
    width: 90%;
    animation: fadeInUp 0.5s ease-out;
}

.find-partner-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #00a884 0%, #00c9a0 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 168, 132, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

.find-partner-icon svg {
    color: white;
    width: 48px;
    height: 48px;
}

.find-partner-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 0.75rem 0;
}

.find-partner-description {
    font-size: 1rem;
    color: #6b7280;
    margin: 0 0 2rem 0;
    line-height: 1.6;
}

.btn-find-partner-center {
    background: linear-gradient(135deg, #00a884 0%, #00c9a0 100%);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 168, 132, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-find-partner-center:hover {
    background: linear-gradient(135deg, #00c9a0 0%, #00a884 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 168, 132, 0.4);
}

.btn-find-partner-center:active {
    transform: translateY(0);
}

.btn-find-partner-center svg {
    width: 20px;
    height: 20px;
}

/* Searching Animation */
.searching-animation {
    background: white;
    border-radius: 24px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    max-width: 420px;
    width: 90%;
    animation: fadeInUp 0.5s ease-out;
}

.searching-dots {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.searching-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00a884 0%, #00c9a0 100%);
    animation: searchingBounce 1.4s infinite ease-in-out;
}

.searching-dot:nth-child(1) {
    animation-delay: 0s;
}

.searching-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.searching-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes searchingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-20px);
    }
}

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

.searching-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 0.5rem 0;
}

.searching-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin: 0 0 2rem 0;
}

.btn-cancel-search-center {
    background: transparent;
    color: #ff4757;
    border: 2px solid #ff4757;
    padding: 0.75rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-cancel-search-center:hover {
    background: #ff4757;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(255, 71, 87, 0.3);
}

.btn-cancel-search-center:active {
    transform: translateY(0);
}

.btn-cancel-search-center svg {
    width: 16px;
    height: 16px;
}

/* No Partner Message - Legacy (kept for backward compatibility) */
.no-partner-message {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-partner-content {
    text-align: center;
    color: white;
    max-width: 500px;
    padding: 2rem;
}

.audio-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
}

.no-partner-content h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.no-partner-content p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Audio Call Interface */
.audio-call-interface {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-active-view, .ready-to-call-view {
    text-align: center;
    color: white;
    padding: 2rem;
}

.audio-visualizer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.avatar-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.avatar-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00a884 0%, #00c9a0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    color: white;
    font-weight: 600;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

    .avatar-circle.speaking {
        box-shadow: 0 0 0 15px rgba(0, 201, 160, 0.3), 0 10px 40px rgba(0, 0, 0, 0.3);
        transform: scale(1.05);
    }

.avatar-text {
    font-size: 4rem;
}

.audio-waves {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.wave {
    width: 6px;
    height: 30px;
    background: white;
    border-radius: 3px;
    animation: wave 1s ease-in-out infinite;
}

    .wave:nth-child(1) {
        animation-delay: 0s;
    }

    .wave:nth-child(2) {
        animation-delay: 0.2s;
    }

    .wave:nth-child(3) {
        animation-delay: 0.4s;
    }

@keyframes wave {
    0%, 100% {
        transform: scaleY(0.5);
        opacity: 0.5;
    }

    50% {
        transform: scaleY(1.5);
        opacity: 1;
    }
}

.partner-name-large {
    font-size: 2.5rem;
    margin: 0;
    font-weight: 600;
}

.call-status {
    font-size: 1.2rem;
    opacity: 0.9;
    margin: 0.5rem 0;
}

.call-duration {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1rem;
}

/* Call Controls */
.call-controls {
    display: flex;
    gap: 2rem;
    margin-top: 3rem;
    justify-content: center;
}

.call-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

    .call-btn:hover {
        transform: scale(1.1);
        background: rgba(255, 255, 255, 0.3);
    }

    .call-btn.muted {
        background: rgba(255, 77, 77, 0.8);
    }

    .call-btn.hangup-btn {
        background: linear-gradient(135deg, #ff4d4d 0%, #ff2a2a 100%);
    }

        .call-btn.hangup-btn:hover {
            background: linear-gradient(135deg, #ff2a2a 0%, #ff0000 100%);
            transform: scale(1.15);
        }

    .call-btn .icon {
        width: 30px;
        height: 30px;
    }

/* Ready to Call View */
.ready-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

    .ready-content .avatar-circle {
        width: 150px;
        height: 150px;
    }

    .ready-content h3 {
        font-size: 2rem;
        margin: 0;
    }

    .ready-content p {
        font-size: 1.2rem;
        opacity: 0.9;
        margin: 0;
    }

/* Confirmation Dialog */
.confirm-dialog {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

.confirm-header {
    margin-bottom: 1rem;
}

.confirm-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.confirm-title svg {
    color: #ff9800;
}

.confirm-body {
    margin-bottom: 1.5rem;
}

.confirm-message {
    font-size: 1rem;
    line-height: 1.6;
    color: #6b7280;
    margin: 0;
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-confirm-cancel,
.btn-confirm-ok {
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-confirm-cancel {
    background: #f0f2f5;
    color: #1f2937;
}

.btn-confirm-cancel:hover {
    background: #e4e6eb;
}

.btn-confirm-ok {
    background: #dc3545;
    color: white;
}

.btn-confirm-ok:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

/* Options Menu */
.options-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.options-menu {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

.options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

    .options-header h3 {
        margin: 0;
        font-size: 1.5rem;
        color: #333;
    }

.close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

    .close-btn:hover {
        background: #e0e0e0;
        transform: scale(1.1);
    }

.options-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.option-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

    /* Modern Checkbox Design */
    .option-item label {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        cursor: pointer;
        font-size: 1rem;
        color: #333;
        font-weight: 500;
    }

    .option-item input[type="checkbox"] {
        appearance: none;
        -webkit-appearance: none;
        width: 50px;
        height: 28px;
        background: #ddd;
        border-radius: 50px;
        position: relative;
        cursor: pointer;
        transition: all 0.3s ease;
        outline: none;
        margin: 0;
    }

        .option-item input[type="checkbox"]:checked {
            background: linear-gradient(135deg, #00a884 0%, #00c9a0 100%);
        }

        .option-item input[type="checkbox"]::before {
            content: '';
            position: absolute;
            width: 22px;
            height: 22px;
            border-radius: 50%;
            background: white;
            top: 3px;
            left: 3px;
            transition: all 0.3s ease;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        }

        .option-item input[type="checkbox"]:checked::before {
            left: 25px;
        }

        .option-item input[type="checkbox"]:hover {
            opacity: 0.9;
        }

.option-description {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
    padding-left: 58px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Responsive Design - Mobile First Approach */

/* Small Mobile Phones (320px - 480px) */
@media (max-width: 480px) {
    .chat-actions .btn-find-partner, .chat-actions .btn-cancel-search {
        display: none;
    }

    .audio-chat-header {
        padding: 0.625rem 0.875rem;
        min-height: 56px;
    }

    .audio-chat-container.has-auto-reconnect .audio-chat-header {
        margin-top: 48px;
    }

    .chat-header-avatar {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .contact-info {
        gap: 0.625rem;
    }

    .contact-name {
        font-size: 0.875rem;
    }

    .contact-status {
        font-size: 0.75rem;
    }   

    .audio-chat-actions, .chat-actions {
        gap: 0.375rem;
    }

    .btn-find-partner,
    .btn-cancel-search {
        padding: 0.75rem 1.25rem;
        font-size: 0.875rem;
    }

    .icon-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

        .icon-btn svg, .icon-btn .icon {
            width: 18px;
            height: 18px;
        }

    /* Audio Call Layout */
    .avatar-circle {
        width: 120px;
        height: 120px;
        font-size: 2rem;
    }

    .avatar-text {
        font-size: 2.5rem;
    }

    .partner-name-large {
        font-size: 1.75rem;
    }

    .call-status {
        font-size: 1rem;
    }

    .call-duration {
        font-size: 1.25rem;
    }

    .call-controls {
        gap: 1.25rem;
        margin-top: 2rem;
    }

    .call-btn {
        width: 56px;
        height: 56px;
    }

        .call-btn .icon {
            width: 26px;
            height: 26px;
        }

    .audio-icon {
        font-size: 3.5rem;
    }

    .no-partner-content h3 {
        font-size: 1.5rem;
    }

    .no-partner-content p {
        font-size: 1rem;
    }

    .options-menu {
        min-width: 280px;
        max-width: 92%;
        padding: 1.25rem;
    }

    .options-header h3 {
        font-size: 1.25rem;
    }
}

/* Tablets and Medium Mobile (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .audio-chat-header {
        padding: 0.75rem 1rem;
    }

    .online-users-badge {
        display: flex; /* Show on tablets */
    }

    .avatar-circle {
        width: 150px;
        height: 150px;
        font-size: 2.75rem;
    }

    .partner-name-large {
        font-size: 2.25rem;
    }

    .call-controls {
        gap: 1.75rem;
        margin-top: 2.5rem;
    }

    .call-btn {
        width: 64px;
        height: 64px;
    }
}

/* Landscape Mobile Orientation */
@media (max-height: 500px) and (orientation: landscape) {
    .audio-chat-header {
        padding: 0.5rem 1rem;
        min-height: 50px;
    }

    .chat-header-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .contact-name {
        font-size: 0.85rem;
    }

    .contact-status {
        display: none; /* Hide status in landscape */
    }

    .avatar-circle {
        width: 100px;
        height: 100px;
        font-size: 2rem;
    }

    .call-controls {
        margin-top: 1.5rem;
        gap: 1rem;
    }

    .call-btn {
        width: 50px;
        height: 50px;
    }

    .partner-name-large {
        font-size: 1.5rem;
    }

    .call-status,
    .call-duration {
        font-size: 0.9rem;
    }
}

/* Desktop and Larger Screens (769px+) */
@media (min-width: 769px) {
    .audio-chat-header {
        padding: 1rem 1.5rem;
    }

    .chat-header-avatar {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    .contact-info {
        gap: 1rem;
    }

    .contact-name {
        font-size: 1.1rem;
    }

    .contact-status {
        font-size: 0.9rem;
    }

    .audio-chat-actions, .chat-actions {
        gap: 0.75rem;
    }

    .avatar-circle {
        width: 180px;
        height: 180px;
        font-size: 3.5rem;
    }
}
