:root {
    --primary-color: #e63946;
    --primary-dark: #c1121f;
    --secondary-color: #457b9d;
    --accent-color: #f77f00;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --text-primary: #1d3557;
    --text-secondary: #6c757d;
    --success-color: #2a9d8f;
    --danger-color: #e63946;
    --warning-color: #f4a261;
    --border-radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    padding: 30px 0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.logo-icon {
    font-size: 2.5rem;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
}

.logo h1 .accent {
    color: var(--accent-color);
}

.tagline {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin-top: 8px;
}

.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
}

.login-card h2 {
    font-size: 1.75rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

.call-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 30px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #3a6a87;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #238b7e;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: var(--primary-dark);
}

.btn-icon {
    font-size: 1.25rem;
}

.berater-status {
    border-top: 1px solid #e2e8f0;
    padding-top: 24px;
}

.berater-status h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.berater-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.berater-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 0.9rem;
}

.berater-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.berater-dot.available {
    background: var(--success-color);
}

.berater-dot.busy {
    background: var(--danger-color);
}

.berater-dot.ringing {
    background: var(--warning-color);
    animation: pulse-dot 1s infinite;
}

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

.loading {
    color: var(--text-secondary);
    font-style: italic;
}

.hidden {
    display: none !important;
}

.queue-card {
    text-align: center;
}

.queue-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.queue-animation {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.ripple {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    animation: ripple 1.5s infinite;
}

@keyframes ripple {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.queue-icon {
    font-size: 3rem;
    z-index: 1;
}

.queue-position {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 16px 0 24px;
}

.connecting-card {
    text-align: center;
}

.connecting-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.connecting-animation {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.3;
    }
    100% {
        transform: scale(0.9);
        opacity: 0.7;
    }
}

.connecting-icon {
    font-size: 2.5rem;
    z-index: 1;
}

.call-section {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: calc(100vh - 40px);
    max-height: 700px;
    background: #1a1a2e;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.call-layout-customer {
    display: grid;
    grid-template-columns: 1fr 320px;
    height: 100%;
}

.video-area-customer {
    display: flex;
    flex-direction: column;
    background: #1a1a2e;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.video-area-customer .video-container {
    flex: 1;
    min-height: 200px;
    overflow: hidden;
}

.video-area-customer .call-info {
    flex-shrink: 0;
}

.video-area-customer .call-controls {
    flex-shrink: 0;
    display: flex !important;
    visibility: visible !important;
}

.chat-panel-customer {
    display: flex;
    flex-direction: column;
    background: var(--card-background);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    border-left: 1px solid #e2e8f0;
    overflow: hidden;
}

.chat-panel-customer .chat-header {
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0 var(--border-radius) 0 0;
    flex-shrink: 0;
}

.chat-panel-customer .chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
}

.chat-panel-customer .chat-input-container {
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .call-layout-customer {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
    
    .chat-panel-customer {
        border-radius: 0 0 var(--border-radius) var(--border-radius);
        border-left: none;
        border-top: 1px solid #e2e8f0;
        max-height: 200px;
    }
    
    .video-area-customer {
        border-radius: var(--border-radius) var(--border-radius) 0 0;
    }
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0f0f23;
}

.remote-video-wrapper {
    width: 100%;
    height: 100%;
}

.remote-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.local-video-wrapper {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 200px;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.local-video-wrapper:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.5);
}

.local-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Video swap styles */
.remote-video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    transition: all 0.3s ease;
}

.local-video-wrapper.video-large {
    position: relative;
    width: 100%;
    height: 100%;
    bottom: auto;
    right: auto;
    border-radius: var(--border-radius);
    z-index: 1;
}

.remote-video-wrapper.video-small {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 200px;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 2px solid rgba(255, 255, 255, 0.2);
    z-index: 10;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.remote-video-wrapper.video-small:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.5);
}

.remote-video-wrapper.video-small video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.audio-only-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(135deg, #2a2a4a 0%, #1a1a2e 100%);
    color: white;
}

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

.call-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

#call-timer {
    font-family: monospace;
    font-size: 1.25rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 12px;
    border-radius: 4px;
}

.call-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 16px 20px;
    background: #16162a;
    min-height: 80px;
    z-index: 10;
}

.control-btn {
    min-width: 70px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    z-index: 11;
}

.control-btn .btn-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.control-btn .btn-label {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.08);
}

.control-btn.active {
    background: #28a745;
    border-color: #28a745;
}

.control-btn.muted {
    background: #6c757d;
    border-color: #6c757d;
}

.control-btn.end-call {
    background: #dc3545;
    border-color: #dc3545;
}

.control-btn.end-call:hover {
    background: #c82333;
    border-color: #c82333;
}

/* ===== Camera Flip Button ===== */
.control-btn.flip-camera {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-color: #6366f1;
    position: relative;
    overflow: hidden;
}

.control-btn.flip-camera::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.control-btn.flip-camera:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    border-color: #4f46e5;
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.control-btn.flip-camera:hover::before {
    left: 100%;
}

