/* WhatsApp-style Call & Message Platform - Enhanced Version 2 */

/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --whatsapp-green: #25d366;
    --whatsapp-dark: #0b8043;
    --whatsapp-light: #dcf8c6;
    --panel-bg: #ffffff;
    --chat-bg: #ece5dd;
    --text-primary: #111b21;
    --text-secondary: #667781;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
}

body.whatsapp-style {
    margin: 0;
    padding: 0;
    background: #dadbd2;
    height: 100vh;
    height: 100dvh;  
    overflow: hidden;
}

.whatsapp-container {
    display: flex;
    height: calc(100dvh - 56px);
    max-width: 1400px;
    margin: 0 auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    position: relative;
}

.top-nav {
    background: var(--glass-nav-bg);
    backdrop-filter: var(--glass-blur);
    border-bottom: var(--glass-border);
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    height: 56px;
}

/* Desktop Navigation Sidebar */
.desktop-nav-container {
    width: 280px;
    background: linear-gradient(135deg, rgba(45, 55, 72, 0.85) 0%, rgba(26, 32, 44, 0.85) 100%);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.5);
    border-right: 1.5px solid rgba(79, 172, 254, 0.3);
}

@media (max-width: 768px) {
    .desktop-nav-container {
        display: none;
    }
}

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    padding: 20px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.sidebar-header-nav h2 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 24px;
    font-weight: 300;
    margin: 0;
}

.mobile-menu-section {
    margin-bottom: 10px;
}

.mobile-menu-section h4 {
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding: 0 16px;
}

.mobile-menu-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.mobile-menu-item:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.1);
    transform: translateX(4px);
}

.mobile-menu-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    font-weight: 600;
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.menu-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.menu-text {
    font-size: 15px;
}

.user-info-sidebar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    margin-top: auto;
    border: 1px solid rgba(255,255,255,0.1);
}

.user-avatar-sidebar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.user-info-text h4 {
    margin: 0;
    color: white;
    font-size: 15px;
    font-weight: 600;
}

.user-info-text p {
    margin: 4px 0 0 0;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
}

/* ============================================================================
   ENHANCED CONTACTS SECTION
   ============================================================================ */

.contacts-sidebar {
    width: 350px;
    background: var(--panel-bg);
    display: none;
    flex-direction: column;
    border-right: 1px solid rgba(0,0,0,0.1);
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
}

.contacts-sidebar.active {
    display: flex;
}

@media (min-width: 769px) {
    .contacts-sidebar.active {
        display: flex;
        position: relative;
        z-index: 1;
    }
    
    .mobile-overlay {
        display: none !important;
    }
}

.sidebar-header {
    background: linear-gradient(135deg, var(--whatsapp-dark) 0%, #0a6b35 100%);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sidebar-header h1 {
    margin: 0;
    color: white;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.header-icon-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

.header-icon-btn:hover {
    background: rgba(255,255,255,0.15);
}

/* Enhanced Search Container */
.search-container {
    padding: 16px;
    background: #f0f2f5;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.search-container input {
    width: 100%;
    padding: 12px 18px;
    border: none;
    border-radius: 24px;
    background: white;
    font-size: 14px;
    outline: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.search-container input:focus {
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.2);
    border: 1px solid var(--whatsapp-green);
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Enhanced Contact Item Cards */
.contact-item {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    margin: 4px 8px;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: transparent;
    border: 1px solid transparent;
    position: relative;
}

.contact-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--whatsapp-green);
    border-radius: 0 3px 3px 0;
    transition: height 0.3s ease;
}

.contact-item:hover {
    background: #f5f6f6;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.contact-item:hover::before {
    height: 60%;
}

.contact-item.active {
    background: linear-gradient(90deg, #e9edef 0%, #f0f2f5 100%);
    border-color: rgba(37, 211, 102, 0.3);
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.15);
}

.contact-item.active::before {
    height: 80%;
    background: var(--whatsapp-green);
}

.contact-avatar-wrapper {
    position: relative;
    margin-right: 16px;
}

.contact-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.contact-item:hover .contact-avatar {
    border-color: var(--whatsapp-green);
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.2);
    transform: scale(1.05);
}

.contact-status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.contact-status-indicator.online {
    background-color: #25d366;
    animation: pulse-online 2s infinite;
}

.contact-status-indicator.offline {
    background-color: #8696a0;
}

@keyframes pulse-online {
    0%, 100% {
        box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 0 rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 0 0 4px rgba(37, 211, 102, 0);
    }
}

.contact-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contact-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #111b21;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s;
}

.contact-item:hover .contact-name {
    color: var(--whatsapp-dark);
}

