* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    font-size: medium;
}

body {
    background-color: #ffefef;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border-bottom: 2px solid #ddd;
}

.logo-image {
    height: 80px;
    width: 140px;
    padding-left: 50px;
}

.stats-box {
    background: #EBE6FF;
    padding: 8px 15px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    color: #7358F2;
    margin-right: 20px;
}

/* Main Layout */
.chat-container {
    display: flex;
    flex: 1;
    padding: 10px;
    gap: 10px;
    min-height: 0;
    /* Crucial for flex item shrinking */
    overflow: hidden;
}

.chat-display {
    flex: 1;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-logs {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    /* Prevent scrollbar overlapping content */
}

/* Chat Text Styles */
.status-msg {
    font-weight: bold;
    color: #444;
    margin-bottom: 10px;
}

.warning-msg {
    color: red;
    font-weight: bold;
    margin-bottom: 5px;
}

.rules {
    list-style: none;
    color: #655c5c;
    line-height: 1.6;
    font-size: 14px;
}

/* Footer / Inputs */
.controls {
    display: flex;
    padding: 10px;
    gap: 10px;
    background: #fff;
}

.start-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
}

.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding-right: 10px;
}

.input-wrapper input {
    flex: 1;
    border: none;
    padding: 10px;
    outline: none;
}

.gif-btn {
    background: #444343;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
}

.send-btn {
    background-color: #007bff;
    border: 1px solid #ccc;
    padding: 10px 30px;
    border-radius: 5px;
    color: white;
}

/* Report Button */
.report-btn {
    background: #dc3545;
    color: #ffffff;
    border: none;
    padding: 10px 30px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: none; /* shown via JS when applicable */
    text-align: center;
}

/* GIF Panel Styles */
.gif-panel {
    position: absolute;
    bottom: 90px;
    right: 20px;
    /* Aligned to right, or can be left */
    width: 320px;
    height: 400px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.gif-header {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

#gif-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

#close-gif-panel {
    background: none;
    border: none;
    font-size: 24px;
    margin-left: 10px;
    cursor: pointer;
    color: #666;
}

.gif-grid {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.gif-item {
    width: 100%;
    height: auto;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
    object-fit: cover;
    max-height: 150px;
}

.gif-item:hover {
    transform: scale(1.02);
}

/* Scrollbar */
.gif-grid::-webkit-scrollbar {
    width: 6px;
}

.gif-grid::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

/* Responsive: Desktop down */
@media (max-width: 1200px) {
    .navbar {
        padding: 12px 16px;
    }

    .logo-image {
        height: 70px;
        width: 120px;
        padding-left: 16px;
    }

    .chat-container {
        gap: 8px;
    }
}

/* Responsive: Tablets (text view remains as-is) */
@media (max-width: 992px) {
    .stats-box {
        font-size: 13px;
        padding: 6px 10px;
    }

    .chat-logs {
        padding-right: 2px;
    }

    .controls {
        gap: 8px;
        flex-wrap: wrap;
    }

    .start-btn {
        padding: 10px 18px;
    }

    .send-btn {
        padding: 10px 18px;
    }
    .report-btn {
        padding: 10px 18px;
    }

    .gif-panel {
        width: 300px;
        height: 360px;
        right: 12px;
        bottom: 84px;
    }
}

/* Narrow phones/phablets: fix 562px–501px layout & sizing */
@media (max-width: 562px) and (min-width: 501px) {
    .controls {
        gap: 6px;
        flex-wrap: nowrap;
        align-items: center;
    }

    .start-btn, .send-btn, .report-btn {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 8px;
        height: 48px;
        min-width: 72px;
    }

    .input-wrapper {
        position: relative;
        flex: 1 1 auto;
        min-width: 0;
    }

    .input-wrapper input {
        height: 36px;
        border-radius: 8px;
    }

    .gif-btn {
        width: 28px;
        height: 28px;
        border-radius: 6px;
        position: absolute;
        right: 8px;
    }
}

/* Mobile phones: text chat layout */
@media (max-width: 500px) {
    /* Header compact */
    .navbar {
        padding: 8px 12px;
    }

    .logo-image {
        height: 60px;
        width: 100px;
        padding-left: 8px;
    }

    .stats-box {
        margin-right: 8px;
        font-size: 12px;
        padding: 4px 10px;
    }

    /* Single-column content */
    .chat-container {
        flex-direction: column;
        gap: 10px;
        padding: 8px;
        flex: 0.96;
    }

    .chat-display {
        border-radius: 12px;
        padding: 16px;
    }

    .chat-logs {
        min-height: 40vh;
    }

    .gif-panel {
        margin-bottom: 20px;
    }
}

/* 360px to 500px controls not in columns */
@media (max-width: 500px) and (min-width: 300px) {
    body{
        height: 92vh;
    }
    .controls {
        display: flex;
        flex-wrap: nowrap;
        gap: 4px;
        align-items: center;
    }

    .input-wrapper {
        position: relative;
        flex: 1 1 auto;
        min-width: 0;
    }

    .input-wrapper input {
        width: 100%;
        padding-right: 40px;
        box-sizing: border-box;
        border-radius: 8px;
        height: 36px;
    }

    .start-btn {
        flex: 0 0 auto;
        padding: 8px 12px;
        color: #fff;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        text-align: center;
        height: 48px;
        min-width: 64px;
    }

    .send-btn {
        flex: 0 0 auto;
        padding: 8px 12px;
        color: #fff;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        text-align: center;
        height: 48px;
        min-width: 64px;
    }
    .report-btn {
        flex: 0 0 auto;
        padding: 8px 12px;
        color: #fff;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        text-align: center;
        height: 48px;
        min-width: 64px;
    }

    .gif-btn {
        position: absolute;
        right: 8px;
        top: 50%;
        transform: translateY(-50%);
        width: 28px;
        height: 28px;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}