
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f3f5f8;
    color: #172638;
    font-family: Arial, sans-serif;
}

button, input {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: #ed0050;
    text-decoration: none;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 245px;
    flex-shrink: 0;
    background: #0e1a25;
    color: white;
    padding: 24px 16px;
}

.sidebar h2 {
    color: #ff0052;
    margin-bottom: 36px;
}

.sidebar-label {
    color: #8698a9;
    font-size: 11px;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.sidebar a {
    display: block;
    padding: 13px 16px;
    margin-bottom: 6px;
    color: #dbe2ea;
    border-radius: 8px;
}

.sidebar a:hover {
    background: #ff0052;
    color: white;
}

.logout-btn {
    display: block;
    width: 100%;
    margin-top: 25px;
    padding: 13px;
    border: 0;
    border-radius: 8px;
    background: #ff0052;
    color: white;
}

.content {
    flex: 1;
    min-width: 0;
}

.topbar {
    background: white;
    padding: 22px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px #0000000a;
}

.page-body {
    padding: 28px;
}

.muted {
    color: #728091;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin: 25px 0;
}

.stat-card, .panel {
    background: white;
    border: 1px solid #e7ebef;
    border-radius: 13px;
    padding: 24px;
    box-shadow: 0 5px 20px #00000008;
}

.stat-card p {
    color: #6e7c8b;
    font-size: 14px;
}

.stat-card h2 {
    font-size: 34px;
    margin: 12px 0 0;
    color: #ff0052;
}

.panel {
    margin-bottom: 24px;
    overflow-x: auto;
}

.panel h2 {
    margin-top: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e8edf2;
    font-size: 14px;
}

th {
    background: #f5f7fa;
}

.online {
    color: #10a365;
    font-weight: bold;
}

.offline {
    color: #788392;
}

input {
    width: 100%;
    padding: 13px;
    border: 1px solid #d6dde5;
    border-radius: 8px;
    outline: none;
}

input:focus {
    border-color: #ff0052;
}

.website-form {
    max-width: 450px;
}

.website-form label {
    display: block;
    margin: 16px 0 8px;
}

.website-form button,
.login-card button,
.widget-box button {
    border: 0;
    border-radius: 8px;
    background: #ff0052;
    color: white;
    padding: 13px 20px;
    margin-top: 16px;
}

.chat-layout {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    height: calc(100vh - 150px);
    min-height: 450px;
    background: white;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e1e6ed;
}

.chat-sidebar {
    border-right: 1px solid #e1e6ed;
    overflow-y: auto;
    padding: 16px;
}

.chat-list-item {
    display: block;
    width: 100%;
    text-align: left;
    background: #f4f6f9;
    border: 0;
    padding: 15px;
    border-radius: 9px;
    margin: 8px 0;
}

.chat-list-item strong,
.chat-list-item small {
    display: block;
    margin-bottom: 5px;
}

.chat-list-item.selected {
    background: #ffe6ee;
    border-left: 4px solid #ff0052;
}

.chat-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid #e5ebef;
}

.chat-header h3 {
    margin: 0 0 10px;
}

.chat-header p {
    font-size: 12px;
    margin: 5px 0;
    overflow-wrap: anywhere;
}

.messages {
    flex: 1;
    min-height: 150px;
    overflow-y: auto;
    padding: 18px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bubble {
    max-width: 78%;
    padding: 12px 15px;
    border-radius: 13px;
    overflow-wrap: anywhere;
    line-height: 1.5;
}

.bubble small {
    display: block;
    margin-top: 7px;
    font-size: 10px;
    opacity: .75;
}

.bubble.mine {
    align-self: flex-end;
    background: #ff0052;
    color: white;
}

.bubble.theirs {
    align-self: flex-start;
    background: #e8edf3;
    color: #152232;
}

.send-form {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid #e2e8ef;
}

.send-form input {
    flex: 1;
    min-width: 0;
}

.send-form button {
    background: #ff0052;
    color: white;
    border: 0;
    border-radius: 8px;
    padding: 0 24px;
    margin: 0;
}

.close-btn {
    padding: 11px;
    background: #344454;
    border: 0;
    color: white;
}

button:disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* LOGIN */
.login-body {
    background: #0e1a25;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-card {
    background: #182a39;
    color: white;
    width: 100%;
    max-width: 420px;
    padding: 35px;
    border-radius: 16px;
}

.login-card h1 {
    color: #ff0052;
}

.login-card label {
    display: block;
    margin: 18px 0 8px;
}

.login-card input {
    background: #0e1a25;
    border-color: #34495b;
    color: white;
}

.login-card button {
    width: 100%;
}

.error {
    background: #5b2335;
    padding: 12px;
    border-radius: 8px;
}

/* VISITOR WIDGET */
.widget-body {
    background: transparent;
    padding: 0;
}

.widget-box {
    height: 100vh;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

.widget-header {
    background: #0e1a25;
    color: white;
    padding: 18px;
}

.widget-header h3 {
    color: #ff0052;
    margin: 0;
}

.widget-header p {
    margin-bottom: 0;
}

#visitor-start {
    padding: 22px;
    overflow-y: auto;
}

#visitor-start label {
    display: block;
    margin: 16px 0 8px;
}

#visitor-chat {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#visitor-chat[hidden] {
    display: none;
}

#visitor-chat-status {
    padding: 0 15px;
    font-size: 12px;
}

@media (max-width: 1000px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 750px) {
    .layout {
        display: block;
    }

    .sidebar {
        width: 100%;
    }

    .topbar, .page-body {
        padding: 16px;
    }

    .chat-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .chat-sidebar {
        height: 200px;
        border-right: 0;
        border-bottom: 1px solid #e1e6ed;
    }

    .chat-main {
        height: 550px;
    }
}

@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr;
    }

    .bubble {
        max-width: 90%;
    }
}