.contact-details {
    font-size: 13px;
    color: #667781;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Enhanced Contact Action Buttons */
.contact-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.contact-item:hover .contact-actions {
    opacity: 1;
}

.contact-action-btn {
    background: linear-gradient(135deg, #e9edef 0%, #f0f2f5 100%);
    border: 1px solid rgba(0,0,0,0.08);
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #54656f;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.contact-action-btn:hover {
    background: linear-gradient(135deg, var(--whatsapp-green) 0%, var(--whatsapp-dark) 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(37, 211, 102, 0.3);
}

.contact-action-btn:active {
    transform: translateY(0);
}

.loading-state {
    padding: 40px;
    text-align: center;
    color: #667781;
}

/* Main Content Area */
.main-content {
    flex: 1;
    background: var(--chat-bg);
    position: relative;
    display: flex;
    flex-direction: column;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.empty-state-content {
    text-align: center;
    color: #667781;
}

.empty-state-content h2 {
    font-size: 32px;
    font-weight: 300;
    margin-bottom: 12px;
    color: #3b4a54;
}

.empty-state-content p {
    font-size: 14px;
}

/* Chat View */
.chat-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, rgba(45, 55, 72, 0.85) 0%, rgba(26, 32, 44, 0.85) 100%);
    backdrop-filter: blur(20px);
    border-bottom: 1.5px solid rgba(79, 172, 254, 0.3);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

.chat-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
}

.chat-header-info {
    flex: 1;
    min-width: 0;
}

.chat-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-header-info span {
    font-size: 13px;
    opacity: 0.9;
}

.chat-header-actions {
    display: flex;
    gap: 5px;
}

.action-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* Messages Area */
.messages-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    background: var(--chat-bg);
}

.messages-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-bubble {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 15px;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-bubble.sent {
    background: var(--whatsapp-light);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.message-bubble.received {
    background: white;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.message-time {
    font-size: 11px;
    color: #667781;
    text-align: right;
    margin-top: 4px;
}

.message-input-area {
    flex-shrink: 0;
    background: var(--whatsapp-dark);
    padding: 10px 15px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(0,0,0,0.1);
    display: flex;
    align-items: flex-end;
    gap: 8px;
    min-height: 60px;
    max-height: 150px;
}

.attach-btn,
.send-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.attach-btn:hover,
.send-btn:hover {
    background: rgba(255,255,255,0.2);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-wrapper {
    flex: 1;
}

.input-wrapper input {
    width: 100%;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    background: white;
}

/* ============================================================================
   ENHANCED CALL INTERFACE
   ============================================================================ */

.active-call-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.call-view {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Call Info Header Panel */
.call-info-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
    backdrop-filter: blur(20px);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.call-info-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.call-info-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255,255,255,0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.call-info-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.call-info-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.call-info-details h3 {
    margin: 0;
    color: white;
    font-size: 20px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.call-info-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.call-type-badge {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255,255,255,0.3);
}

.call-duration {
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.call-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #42b883;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    color: rgba(255,255,255,0.8);
    font-size: 13px;
}

.call-info-actions {
    display: flex;
    gap: 8px;
}

.call-info-btn {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.call-info-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.1);
}

/* Remote Video Container */
.remote-video-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.remote-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remote-user-info {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: white;
    z-index: 10;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.2);
}

.remote-user-info h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Enhanced Local Video Container */
.local-video-container {
    position: absolute;
    bottom: 180px;
    right: 24px;
    width: 180px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid rgba(255,255,255,0.9);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 50;
    transition: all 0.3s ease;
    background: rgba(0,0,0,0.3);
}

.local-video-container:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}

.local-video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.local-video-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
    padding: 4px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.2);
}

.local-video-label {
    color: white;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Organized Call Controls */
.call-controls-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.6) 50%, rgba(0,0,0,0.8) 100%);
    backdrop-filter: blur(20px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

/* Primary Controls */
.call-controls-primary {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
}

.call-control-btn {
    min-width: 64px;
    height: 64px;
    border-radius: 32px;
    border: none;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(20px);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.2);
}

.call-control-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.4);
}

.call-control-btn:active {
    transform: translateY(-2px) scale(1.02);
}

.btn-icon {
    font-size: 24px;
    line-height: 1;
}

.btn-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* Specific Control Styles */
.call-control-mute {
    background: rgba(255,255,255,0.25);
}

.call-control-mute.active {
    background: rgba(231, 76, 60, 0.8);
    border-color: rgba(231, 76, 60, 0.5);
}

.call-control-video {
    background: rgba(255,255,255,0.25);
}

.call-control-video.active {
    background: rgba(52, 152, 219, 0.8);
    border-color: rgba(52, 152, 219, 0.5);
}

.call-control-end {
    background: #e74c3c;
    border-color: rgba(231, 76, 60, 0.5);
    min-width: 72px;
    height: 72px;
    border-radius: 36px;
}

.call-control-end:hover {
    background: #c0392b;
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 8px 24px rgba(231, 76, 60, 0.5);
}

/* Secondary Controls */
.call-controls-secondary {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
}

.call-control-secondary {
    min-width: 56px;
    height: 56px;
    border-radius: 28px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(15px);
}

.call-control-secondary:hover {
    background: rgba(255,255,255,0.25);
}

.call-control-secondary.active {
    background: rgba(37, 211, 102, 0.6);
    border-color: rgba(37, 211, 102, 0.5);
}

