:root {
    --border: #e5e7eb;
    --text: #111827;
    --muted: #6b7280;
    --bg: #ffffff;

    --primary: #16a34a;
    --primary-hover: #15803d;
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    margin: 0;
    position: relative;
    background-color: #ddd;
}

/* GLOBAL watermark background */
body::before {
    content: "";
    position: fixed;
    inset: 0;

    background-image: url("/static/images/ecda-bg.png");
    background-repeat: no-repeat;
    background-position: top;
    background-size: 45%;
    opacity: 0.2;

    z-index: -1;
}


/* Move content a bit upward */
.wrap {
    min-height: 50vh;
    display: grid;
    justify-items: center;
    align-content: start;
    padding-top: 25vh;
    padding-left: 16px;
    padding-right: 16px;
}

.card {
    width: min(680px, 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(6px);
}

.card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.card-col {
    display: grid;
    gap: 14px;
}

h1 {
    font-size: 2rem;
    margin: 0;
}

.meta {
    font-size: 0.95rem;
    color: var(--muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 22px;

    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;

    transition: transform 0.15s ease, background 0.15s ease;
    user-select: none;
    cursor: pointer !important;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

.btn-proceed {
    background: #ccc;
    color: var(--text);
    border: 1px solid var(--border);
    cursor: pointer;
}

.btn-proceed:hover {
    background: #ddd;
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: #f9fafb;
}


/* Chat UI */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.messages {
    height: 220px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.65);
}

.msg {
    max-width: 80%;
    padding: 10px 12px;
    border-radius: 12px;
    margin: 8px 0;
    line-height: 1.35;
    white-space: pre-wrap;
}

.msg-user {
    margin-left: auto;
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
}

.msg-bot {
    margin-right: auto;
    background: #f9fafb;
    border: 1px solid var(--border);
    color: var(--text);
}

.chat-form {
    display: flex;
    gap: 10px;
}

.input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 1rem;
    outline: none;
}

.input:focus {
    border-color: #86efac;
    box-shadow: 0 0 0 3px rgba(134, 239, 172, 0.35);
}

/* Chat page: prevent page scroll and keep layout fixed */
body.chat .wrap {
    height: 50vh;
    /* fixed to viewport */
    min-height: 50vh;
    /* override your 50vh */
    padding-top: 160px;
    /* space for top background image */
    overflow: hidden;
    /* IMPORTANT: no body/page scrolling */
}

/* Chat card takes the remaining height and stays in place */
body.chat .chat-container {
    height: calc(100vh - 200px);
    /* depends on padding-top, tune if needed */
    display: flex;
    flex-direction: column;
}

/* Only messages scroll */
body.chat .messages {
    flex: 1;
    overflow-y: auto;
}



.msg-bot.thinking {
    color: var(--muted);
    font-style: italic;
}

/* 3 bouncing dots */
.dots {
    display: inline-flex;
    gap: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

.dots span {
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    animation: bounce 1.2s infinite;
    opacity: 0.7;
}

.dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}


.upload-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.uploaded-list {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.6);
}

.uploaded-ul {
    margin: 0;
    padding-left: 18px;
}

.uploaded-ul li {
    margin: 6px 0;
    color: var(--text);
}

.files-meta {
    font-size: 0.9rem;
    color: var(--muted);
}


.header-actions {
    display: flex;
    gap: 10px;
}


/* File upload container */
.file-upload {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Hide default input */
.file-upload input[type="file"] {
    display: none;
}

/* Custom button */
.file-upload-label {
    width: 40%;
    display: inline-block;
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 14px;
    background: #ccc;
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    transition: all 0.15s ease;
}

.file-upload-label:hover {
    background: #eee;
    border-color: #ccc;
}

/* File list text */
.file-names {
    font-size: 0.9rem;
    color: var(--muted);
}



.uploaded-li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
}

.icon-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}


.delete-filename {
    cursor: pointer !important;
    color: #900 !important;
}



.tooltip-container {
    display: inline-block;
    position: relative;
}

.tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    background-color: #333;
    color: white;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 5px;
    white-space: nowrap;
    bottom: 105%;
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.tooltip-container:hover .tooltip {
    visibility: visible;
    opacity: 1;
}