:root {
    --whatsapp-teal: #008069;
    --whatsapp-teal-dark: #005d4b;
    --whatsapp-light: #25D366;
    --whatsapp-bg: #EFEAE2;
    --bubble-out: #E7FFDB;
    --bubble-in: #FFFFFF;
    --text-primary: #111b21;
    --text-secondary: #667781;
    --text-timestamp: #999;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

body {
    background: #d1d7db;
    /* Desktop background */
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    overscroll-behavior: none;
    /* Prevent bounce */
}

/* --- MAIN CONTAINER --- */
#app-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
}

/* Green header strip for desktop bg */
body::after {
    content: "";
    position: absolute;
    top: 0;
    width: 100%;
    height: 127px;
    background-color: var(--whatsapp-teal);
    z-index: 0;
}

.glass-panel {
    width: 100%;
    max-width: 420px;
    /* STRICT PHONE WIDTH */
    height: 90vh;
    /* Not full height on desktop, looks more like an app */
    max-height: 850px;
    background: #fff;
    box-shadow: 0 17px 50px 0 rgba(11, 20, 26, .19), 0 12px 15px 0 rgba(11, 20, 26, .24);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 20;
    border-radius: 20px;
    /* Phone corners */
    border: 1px solid #ccc;
}

/* Mobile Overrides (Actual Phones) */
@media (max-width: 768px) {
    body {
        background: #fff;
        height: 100dvh;
        /* Dynamic Height for Mobile */
        width: 100%;
        align-items: flex-start;
    }

    body::after {
        display: none;
    }

    #app-container {
        padding: 0;
        width: 100%;
        height: 100dvh;
        align-items: flex-start;
    }

    .glass-panel {
        max-width: 100%;
        max-height: 100dvh;
        height: 100dvh;
        width: 100%;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }
}

/* --- HEADER --- */
.app-header {
    padding: 10px 16px;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e9edef;
}

.profile-section {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
}

.avatar-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

#avatarImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.info-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-wrapper h2 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    line-height: normal;
}

.sub-info {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: normal;
}

.header-controls {
    display: flex;
    gap: 20px;
    color: var(--whatsapp-teal);
}

.control-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--whatsapp-teal);
    cursor: pointer;
}

/* --- CHAT AREA --- */
.chat-content {
    flex: 1;
    background-color: var(--whatsapp-bg);
    background-image: url("https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png");
    background-repeat: repeat;
    background-size: 400px;
    opacity: 0.95;
    overflow-y: auto;
    padding: 20px 5%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    /* WhatsApp bubbles are close */
}

/* Scrollbar */
.chat-content::-webkit-scrollbar {
    width: 6px;
}

.chat-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}


.message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    /* Wider for phone view */
    margin-bottom: 2px;
    animation: none;
}

.message.sent {
    align-self: flex-end;
}

.message.received {
    align-self: flex-start;
}

.bubble {
    padding: 6px 7px 8px 9px;
    border-radius: 7.5px;
    font-size: 14.2px;
    line-height: 19px;
    position: relative;
    box-shadow: 0 1px .5px rgba(11, 20, 26, .13);
}

.sent .bubble {
    background: var(--bubble-out);
    border-top-right-radius: 0;
}

.received .bubble {
    background: var(--bubble-in);
    border-top-left-radius: 0;
}

/* Tails (Pseudo-elements) */
.sent .bubble::before {
    content: "";
    position: absolute;
    top: 0;
    right: -8px;
    width: 8px;
    height: 13px;
    background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13' width='8' height='13'%3E%3Cpath opacity='.13' fill='%230000000' d='M5.188 1H0v11.193l6.467-8.625C7.526 2.156 6.958 1 5.188 1z'/%3E%3Cpath fill='%23E7FFDB' d='M5.188 0H0v11.193l6.467-8.625C7.526 1.156 6.958 0 5.188 0z'/%3E%3C/svg%3E");
}