/* Call Chat Panel */
.call-chat-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 180px;
    width: 380px;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
    z-index: 200;
    border-left: 1px solid rgba(255,255,255,0.2);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.call-chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.5);
}

.call-chat-header h4 {
    margin: 0;
    font-size: 18px;
    color: #111b21;
    font-weight: 600;
}

.call-chat-close {
    background: rgba(0,0,0,0.05);
    border: none;
    font-size: 24px;
    color: #667781;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    line-height: 1;
    transition: all 0.2s;
}

.call-chat-close:hover {
    background: rgba(0,0,0,0.1);
    color: #111b21;
}

.call-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(236, 229, 221, 0.3);
}

.call-chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.call-chat-message.sent {
    background: var(--whatsapp-light);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.call-chat-message.received {
    background: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message-content {
    word-wrap: break-word;
    line-height: 1.5;
}

.message-time {
    font-size: 11px;
    color: #667781;
    margin-top: 6px;
    text-align: right;
}

.call-chat-message.received .message-time {
    text-align: left;
}

.call-chat-input {
    padding: 16px 20px;
    border-top: 1px solid rgba(0,0,0,0.1);
    display: flex;
    gap: 12px;
    background: rgba(255,255,255,0.8);
}

.call-chat-input input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 24px;
    background: #f0f2f5;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
}

.call-chat-input input:focus {
    border-color: var(--whatsapp-green);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.call-chat-input button {
    padding: 12px 24px;
    border: none;
    border-radius: 24px;
    background: var(--whatsapp-green);
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.call-chat-input button:hover {
    background: var(--whatsapp-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.15) 0%, rgba(0, 242, 254, 0.15) 100%);
    backdrop-filter: blur(10px);
    border: 1.5px solid rgba(79, 172, 254, 0.3);
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.2);
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

.mobile-menu-toggle:hover {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.25) 0%, rgba(0, 242, 254, 0.25) 100%);
    border-color: rgba(79, 172, 254, 0.5);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
    transform: scale(1.05);
}

.mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    background: #4facfe;
    margin: 2.5px 0;
    transition: all 0.3s ease;
    transform-origin: center;
    border-radius: 1px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
    background: #00f2fe;
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
    background: #00f2fe;
}

.mobile-close-btn {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

.mobile-overlay.active {
    display: block;
}

/* Floating Action Button (FAB) */
.fab-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    z-index: 998;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--whatsapp-green);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

.fab:active {
    transform: scale(0.95);
}

.fab-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 12px;
}

.fab-menu.active {
    display: flex;
}

.fab-item {
    background: white;
    border: none;
    padding: 12px 20px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

.fab-item:hover {
    background: #f5f5f5;
    transform: translateX(-4px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}

.mobile-menu-overlay.active {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-close-btn {
        display: block;
    }

    .desktop-nav-container {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 999;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }
    
    .desktop-nav-container.active {
        display: flex;
    }

    .contacts-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 85%;
        max-width: 350px;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }

    .whatsapp-container {
       height: calc(100dvh - 56px - env(safe-area-inset-bottom));
       position: relative;
    }

    .main-content {
        width: 100%;
    }

    .empty-state-content h2 {
        font-size: 24px;
    }

    /* Call Interface Mobile Adjustments */
    .call-info-header {
        padding: 16px;
    }

    .call-info-avatar {
        width: 48px;
        height: 48px;
    }

    .call-info-details h3 {
        font-size: 18px;
    }

    .local-video-container {
        width: 140px;
        height: 100px;
        bottom: 160px;
        right: 16px;
    }

    .call-controls-wrapper {
        padding: 16px;
        gap: 16px;
    }

    .call-controls-primary {
        gap: 12px;
    }

    .call-control-btn {
        min-width: 56px;
        height: 56px;
        border-radius: 28px;
    }

    .call-control-end {
        min-width: 64px;
        height: 64px;
        border-radius: 32px;
    }

    .call-controls-secondary {
        gap: 12px;
    }

    .call-control-secondary {
        min-width: 48px;
        height: 48px;
        border-radius: 24px;
    }

    .btn-icon {
        font-size: 20px;
    }

    .btn-label {
        font-size: 10px;
    }

    .call-chat-panel {
        width: 100%;
        max-width: 100%;
        bottom: 160px;
    }

    .chat-header {
        padding: 10px 12px;
    }

    .message-input-area {
        padding: 12px 16px;
        padding-bottom: 60px;
        position: sticky;
        bottom: 0;
        z-index: 10;
        background: #0e0e0f52;
    }

    .messages-area {
        padding-bottom: 20px;
    }

    .fab-container {
        bottom: 60px;
        right: 15px;
    }
}

/* PWA Safe Area iOS */
@supports (padding: max(0px)) {
    .message-input-area {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 768px) {
    .message-input-area {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
    
    .whatsapp-container {
        height: calc(100dvh - 56px - env(safe-area-inset-bottom));
    }
    
    body.whatsapp-container {
        height: env(safe-area-inset-bottom);
    }
}