.control-btn.flip-camera:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.control-btn.flip-camera .flip-camera-icon {
    width: 24px;
    height: 24px;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-btn.flip-camera:hover .flip-camera-icon {
    transform: rotateY(180deg);
}

.control-btn.flip-camera.flipping .flip-camera-icon {
    animation: flipRotate 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes flipRotate {
    0% { transform: rotateY(0deg) scale(1); }
    50% { transform: rotateY(90deg) scale(0.8); }
    100% { transform: rotateY(180deg) scale(1); }
}

/* Hide on desktop (only useful on mobile/tablet with multiple cameras) */
@media (min-width: 1025px) {
    .control-btn.flip-camera {
        display: none;
    }
}

/* Show and optimize for tablet/mobile */
@media (max-width: 1024px) {
    .control-btn.flip-camera {
        display: flex;
    }
}

.chat-panel {
    position: absolute;
    right: 0;
    top: 0;
    width: 320px;
    height: 100%;
    background: var(--card-background);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.3);
    z-index: 100;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e2e8f0;
    gap: 12px;
}

.chat-header h3 {
    font-size: 1rem;
    color: var(--text-primary);
    flex: 1;
}

/* Chat Back Button - Hidden on Desktop */
.chat-back-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.chat-back-btn:hover {
    background: #e2e8f0;
}

.chat-back-btn:active {
    transform: scale(0.9);
    background: #cbd5e1;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-message.sent {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.received {
    align-self: flex-start;
    background: #f1f5f9;
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-message .sender {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 4px;
}

.chat-message.file {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
}

.file-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--secondary-color);
    text-decoration: none;
}

.file-link:hover {
    text-decoration: underline;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid #e2e8f0;
}

.chat-input-container input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 0.9rem;
}

.chat-input-container input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.file-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f1f5f9;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    transition: background 0.2s;
}

.file-upload-btn:hover {
    background: #e2e8f0;
}

.send-btn {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
}

.send-btn:hover {
    background: var(--primary-dark);
}

.call-ended-card {
    text-align: center;
}

.call-ended-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ended-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.call-ended-content h2 {
    margin-bottom: 8px;
}

.call-ended-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Mobile-only elements - hidden on desktop */
.mobile-only {
    display: none !important;
}

/* ========== MOBILE STYLES ========== */

