* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #fffc00 0%, #ffeb3b 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
    overflow: hidden;
    position: fixed;
    width: 100vw;
    height: 100vh;
}

.chat-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: white;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.chat-header {
    background: linear-gradient(135deg, #fffc00, #ffeb3b);
    padding: 3vh 4vw;
    color: #333;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    border-bottom: 2px solid #fffc00;
    min-height: 60px;
    display: flex;
    align-items: center;
    gap: 3vw;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    pointer-events: none;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 3vw;
    position: relative;
    z-index: 1;
}

.profile-image {
    width: 16vw;
    height: 16vw;
    max-width: 70px;
    max-height: 70px;
    min-width: 60px;
    min-height: 60px;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: none;
    flex-shrink: 0;
    object-fit: cover;
    object-position: center;
    background: none;
    outline: none;
}

.profile-details h3 {
    font-size: clamp(18px, 5vw, 22px);
    margin-bottom: 1vh;
    line-height: 1.2;
    font-weight: 700;
    color: #333;
}

.status {
    font-size: clamp(12px, 3.5vw, 14px);
    opacity: 0.9;
    line-height: 1.2;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 1vw;
}

.status::before {
    content: '';
    width: 2vw;
    height: 2vw;
    max-width: 8px;
    max-height: 8px;
    min-width: 6px;
    min-height: 6px;
    background: #4caf50;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.chat-messages {
    flex: 1;
    padding: 2vh 3vw;
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100vw;
    display: block;
    position: relative;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

.message {
    margin-bottom: 3vh;
    display: block;
    position: relative;
    z-index: 1;
    clear: both;
    width: 100%;
    float: none;
    overflow: hidden;
    min-height: 50px;
    padding: 0;
    margin-left: 0;
    margin-right: 0;
}

.user-message {
    text-align: right;
}

.sarah-message {
    text-align: left;
}

.message-content {
    max-width: 80%;
    background: white;
    padding: 2.5vh 4vw;
    border-radius: 4vw;
    box-shadow: 0 0.5vh 3vh rgba(0, 0, 0, 0.08);
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    z-index: 2;
    display: inline-block;
    clear: both;
    margin: 0;
}

.message-content:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.user-message .message-content {
    background: linear-gradient(135deg, #fffc00, #ffeb3b);
    color: #333;
    border: 2px solid #fffc00;
    box-shadow: 0 2px 8px rgba(255, 252, 0, 0.3);
}

.message-text {
    font-size: clamp(12px, 3.5vw, 14px);
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.message-time {
    font-size: clamp(9px, 2.5vw, 11px);
    opacity: 0.6;
    margin-top: 1vh;
    line-height: 1.2;
    display: block;
    clear: both;
    width: 100%;
    text-align: right;
}

.chat-image {
    max-width: 50vw;
    max-width: min(50vw, 200px);
    width: 100%;
    height: auto;
    border-radius: 3vw;
    cursor: pointer;
    transition: transform 0.2s;
    object-fit: cover;
}

.chat-image:hover {
    transform: scale(1.05);
}

.chat-input-container {
    padding: 2vh 3vw;
    background: white;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

.input-wrapper {
    display: flex;
    gap: 2.5vw;
    align-items: center;
    width: 100%;
}

#messageInput {
    flex: 1;
    padding: 2.5vh 4vw;
    border: 2px solid #e9ecef;
    border-radius: 6vw;
    outline: none;
    font-size: clamp(12px, 3.5vw, 14px);
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    min-height: 44px; /* iOS touch target minimum */
    -webkit-appearance: none;
    appearance: none;
}

#messageInput:focus {
    border-color: #fffc00;
    box-shadow: 0 0 0 3px rgba(255, 252, 0, 0.2);
    background: white;
}

#sendButton {
    background: linear-gradient(135deg, #fffc00, #ffeb3b);
    color: #333;
    border: 2px solid #fffc00;
    padding: 2.5vh 5vw;
    border-radius: 6vw;
    cursor: pointer;
    font-size: clamp(12px, 3.5vw, 14px);
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 0.5vh 2vh rgba(255, 252, 0, 0.3);
    backdrop-filter: blur(10px);
    min-height: 44px; /* iOS touch target minimum */
    min-width: 60px;
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
}

#sendButton:hover {
    background: linear-gradient(135deg, #ffeb3b, #ffc107);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 252, 0, 0.5);
}

/* Remove disabled state - button should always be clickable */

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    margin: 5vh auto;
    width: 90vw;
    max-width: 500px;
    text-align: center;
}

.modal-content img {
    width: 100%;
    height: auto;
    border-radius: 3vw;
    max-height: 80vh;
    object-fit: contain;
}

.close {
    position: absolute;
    top: -8vh;
    right: 0;
    color: white;
    font-size: clamp(24px, 8vw, 30px);
    font-weight: bold;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    opacity: 0.7;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 1.5vw;
    padding: 2.5vh 4vw;
    background: white;
    border-radius: 4vw;
    box-shadow: 0 0.5vh 2vh rgba(0, 0, 0, 0.1);
    max-width: 20vw;
    border: 1px solid rgba(255, 252, 0, 0.2);
    position: relative;
    z-index: 3;
    clear: both;
    margin-bottom: 3vh;
}

.typing-dot {
    width: 2.5vw;
    height: 2.5vw;
    max-width: 10px;
    max-height: 10px;
    min-width: 8px;
    min-height: 8px;
    background: linear-gradient(135deg, #fffc00, #ffeb3b);
    border-radius: 50%;
    animation: typing 1.6s infinite ease-in-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-3vh) scale(1.2);
        opacity: 1;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .chat-container {
        height: 100vh;
        height: 100dvh;
    }
    
    body {
        height: 100vh;
        height: 100dvh;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Prevent horizontal scrolling */
* {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Responsive breakpoints */
@media (max-width: 480px) {
    .chat-container {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        max-width: 100vw;
    }
    
    body {
        padding: 0;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .chat-container {
        height: 95vh;
        height: 95dvh;
    }
    
    .chat-header {
        padding: 2vh 5vw;
    }
    
    .chat-messages {
        padding: 2vh 5vw;
    }
    
    .chat-input-container {
        padding: 2vh 5vw;
    }
}