.received .bubble::before {
    content: "";
    position: absolute;
    top: 0;
    left: -8px;
    width: 8px;
    height: 13px;
    background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13' width='8' height='13'%3E%3Cpath opacity='.13' fill='%230000000' d='M1.533 3.568L8 12.193V1H2.812C1.042 1 .474 2.156 1.533 3.568z'/%3E%3Cpath fill='%23FFF' d='M1.533 2.568L8 11.193V0H2.812C1.042 0 .474 1.156 1.533 2.568z'/%3E%3C/svg%3E");
}

/* --- STICKERS --- */
.sticker-bubble {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0;
    font-size: 80px;
    /* Big Emojis */
    line-height: normal;
    overflow: visible;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.sticker-bubble::before {
    display: none !important;
}

@keyframes popIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.timestamp {
    float: right;
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    margin-left: 10px;
    /* Space from text */
    display: flex;
    align-items: center;
    gap: 3px;
}

.status-icon {
    font-size: 10px;
    color: #8696a0;
    /* WhatsApp Grey */
    transition: color 0.3s ease;
}

.status-icon.blue {
    color: #53bdeb;
    /* WhatsApp Blue */
}

/* Onboarding Selection Styles */
.selection-card.selected,
.vibe-card.selected {
    border-color: #00a884 !important;
    background: #0b141a !important;
}

.timestamp {
    float: right;
    float: right;
    font-size: 11px;
    color: var(--text-timestamp);
    margin-left: 10px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* --- FOOTER --- */
.input-area {
    padding: 10px 16px;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 20;
}

.input-container {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    padding: 9px 12px;
    display: flex;
    align-items: center;
}

input {
    width: 100%;
    border: none;
    outline: none;
    font-size: 15px;
    color: var(--text-primary);
}

.send-btn {
    background: none;
    border: none;
    color: #54656f;
    font-size: 1.5rem;
    cursor: pointer;
}

/* --- EXTRAS/MODALS/STATS (Hidden/Restyled) --- */
.stats-bar {
    display: none;
}

/* Hide stats for clean layout */

/* Simple Modal Override */
/* --- PREMIUM MODAL --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-card {
    background: #111b21;
    /* WhatsApp Dark BG */
    color: #e9edef;
    width: 90%;
    max-width: 400px;
    padding: 30px 20px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
    border: 1px solid #2a3942;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Typography */
.modal-card h2 {
    font-size: 22px;
    margin-bottom: 10px;
    font-weight: 600;
}

.modal-card p {
    font-size: 14px;
    color: #8696a0;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Buttons */
.save-btn,
.danger-btn {
    padding: 14px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    border: none;
    width: 100%;
    margin-bottom: 10px;
}

.save-btn {
    background: #00a884;
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 168, 132, 0.4);
}

.save-btn:active {
    transform: scale(0.96);
}

/* Selection Cards */
.selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.selection-card {
    background: #202c33;
    padding: 15px;
    border-radius: 15px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.selection-card:hover {
    background: #2a3942;
}

.selection-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 3px solid #111b21;
}

/* Vibe Cards */
.vibe-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vibe-card {
    background: #202c33;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid transparent;
    /* Prevent jump on select */
    transition: background 0.2s;
}

.vibe-card:hover {
    background: #2a3942;
}

/* Selected State Override */
.selection-card.selected,
.vibe-card.selected {
    border-color: #00a884 !important;
    background: #0b141a !important;
    position: relative;
}

.selection-card.selected::after,
.vibe-card.selected::after {
    content: "✓";
    position: absolute;
    top: 10px;
    right: 10px;
    background: #00a884;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-group input,
.form-group select {
    background: #f0f2f5;
    color: #111b21;
    border-color: #d1d7db;
}

/* --- TOAST NOTIFICATION --- */
.toast {
    position: absolute;
    top: 80px;
    /* Below header */
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.active {
    opacity: 1;
}