/* ============================================
   PRIVATE CHAT - MOBILE FRIENDLY DARK UI
   Complete CSS - Mobile First Design
   ============================================ */

/* ========== GLOBAL RESET ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000;
    color: #e0e0e0;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

/* ========== MAIN CHAT CONTAINER ========== */
.chat-container {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #121212;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Desktop - centered with max-width */
@media (min-width: 769px) {
    body {
        background: #0a0a0a;
    }
    .chat-container {
        max-width: 850px;
        max-height: 95vh;
        border-radius: 16px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px #1e1e1e;
    }
}

/* ========== HEADER ========== */
.chat-header {
    background: #1a1a1a;
    padding: 10px 12px;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 8px;
    min-height: 52px;
}

@media (min-width: 769px) {
    .chat-header {
        padding: 12px 18px;
        min-height: auto;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

@media (min-width: 769px) {
    .header-left {
        gap: 12px;
    }
}

.back-btn {
    background: #2a2a2a;
    color: #00ff00;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.back-btn:active {
    background: #333;
    transform: scale(0.95);
}

@media (min-width: 769px) {
    .back-btn {
        padding: 7px 14px;
        font-size: 13px;
        border-radius: 8px;
    }
    .back-btn:hover {
        background: #333;
        transform: translateX(-2px);
    }
}

.header-info {
    min-width: 0;
}

.header-info h2 {
    font-size: 14px;
    color: #fff;
    margin-bottom: 1px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 769px) {
    .header-info h2 {
        font-size: 18px;
        margin-bottom: 2px;
    }
}

.header-subtitle {
    color: #888;
    font-size: 11px;
}

.online-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #888;
}

@media (min-width: 769px) {
    .online-status {
        gap: 6px;
        font-size: 12px;
    }
}

.online-dot {
    width: 7px;
    height: 7px;
    background: #555;
    border-radius: 50%;
    transition: background 0.3s;
}

@media (min-width: 769px) {
    .online-dot {
        width: 8px;
        height: 8px;
    }
}

/* ========== DESKTOP/MOBILE VISIBILITY ========== */
.desktop-only {
    display: none;
}

.mobile-only {
    display: flex;
}

@media (min-width: 769px) {
    .desktop-only {
        display: flex;
    }
    .mobile-only {
        display: none;
    }
}

/* ========== HEADER ACTIONS ========== */
.header-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

@media (min-width: 769px) {
    .header-actions {
        gap: 6px;
    }
}

.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #2a2a2a;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:active {
    background: #333;
    transform: scale(0.9);
}

@media (min-width: 769px) {
    .icon-btn {
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
    .icon-btn:hover {
        background: #333;
        color: #00ff00;
        transform: scale(1.1);
    }
}

.icon-btn.active {
    background: #00ff00;
    color: #000;
}

.more-btn {
    font-size: 18px;
    font-weight: bold;
}

/* ========== MOBILE DROPDOWN MENU ========== */
.mobile-menu {
    position: absolute;
    top: 52px;
    right: 8px;
    background: #1e1e1e;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 6px 0;
    z-index: 100;
    min-width: 170px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    animation: fadeIn 0.2s ease;
}

.mobile-menu div {
    padding: 12px 18px;
    cursor: pointer;
    font-size: 13px;
    color: #ccc;
    transition: all 0.15s;
    white-space: nowrap;
}

.mobile-menu div:active {
    background: #2a2a2a;
    color: #00ff00;
}

/* ========== SEARCH BAR ========== */
.search-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
    animation: slideDown 0.25s ease;
}

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

.search-bar input {
    flex: 1;
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-radius: 18px;
    padding: 7px 14px;
    color: #e0e0e0;
    font-size: 13px;
    outline: none;
}

.search-bar input:focus {
    border-color: #00ff00;
}

.search-bar button {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

#searchCount {
    color: #888;
    font-size: 11px;
    white-space: nowrap;
}

/* ========== PINNED MESSAGE ========== */
.pinned-message {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: #1a2a1a;
    border-bottom: 1px solid #2a3a2a;
    font-size: 11px;
    color: #00ff00;
    animation: slideDown 0.25s ease;
}

.pinned-message span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pinned-message button {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
}

/* ========== LOGIN SCREEN ========== */
.login-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 16px;
    gap: 16px;
}

