/* Modern Dark Chat UI - Black & White Theme */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', 'Inter', Roboto, sans-serif;
    background: #000000;
    height: 100vh;
    overflow: hidden;
}

/* FULL SCREEN WRAPPER - Perfect Mobile Fit */
.chat-box {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    position: relative;
}

/* DECORATIVE BACKGROUND PATTERN - Subtle Noise */
.chat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.02) 0%, transparent 50%),
        repeating-linear-gradient(45deg, rgba(255,255,255,0.005) 0px, rgba(255,255,255,0.005) 2px, transparent 2px, transparent 8px);
    pointer-events: none;
    z-index: 0;
}

/* HEADER - Premium Dark Glass Effect */
.header {
    background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
    color: #ffffff;
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2;
    letter-spacing: -0.2px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.header::before {
    content: '⚡';
    font-size: 22px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Status Badge in Header */
.header::after {
    content: '● Online';
    font-size: 11px;
    font-weight: normal;
    margin-left: auto;
    background: rgba(255,255,255,0.12);
    padding: 4px 12px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    color: #a0a0a0;
}

/* CHAT AREA - Smooth Scrolling */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1;
    scroll-behavior: smooth;
}

/* Custom Scrollbar - Dark Theme */
.messages::-webkit-scrollbar {
    width: 4px;
}

.messages::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 10px;
}

.messages::-webkit-scrollbar-thumb {
    background: #444444;
    border-radius: 10px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: #666666;
}

/* MESSAGE BUBBLES - Modern Dark Design */
.message {
    padding: 12px 16px;
    border-radius: 20px;
    max-width: 85%;
    width: fit-content;
    font-size: 15px;
    line-height: 1.45;
    word-break: break-word;
    position: relative;
    animation: fadeInUp 0.25s ease-out;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* USER MESSAGE - Right Side (Black/Dark Grey) */
.user {
    background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
    margin-left: auto;
    border-bottom-right-radius: 4px;
    color: #f0f0f0;
    border: 0.5px solid rgba(255,255,255,0.05);
}

/* Admin Message - Left Side (White/Light) */
.admin {
    background: #ffffff;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    color: #111111;
    border: 0.5px solid rgba(0,0,0,0.03);
}

/* Message Time Indicator */
.message-time {
    font-size: 10px;
    opacity: 0.5;
    display: block;
    margin-top: 4px;
    letter-spacing: 0.2px;
}

.user .message-time {
    text-align: right;
    color: #aaaaaa;
}

.admin .message-time {
    text-align: left;
    color: #888888;
}

/* Fallback for older browsers - using pseudo-element */
.message[data-time]::after {
    content: attr(data-time);
    font-size: 10px;
    opacity: 0.5;
    display: block;
    margin-top: 4px;
}

.user[data-time]::after {
    text-align: right;
}

.admin[data-time]::after {
    text-align: left;
}

/* INPUT BOX - Fixed Bottom with Dark Style */
.send-box {
    display: flex;
    padding: 12px 16px;
    background: #0d0d0d;
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
    gap: 12px;
    z-index: 2;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
}

.send-box input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #2a2a2a;
    border-radius: 28px;
    outline: none;
    font-size: 15px;
    background: #1a1a1a;
    transition: all 0.2s ease;
    font-family: inherit;
    color: #ffffff;
}

.send-box input::placeholder {
    color: #666666;
}

.send-box input:focus {
    border-color: #555555;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.05);
    background: #222222;
}

.send-box button {
    margin-left: 0;
    padding: 0 24px;
    border: none;
    background: linear-gradient(145deg, #333333, #1a1a1a);
    color: white;
    border-radius: 32px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    font-family: inherit;
    letter-spacing: 0.3px;
    border: 0.5px solid rgba(255,255,255,0.08);
}

.send-box button:hover {
    background: linear-gradient(145deg, #3a3a3a, #222222);
}

.send-box button:active {
    transform: scale(0.96);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* RESPONSIVE: Ensure Full Screen on Mobile */
@media (max-width: 768px) {
    .message {
        max-width: 88%;
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .header {
        padding: 14px 18px;
        font-size: 16px;
    }
    
    .send-box {
        padding: 10px 14px;
    }
    
    .send-box button {
        padding: 0 18px;
        font-size: 13px;
    }
    
    .send-box input {
        padding: 11px 16px;
    }
}

/* For very small devices (<= 480px) */
@media (max-width: 480px) {
    .message {
        max-width: 92%;
        font-size: 13.5px;
        padding: 9px 12px;
    }
    
    .header::after {
        font-size: 9px;
        padding: 3px 8px;
    }
    
    .header::before {
        font-size: 18px;
    }
}

/* Prevent body scroll when chat is open */
html, body {
    height: 100%;
    width: 100%;
}

/* Smooth hover effect on messages */
.message:hover {
    transform: translateY(-1px);
    transition: transform 0.2s ease;
}

/* Typing indicator style - Dark Theme */
.typing-indicator {
    background: #1a1a1a;
    border-radius: 20px;
    padding: 10px 16px;
    width: fit-content;
    display: flex;
    gap: 5px;
    align-items: center;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 0.5px solid rgba(255,255,255,0.05);
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    background: #888888;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Empty / Welcome State */
.empty-state {
    text-align: center;
    color: #666666;
    padding: 40px 20px;
    font-size: 14px;
}

/* Admin specific styles for dark theme */
.admin-message {
    background: #ffffff;
    color: #111111;
}

.user-message {
    background: #2a2a2a;
    color: #f0f0f0;
}

/* Safe area support for modern iPhones */
@supports (padding: max(0px)) {
    .header {
        padding-top: max(16px, env(safe-area-inset-top));
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
    
    .send-box {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    
    .chat-box {
        height: -webkit-fill-available;
    }
    
    body {
        height: -webkit-fill-available;
    }
}