/* Tablet */
@media (max-width: 768px) {
    /* Show mobile-only elements on mobile */
    .mobile-only {
        display: flex !important;
    }

    .container {
        padding: 10px;
    }

    .header {
        padding: 15px 0;
    }

    .logo-icon {
        font-size: 2rem;
    }

    .logo h1 {
        font-size: 1.75rem;
    }

    .tagline {
        font-size: 0.9rem;
    }

    .card {
        padding: 24px 20px;
        margin: 0 5px;
    }

    .login-card h2 {
        font-size: 1.4rem;
    }

    .call-buttons {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .btn-large {
        padding: 14px 24px;
        font-size: 1rem;
    }

    .berater-status h3 {
        font-size: 0.9rem;
    }

    .berater-item {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    /* Call section mobile */
    .call-section {
        height: calc(100vh - 20px);
        max-height: none;
        border-radius: 8px;
    }

    .call-layout-customer {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto auto;
    }

    .video-area-customer {
        border-radius: 8px 8px 0 0;
    }

    .video-container {
        aspect-ratio: 4 / 3;
    }

    .local-video-wrapper {
        width: 100px;
        bottom: 10px;
        right: 10px;
    }

    .remote-video-wrapper.video-small {
        width: 100px;
        bottom: 10px;
        right: 10px;
    }

    .call-info {
        padding: 10px 16px;
    }

    #call-timer {
        font-size: 1rem;
        padding: 3px 8px;
    }

    .call-controls {
        gap: 8px;
        padding: 12px 8px;
        min-height: 70px;
        flex-wrap: nowrap;
        justify-content: center;
        background: linear-gradient(180deg, rgba(26, 26, 46, 0.95) 0%, rgba(15, 15, 35, 0.98) 100%);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .control-btn {
        min-width: 50px;
        max-width: 62px;
        padding: 10px 6px;
        flex: 0 1 auto;
        border-radius: 12px;
    }

    .control-btn .btn-icon {
        font-size: 1.25rem;
    }

    .control-btn .btn-label {
        font-size: 0.55rem;
        margin-top: 3px;
    }

    .control-btn.end-call {
        background: linear-gradient(135deg, #e63946, #c1121f);
    }

    /* Show flip camera button on tablet */
    .control-btn.flip-camera {
        display: flex !important;
    }

    /* Show chat back button on tablet */
    .chat-back-btn {
        display: flex !important;
    }

    .chat-panel-customer {
        border-radius: 0 0 8px 8px;
        border-left: none;
        border-top: 1px solid #e2e8f0;
        max-height: 180px;
    }

    .chat-panel-customer .chat-header {
        padding: 10px 12px;
    }

    .chat-panel-customer .chat-header h3 {
        font-size: 0.9rem;
    }

    .chat-panel-customer .chat-messages {
        padding: 8px;
    }

    .chat-panel-customer .chat-input-container {
        padding: 8px;
    }

    .chat-input-container input {
        padding: 8px 12px;
        font-size: 16px !important; /* Prevents iOS zoom on focus */
        -webkit-appearance: none;
        appearance: none;
    }

    .file-upload-btn,
    .send-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .chat-message {
        max-width: 85%;
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    /* Queue section mobile */
    .queue-card {
        padding: 30px 20px;
    }

    .queue-animation {
        width: 100px;
        height: 100px;
    }

    .queue-icon {
        font-size: 2.5rem;
    }

    .queue-position {
        font-size: 1.25rem;
    }

    /* Connecting section mobile */
    .connecting-animation {
        width: 80px;
        height: 80px;
    }

    .connecting-icon {
        font-size: 2rem;
    }

    /* Call ended section */
    .ended-icon {
        font-size: 3rem;
    }

    .footer {
        padding: 15px;
        font-size: 0.8rem;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .container {
        padding: 5px;
    }

    .header {
        padding: 10px 0;
    }

    .logo-icon {
        font-size: 1.5rem;
    }

    .logo h1 {
        font-size: 1.4rem;
    }

    .tagline {
        font-size: 0.8rem;
        padding: 0 10px;
    }

    .card {
        padding: 20px 16px;
        border-radius: 10px;
    }

    .login-card h2 {
        font-size: 1.25rem;
    }

    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .form-group {
        margin-bottom: 18px;
    }

    .form-group label {
        font-size: 0.9rem;
    }

    .form-group input {
        padding: 12px 14px;
        font-size: 1rem;
    }

    .btn-large {
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .call-section {
        border-radius: 0;
        height: 100vh;
    }

    .video-container {
        aspect-ratio: 1 / 1;
    }

    .local-video-wrapper {
        width: 80px;
        bottom: 8px;
        right: 8px;
    }

    .remote-video-wrapper.video-small {
        width: 80px;
        bottom: 8px;
        right: 8px;
    }

    .call-controls {
        gap: 8px;
        padding: 10px 8px;
        min-height: 65px;
    }

    .control-btn {
        min-width: 55px;
        padding: 8px 10px;
    }

    .control-btn .btn-icon {
        font-size: 1.1rem;
    }

    .control-btn .btn-label {
        font-size: 0.55rem;
    }

    /* Show flip camera and back button on phones */
    .control-btn.flip-camera {
        display: flex !important;
        min-width: 50px;
    }

    .chat-back-btn {
        display: flex !important;
        width: 36px;
        height: 36px;
    }

    .chat-panel-customer {
        max-height: 150px;
    }

    .chat-panel-customer .chat-header h3 {
        font-size: 0.85rem;
    }

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

/* ===== iPhone / iOS Specific Fixes ===== */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari only */
    .chat-panel-customer {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .chat-panel-customer .chat-input-container {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        position: relative;
        z-index: 10;
    }

    .call-controls {
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    /* Ensure inputs don't zoom on iOS */
    input, textarea, select {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100%;
    }
    
    /* Fix for iOS keyboard pushing content */
    .call-section {
        position: relative;
    }
}

/* Mobile Chat Panel - Full Height Option */
@media (max-width: 480px) {
    .chat-panel-customer {
        max-height: none !important;
        min-height: 200px;
        flex: 1;
        display: flex !important;
        flex-direction: column;
    }
    
    .chat-panel-customer .chat-messages {
        flex: 1;
        min-height: 80px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .chat-panel-customer .chat-input-container {
        display: flex !important;
        flex-shrink: 0;
        padding: 10px 12px;
        background: white;
        border-top: 1px solid #e2e8f0;
        gap: 8px;
        min-height: 60px;
        align-items: center;
    }
    
    .chat-panel-customer .chat-input-container input {
        flex: 1;
        min-width: 0;
        height: 40px;
        padding: 10px 14px;
        border-radius: 20px;
        border: 1px solid #e2e8f0;
        font-size: 16px !important;
    }
    
    .chat-panel-customer .file-upload-btn,
    .chat-panel-customer .send-btn {
        flex-shrink: 0;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
}

/* Landscape phone */
@media (max-height: 500px) and (orientation: landscape) {
    .call-section {
        height: 100vh;
    }

    .call-layout-customer {
        grid-template-columns: 1fr 200px;
        grid-template-rows: 1fr;
    }

    .video-area-customer {
        border-radius: 8px 0 0 8px;
    }

    .chat-panel-customer {
        border-radius: 0 8px 8px 0;
        max-height: none;
        border-left: 1px solid #e2e8f0;
        border-top: none;
    }

    .video-container {
        aspect-ratio: 16 / 9;
    }

    .call-controls {
        padding: 8px;
        gap: 10px;
        min-height: 60px;
    }

    .control-btn {
        min-width: 50px;
        padding: 6px 8px;
    }

    .control-btn .btn-label {
        display: none;
    }

    .local-video-wrapper {
        width: 80px;
        bottom: 5px;
        right: 5px;
    }
}