@media (min-width: 769px) {
    .login-box {
        padding: 50px 40px;
        gap: 22px;
    }
}

.login-title {
    color: #00ff00;
    font-size: 20px;
    text-align: center;
}

@media (min-width: 769px) {
    .login-title {
        font-size: 22px;
    }
}

.login-desc {
    color: #888;
    text-align: center;
    font-size: 13px;
}

@media (min-width: 769px) {
    .login-desc {
        font-size: 14px;
    }
}

.input-group {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.input-group label {
    color: #aaa;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (min-width: 769px) {
    .input-group label {
        font-size: 13px;
    }
}

.input-group input {
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 13px 15px;
    color: #e0e0e0;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

@media (min-width: 769px) {
    .input-group input {
        border-radius: 12px;
        padding: 15px 18px;
        font-size: 15px;
    }
}

.input-group input:focus {
    border-color: #00ff00;
    box-shadow: 0 0 0 3px rgba(0, 255, 0, 0.08);
    background: #0f0f0f;
}

.input-group input::placeholder {
    color: #444;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 34px;
    cursor: pointer;
    font-size: 16px;
    color: #888;
    user-select: none;
    z-index: 2;
}

@media (min-width: 769px) {
    .toggle-password {
        right: 14px;
        top: 38px;
        font-size: 18px;
    }
}

.join-btn {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(135deg, #00c853, #00e676);
    color: #000;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 5px;
    letter-spacing: 0.5px;
}

.join-btn:active {
    transform: scale(0.98);
}

@media (min-width: 769px) {
    .join-btn {
        padding: 16px;
        border-radius: 12px;
        font-size: 16px;
    }
    .join-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(0, 255, 0, 0.3);
    }
}

.join-btn:disabled {
    background: #2a2a2a;
    color: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#errorMsg {
    color: #ff4444;
    font-size: 12px;
    display: none;
    text-align: center;
    padding: 8px 12px;
    background: rgba(255, 68, 68, 0.1);
    border-radius: 8px;
    max-width: 420px;
    width: 100%;
}

.back-link {
    color: #666;
    text-decoration: none;
    font-size: 12px;
    text-align: center;
}

.back-link:active {
    color: #00ff00;
}

/* ========== MESSAGES AREA ========== */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    scroll-behavior: smooth;
    background: #0d0d0d;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 769px) {
    .messages-area {
        padding: 20px 18px;
        gap: 6px;
    }
}

.messages-area::-webkit-scrollbar {
    width: 4px;
}

.messages-area::-webkit-scrollbar-track {
    background: transparent;
}

.messages-area::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 4px;
}

.empty-chat {
    text-align: center;
    color: #555;
    padding: 30px 15px;
    font-size: 13px;
}

/* ========== SCROLL TO BOTTOM ========== */
.scroll-bottom-btn {
    position: absolute;
    bottom: 75px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #00ff00;
    color: #000;
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 255, 0, 0.4);
    animation: bounce 1.5s infinite;
}

