/* Shared styles for the beautified MiniChat */
:root {
    --bg: #0f172a;
    --panel: rgba(255, 255, 255, 0.06);
    --panel-strong: rgba(255, 255, 255, 0.12);
    --stroke: rgba(255, 255, 255, 0.12);
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #7c3aed;
    --accent-2: #22d3ee;
    --success: #10b981;
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Inter", "Avenir", "Segoe UI", "Helvetica Neue", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 20% 20%, rgba(34, 211, 238, 0.08), transparent 25%),
        radial-gradient(circle at 80% 0%, rgba(124, 58, 237, 0.16), transparent 30%),
        linear-gradient(145deg, #0b1120 0%, #0f172a 50%, #0b1229 100%);
}

.grid-overlay {
    position: fixed;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 22px 22px;
    pointer-events: none;
    z-index: 0;
}

.page {
    position: relative;
    z-index: 1;
    padding: 40px 18px;
    display: grid;
    place-items: center;
}

.card {
    width: min(960px, 100%);
    background: var(--panel);
    border: 1px solid var(--stroke);
    border-radius: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    padding: 26px;
}

.card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: linear-gradient(120deg, rgba(124, 58, 237, 0.18), rgba(34, 211, 238, 0.12));
    color: #e0e7ff;
    font-size: 13px;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

h1 {
    margin: 6px 0 4px;
    font-size: clamp(28px, 3vw, 36px);
    letter-spacing: -0.3px;
}

p {
    color: var(--muted);
    margin: 0 0 12px;
}

.muted {
    color: var(--muted);
}

a {
    color: var(--accent-2);
    text-decoration: none;
    font-weight: 600;
}

a:hover {
    text-decoration: underline;
}

.form {
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    gap: 6px;
}

.label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-weight: 600;
    color: #e2e8f0;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--stroke);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 15px;
    transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: rgba(124, 58, 237, 0.5);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.16);
    transform: translateY(-1px);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

select {
    width: 100%;
    border: 1px solid var(--stroke);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 15px;
}

.actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 700;
    color: #0b1120;
    background: linear-gradient(135deg, #22d3ee, #7c3aed);
    box-shadow: 0 12px 35px rgba(124, 58, 237, 0.35);
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 40px rgba(124, 58, 237, 0.45);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    box-shadow: none;
    border: 1px solid var(--stroke);
}

.layout-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
}

.panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    padding: 16px;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 6px;
}

.message-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    display: block;
}

.message-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: linear-gradient(120deg, rgba(34, 211, 238, 0.08), rgba(124, 58, 237, 0.1));
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.message-card:hover::before {
    opacity: 1;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.pseudo {
    font-weight: 700;
    color: #cbd5f5;
}

.timestamp {
    font-size: 12px;
    color: var(--muted);
}

.message-body {
    margin: 0;
    color: #e5e7eb;
    line-height: 1.4;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5f5;
    font-size: 13px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--stroke);
    margin-bottom: 14px;
}

.topbar .right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tag {
    font-size: 13px;
    color: var(--muted);
}

.helper {
    font-size: 14px;
    color: var(--muted);
}

.stacked {
    display: grid;
    gap: 8px;
}

.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
}

.btn-danger {
    background: rgba(255, 83, 112, 0.18);
    color: #ffe4e6;
    border: 1px solid rgba(255, 83, 112, 0.6);
    box-shadow: none;
}

.room-card.danger {
    border-color: rgba(255, 83, 112, 0.35);
    background: rgba(255, 83, 112, 0.06);
}

.ai-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 6px;
}

.ai-bubble {
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--stroke);
    background: rgba(255, 255, 255, 0.04);
}

.ai-bubble.ai-assistant {
    border-color: rgba(34, 211, 238, 0.4);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(124, 58, 237, 0.12));
}

.ai-bubble.ai-user {
    border-color: rgba(124, 58, 237, 0.4);
    background: rgba(124, 58, 237, 0.08);
}

@media (max-width: 720px) {
    .card {
        padding: 20px;
    }

    .card__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

.room-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.btn-danger-small {
    background: #d9534f;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    color: white;
    cursor: pointer;
}

.btn-danger-small:hover {
    background: #c9302c;
}