@media (min-width: 769px) {
    .scroll-bottom-btn {
        width: 38px;
        height: 38px;
        bottom: 80px;
        right: 20px;
        font-size: 18px;
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* ========== MESSAGE BUBBLES ========== */
.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    animation: messageSlide 0.25s ease;
    position: relative;
    cursor: pointer;
}

@media (min-width: 769px) {
    .message-wrapper {
        max-width: 72%;
    }
}

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

.message-wrapper.sent {
    align-self: flex-end;
    align-items: flex-end;
}

.message-wrapper.received {
    align-self: flex-start;
    align-items: flex-start;
}

.message-wrapper.deleted {
    opacity: 0.4;
    font-style: italic;
}

.message-wrapper.pinned {
    border-left: 3px solid #ffd700;
    padding-left: 6px;
}

.sender-name {
    font-size: 10px;
    color: #888;
    margin-bottom: 2px;
    padding: 0 5px;
    font-weight: 600;
}

@media (min-width: 769px) {
    .sender-name {
        font-size: 11px;
        margin-bottom: 3px;
    }
}

.message-bubble {
    padding: 9px 12px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.45;
    word-wrap: break-word;
    word-break: break-word;
}

@media (min-width: 769px) {
    .message-bubble {
        padding: 10px 15px;
        border-radius: 18px;
        font-size: 14px;
    }
}

.message-wrapper.sent .message-bubble {
    background: linear-gradient(135deg, #00c853, #00e676);
    color: #000;
    border-bottom-right-radius: 4px;
}

.message-wrapper.received .message-bubble {
    background: #1e1e1e;
    color: #e0e0e0;
    border: 1px solid #2a2a2a;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 9px;
    color: #555;
    padding: 0 5px;
    margin-top: 2px;
    font-weight: 500;
}

@media (min-width: 769px) {
    .message-time {
        font-size: 10px;
        margin-top: 3px;
    }
}

.message-wrapper.sent .message-time {
    color: rgba(0, 0, 0, 0.5);
}

/* ========== MESSAGE CONTENT ========== */
.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

@media (min-width: 769px) {
    .message-content {
        gap: 6px;
    }
}

.message-image,
.message-video {
    max-width: 180px;
    max-height: 200px;
    border-radius: 10px;
    cursor: pointer;
    transition: opacity 0.2s;
    object-fit: cover;
}

.message-image:active,
.message-video:active {
    opacity: 0.8;
}

@media (min-width: 769px) {
    .message-image,
    .message-video {
        max-width: 240px;
        max-height: 280px;
        border-radius: 12px;
    }
    .message-image:hover,
    .message-video:hover {
        transform: scale(1.02);
        opacity: 0.9;
    }
}

.message-wrapper.sent .message-image,
.message-wrapper.sent .message-video {
    border: 2px solid rgba(0, 0, 0, 0.2);
}

.message-wrapper.received .message-image,
.message-wrapper.received .message-video {
    border: 2px solid #2a2a2a;
}

.message-audio {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #1a1a1a;
    border-radius: 16px;
    min-width: 150px;
}

.message-audio audio {
    width: 100%;
    height: 32px;
    filter: invert(0.8);
}

@media (min-width: 769px) {
    .message-audio {
        min-width: 180px;
    }
}

/* ========== MEDIA PREVIEW SEND ========== */
.media-preview-send {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    flex-wrap: wrap;
}

.media-preview-send img,
.media-preview-send video {
    width: 55px;
    height: 55px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid #00ff00;
}

@media (min-width: 769px) {
    .media-preview-send img,
    .media-preview-send video {
        width: 80px;
        height: 80px;
        border-radius: 12px;
    }
}

.media-preview-send audio {
    height: 30px;
}

.remove-preview {
    background: #ff4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-preview:active {
    background: #ff0000;
    transform: scale(1.1);
}

/* ========== TYPING INDICATOR ========== */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 4px 20px;
    font-size: 11px;
    color: #888;
    font-style: italic;
}

.typing-indicator.active {
    display: flex;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 5px;
    height: 5px;
    background: #888;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* ========== INPUT AREA ========== */
.input-area {
    padding: 8px 10px;
    background: #1a1a1a;
    border-top: 1px solid #2a2a2a;
    flex-shrink: 0;
}

@media (min-width: 769px) {
    .input-area {
        padding: 12px 16px;
    }
}

.input-wrapper {
    display: flex;
    gap: 5px;
    align-items: center;
}

@media (min-width: 769px) {
    .input-wrapper {
        gap: 8px;
    }
}

#messageInput {
    flex: 1;
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-radius: 20px;
    padding: 10px 14px;
    color: #e0e0e0;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
    min-width: 0;
}

@media (min-width: 769px) {
    #messageInput {
        border-radius: 25px;
        padding: 12px 18px;
        font-size: 14px;
    }
}

#messageInput:focus {
    border-color: #00ff00;
}

#messageInput::placeholder {
    color: #444;
}

#messageInput:disabled {
    opacity: 0.5;
}

.attach-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2a2a2a;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.attach-btn:active {
    background: #333;
    transform: scale(0.9);
}

@media (min-width: 769px) {
    .attach-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    .attach-btn:hover {
        background: #333;
        color: #00ff00;
    }
}

.attach-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Hide mic on small screens */
@media (max-width: 380px) {
    .mobile-hide {
        display: none;
    }
}

#sendBtn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #00ff00;
    border: none;
    color: #000;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#sendBtn:active {
    transform: scale(0.9);
}

@media (min-width: 769px) {
    #sendBtn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    #sendBtn:hover {
        background: #00e676;
        transform: scale(1.08);
        box-shadow: 0 5px 20px rgba(0, 255, 0, 0.35);
    }
}

#sendBtn:disabled {
    background: #2a2a2a;
    color: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ========== RECORDING TIMER ========== */
.recording-timer {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #1a0000;
    border-top: 1px solid #ff000033;
    font-size: 11px;
    color: #ff4444;
    animation: slideDown 0.2s ease;
}

.recording-dot {
    width: 8px;
    height: 8px;
    background: #ff0000;
    border-radius: 50%;
    animation: pulse 1s infinite;
}

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

.stop-rec-btn {
    background: #ff4444;
    color: #fff;
    border: none;
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

/* ========== EMOJI PICKER ========== */
.emoji-picker {
    position: absolute;
    bottom: 60px;
    left: 5px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 14px;
    padding: 8px;
    display: none;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    max-width: 95vw;
    width: 280px;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.15s ease;
    cursor: pointer;
    user-select: none;
}

@media (min-width: 769px) {
    .emoji-picker {
        bottom: 70px;
        left: 20px;
        grid-template-columns: repeat(10, 1fr);
        gap: 4px;
        max-width: 350px;
        padding: 12px;
        border-radius: 16px;
    }
}

.emoji-picker span {
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    text-align: center;
    border-radius: 6px;
    transition: all 0.15s;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-picker span:active {
    background: #2a2a2a;
    transform: scale(1.2);
}

@media (min-width: 769px) {
    .emoji-picker span {
        font-size: 24px;
        padding: 6px;
        border-radius: 8px;
    }
    .emoji-picker span:hover {
        background: #2a2a2a;
        transform: scale(1.4);
    }
}

/* ========== CONTEXT MENU ========== */
.context-menu {
    position: fixed;
    background: #1e1e1e;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    padding: 4px 0;
    z-index: 200;
    min-width: 140px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.12s ease;
}

.context-menu div {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 12px;
    color: #ccc;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.context-menu div:active {
    background: #2a2a2a;
    color: #00ff00;
}

@media (min-width: 769px) {
    .context-menu {
        min-width: 160px;
    }
    .context-menu div {
        font-size: 13px;
        padding: 10px 18px;
    }
    .context-menu div:hover {
        background: #2a2a2a;
        color: #00ff00;
    }
}

/* ========== MEDIA PREVIEW MODAL ========== */
.media-preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    flex-direction: column;
    gap: 12px;
}

.media-preview-modal.active {
    display: flex;
}

.media-preview-modal img,
.media-preview-modal video {
    max-width: 95%;
    max-height: 75%;
    object-fit: contain;
    border-radius: 6px;
    animation: zoomIn 0.25s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.6); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close-preview {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    z-index: 10000;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.close-preview:active {
    background: rgba(255,0,0,0.3);
}

.download-media-btn {
    background: #00ff00;
    color: #000;
    padding: 10px 22px;
    border-radius: 22px;
    text-decoration: none;
    font-weight: bold;
    font-size: 13px;
    z-index: 10000;
}

.download-media-btn:active {
    background: #00e676;
    transform: scale(0.95);
}

/* ========== SYSTEM MESSAGE ========== */
.system-message {
    text-align: center;
    padding: 5px 0;
    color: #555;
    font-size: 10px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== SHAKE ========== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.35s ease;
}

/* ========== UPLOADING SPINNER ========== */
.uploading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #2a2a2a;
    border-top: 2px solid #00ff00;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== HIGHLIGHT SEARCH ========== */
.highlight {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 2px;
    padding: 0 1px;
}

/* ========== CAMERA MODAL ========== */
#cameraModal button {
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

#cameraModal button:active {
    transform: scale(0.95);
}

#cameraModal button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (min-width: 769px) {
    #cameraModal button:hover {
        transform: scale(1.05);
        box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    }
}

/* ========== SELECTION ========== */
::selection {
    background: #00ff00;
    color: #000;
}

/* ========== SAFE AREA (iPhone notch) ========== */
@supports (padding: env(safe-area-inset-bottom)) {
    .input-area {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }
    .chat-header {
        padding-top: calc(10px + env(safe-area-inset-top));
    }
}

/* ========== ERROR MESSAGE LINK ========== */
#errorMsg a {
    transition: all 0.3s ease;
}

#errorMsg a:hover {
    background: #00ff00 !important;
    color: #000 !important;
    box-shadow: 0 4px 15px rgba(0, 255, 0, 0.3);
    transform: translateY(-1px);
}

/* ============================================
   📞 CALL SYSTEM - COMPLETE CSS
   Add this at the VERY END of chat.css
   ============================================ */

/* ========== ACTIVE CALL MODAL ========== */
.call-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: #000;
    z-index: 9999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Remote Video (Full Screen Background) */
.remote-video-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#remoteVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #111;
}

/* Local Video (Small Corner PIP) */
.local-video-container {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 120px;
    height: 170px;
    border-radius: 16px;
    overflow: hidden;
    border: 3px solid #00ff00;
    z-index: 10;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    background: #1a1a1a;
    transition: all 0.3s ease;
}

#localVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Call Info Bar (Top Center) */
.call-info {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 25px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.call-info h3 {
    color: #fff;
    font-size: 16px;
    margin-bottom: 2px;
    font-weight: 600;
}

#callTimer {
    color: #aaa;
    font-size: 13px;
    font-weight: 500;
}

/* Call Controls (Bottom Bar) */
.call-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 15px 25px;
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: wrap;
    justify-content: center;
}

.call-controls button {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: #333;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-controls button:hover {
    transform: scale(1.1);
}

.call-controls button:active {
    transform: scale(0.9);
}

/* Switch Camera Button */
#switchCameraBtn {
    background: #2a2a2a;
    font-size: 20px;
}

#switchCameraBtn:hover {
    background: #00ff00;
    color: #000;
}

/* End Call Button */
.end-call-btn {
    background: #ff4444 !important;
    font-size: 20px !important;
}

.end-call-btn:hover {
    background: #ff0000 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 5px 25px rgba(255, 0, 0, 0.5) !important;
}

/* ========== INCOMING CALL MODAL ========== */
.incoming-call-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.incoming-content {
    background: #1a1a1a;
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    border: 2px solid #00ff00;
    min-width: 300px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.incoming-icon {
    font-size: 60px;
    margin-bottom: 15px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.incoming-content h3 {
    color: #00ff00;
    font-size: 22px;
    margin-bottom: 10px;
}

.incoming-content p {
    color: #ccc;
    font-size: 16px;
    margin-bottom: 25px;
}

.incoming-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.incoming-buttons button {
    padding: 15px 35px;
    border-radius: 30px;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.incoming-buttons button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.incoming-buttons button:active {
    transform: translateY(0) scale(0.95);
}

.accept-btn {
    background: #00ff00;
    color: #000;
}

.accept-btn:hover {
    background: #00e676;
    box-shadow: 0 8px 25px rgba(0, 255, 0, 0.4) !important;
}

.reject-btn {
    background: #ff4444;
    color: #fff;
}

.reject-btn:hover {
    background: #ff0000;
    box-shadow: 0 8px 25px rgba(255, 0, 0, 0.4) !important;
}

/* ========== CALL BUTTONS IN HEADER ========== */
.icon-btn[title="Audio Call"],
.icon-btn[title="Video Call"] {
    font-size: 16px;
}

.icon-btn[title="Audio Call"]:hover,
.icon-btn[title="Video Call"]:hover {
    background: #00ff00;
    color: #000;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 768px) {
    .local-video-container {
        width: 80px;
        height: 120px;
        top: 15px;
        right: 15px;
        border-radius: 12px;
        border-width: 2px;
    }

    .call-info {
        top: 15px;
        padding: 8px 20px;
    }

    .call-info h3 {
        font-size: 14px;
    }

    #callTimer {
        font-size: 11px;
    }

    .call-controls {
        bottom: 30px;
        gap: 10px;
        padding: 12px 20px;
        border-radius: 35px;
    }

    .call-controls button {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .incoming-content {
        padding: 30px 20px;
        min-width: 260px;
    }

    .incoming-icon {
        font-size: 50px;
    }

    .incoming-content h3 {
        font-size: 18px;
    }

    .incoming-content p {
        font-size: 14px;
    }

    .incoming-buttons button {
        padding: 12px 25px;
        font-size: 14px;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .local-video-container {
        width: 65px;
        height: 100px;
        top: 10px;
        right: 10px;
    }

    .call-controls {
        bottom: 25px;
        gap: 8px;
        padding: 10px 15px;
    }

    .call-controls button {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .call-info {
        top: 10px;
        padding: 6px 15px;
    }

    .call-info h3 {
        font-size: 13px;
    }

    .incoming-content {
        padding: 25px 15px;
        min-width: 240px;
    }

    .incoming-buttons {
        gap: 12px;
    }

    .incoming-buttons button {
        padding: 12px 20px;
        font-size: 13px;
        min-width: 90px;
    }
}

/* ========== LANDSCAPE MODE ========== */
@media (max-width: 900px) and (orientation: landscape) {
    .local-video-container {
        width: 70px;
        height: 100px;
    }

    .call-controls {
        bottom: 15px;
    }

    .call-controls button {
        width: 38px;
        height: 38px;
    }
}

/* ========== SAFE AREA (iPhone Notch) ========== */
@supports (padding: env(safe-area-inset-top)) {
    .call-modal {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .call-info {
        top: calc(15px + env(safe-area-inset-top));
    }

    .call-controls {
        bottom: calc(25px + env(safe-area-inset-bottom));
    }
}

/* ========== CALL MODAL ACTIVE ANIMATION ========== */
.call-modal[style*="display: flex"] {
    animation: fadeIn 0.3s ease;
}

.incoming-call-modal[style*="display: flex"] {
    animation: fadeIn 0.3s ease;
}

/* ============================================
   🔒 CLEAR CHAT PASSWORD MODAL CSS
   Add this at the VERY END of chat.css
   ============================================ */

/* ========== CLEAR CHAT PASSWORD MODAL ========== */
.clear-chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.clear-chat-content {
    background: #1a1a1a;
    padding: 30px 25px;
    border-radius: 16px;
    text-align: center;
    border: 2px solid #00ff00;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: slideUp 0.4s ease;
}

.clear-chat-content h3 {
    color: #00ff00;
    font-size: 18px;
    margin-bottom: 8px;
}

.clear-chat-content .input-group {
    width: 100%;
    margin-bottom: 5px;
}

.clear-chat-content .input-group input {
    width: 100%;
    padding: 14px;
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
}

.clear-chat-content .input-group input:focus {
    border-color: #00ff00;
    box-shadow: 0 0 0 3px rgba(0, 255, 0, 0.08);
}

.clear-chat-content .input-group input::placeholder {
    color: #444;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 480px) {
    .clear-chat-content {
        padding: 25px 15px;
        border-radius: 12px;
    }

    .clear-chat-content h3 {
        font-size: 16px;
    }

    .clear-chat-content .input-group input {
        padding: 12px;
        font-size: 14px;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Show animation when modal opens */
.clear-chat-modal[style*="display: flex"] {
    animation: fadeIn 0.3s ease;
}