/* ===========================
   RESET / BASE STYLES
   =========================== */

/*
A small CSS reset removes browser
defaults that often interfere with layouts.
*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/*
Setting a global font improves consistency.
You could also load a webfont here.
*/

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #0e1030;
    color: #222;
}



/* ===========================
   MAIN APP LAYOUT
   =========================== */

/*
The main layout uses CSS Grid.

We create two columns:
- Sidebar
- Content

Desktop-first approach.
*/

.app {
    display: grid;

    grid-template-columns: 280px 1fr;

    /* Full viewport height */
    min-height: 100vh;
}



/* ===========================
   SIDEBAR
   =========================== */

.sidebar {

    /*background: #dc3545;*/
    background-image: url("img/texture01.webp");

    padding: 20px;

    border-right: 1px solid #3d3def;

    display: flex;
    flex-direction: column;
    gap: 20px;
    color: white;
}



/* User block */

.user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.user img {
    border-radius: 50%;
}

.user div {
    overflow: hidden;
}

#user-name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

#user-status {
    font-size: 12px;
}



/* Buttons */

.primary-btn {

    padding: 10px;
    border-radius: 8px;

    border: 0px solid #ffffff;

    background: #7c366b;
    color: #e3e3ef ;

    cursor: pointer;
}

.secondary-btn {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: #fdfdfd;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.secondary-btn:hover {
    background: #f0f0f0;
}



/* Client section */
.clients {
    background-color: #ffffff9a;
    padding: 12px;
    border-radius: 8px;
    height: 80%;

}
.clients-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.add {
    font-size: 20px;
    cursor: pointer;
}



/* Search input */

.clients input {

    width: 100%;
    padding: 8px;

    margin: 10px 0;

    border-radius: 20px;

    border: 1px solid #ccc;
}



/* Case list */

.cases {

    list-style: none;

    display: flex;
    flex-direction: column;

    gap: 8px;
}

.cases li {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.cases li:hover {
    background: rgba(0, 0, 0, 0.05);
}

.cases li.active {
    background: #252a62;
}




/* ===========================
   MAIN CONTENT
   =========================== */

.content {

    padding: 30px;
    position: relative;
    background-image: url("img/JapJizo.webp");
    background-position: right bottom;
    background-repeat: no-repeat;
}

/* Basic responsive logo */
#logoJizo {
  max-width: 60%;
  height: auto;
}

/* Optional: smaller logo on mobile */
@media (max-width: 600px) {
#logoJizo {
        /*max-width: 20%;*/
        min-width: 60%;
    }
}

/* Page title */


/* ===========================
   DASHBOARD GRID
   =========================== */

/*
This is the central layout area.

Two columns:
Left: cards
Right: panel

The right panel is wider.
*/

.dashboard {

    display: grid;

    grid-template-columns: 1fr 1.4fr;

    gap: 30px;
}



/* ===========================
   CARD COLUMN
   =========================== */
.copy-msg-btn {
    align-self: flex-end;
    background: transparent;
    border: 1px solid #ddd;
    color: #888;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 5px;
    transition: all 0.2s;
}

.copy-msg-btn:hover {
    background: #f0f0f0;
    color: #333;
    border-color: #bbb;
}

.cards {

    display: flex;
    flex-direction: column;

    gap: 25px;
}



/* Card component */

.card {

    background: rgba(255, 255, 255, 0.5);

    padding: 25px;

    border-radius: 12px;

    border: 1px solid #ddd;

    display: flex;

    flex-direction: column;

    gap: 15px;
}

.card button {

    align-self: flex-start;

    padding: 8px 14px;

    border-radius: 6px;

    border: 1px solid #aaa;

    background: #252a62;
    color: #d6d2d5;

    cursor: pointer;
}



/* ===========================
   RIGHT INFO PANEL
   =========================== */

.panel {

    background: rgba(255, 255, 255, 0.5);

    border: 1px solid #ddd;

    border-radius: 12px;

    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 600px;
    /* Fixed height for the chat panel */
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding-right: 5px;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.user {
    align-self: flex-end;
    background-color: #007bff;
    color: white;
    border-bottom-right-radius: 2px;
}

.message.assistant {
    align-self: flex-start;
    background-color: #f1f1f1;
    color: #333;
    border-bottom-left-radius: 2px;
}

.message.error-text {
    color: #dc3545;
    background-color: #fff5f5;
    border: 1px solid #ffcccc;
}

/* Markdown styling inside assistant bubbles */
.message.assistant p {
    margin: 0 0 10px 0;
}
.message.assistant p:last-child {
    margin-bottom: 0;
}
.message.assistant ul, .message.assistant ol {
    margin: 0 0 10px 20px;
    padding: 0;
}

.placeholder-text {
    color: #373a88;
    text-align: center;
    padding: 40px 20px;
    font-style: italic;
}

/* =========================
   MODAL & AUTH STYLES
========================== */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 12px;
    width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
}

.modal-toggle {
    margin-top: 20px;
    font-size: 14px;
    text-align: center;
}

.modal-toggle a {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
}

.build-info {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 11px;
    color: #999;
    font-family: monospace;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #eee;
}



/* ===========================
   CHAT INPUT
   =========================== */

.chat-input {

    margin-top: auto;

    display: flex;

    gap: 10px;
    align-items: flex-end;
}

.chat-input input, .chat-input textarea {

    flex: 1;

    padding: 12px;

    border-radius: 10px;

    border: 1px solid #ccc;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    line-height: 1.5;
    max-height: 200px;
}

.chat-input button {

    width: 44px;
    height: 44px;

    border-radius: 50%;

    border: none;

    background: #ddd;

    cursor: pointer;
}



/* ===========================
   BASIC RESPONSIVE
   =========================== */

/*
Even though you asked desktop-first,
it is good practice to already define
a mobile fallback.

Below 1000px we stack columns.
*/

@media (max-width: 1000px) {

    .dashboard {
        grid-template-columns: 1fr;
    }

    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: 2;
    }

}

/* ===========================
   ANONYMIZATION STYLES
   =========================== */

.pii-highlight {
    background-color: #ffe8e8;
    color: #d63031;
    border: 1px dashed #fab1a0;
    padding: 0 4px;
    border-radius: 4px;
    font-weight: 600;
}

.anon-analytics {
    margin-top: 20px;
}

.anon-stats {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
}

.detected-terms {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0;
}

.detected-term-item {
    background: #fdfdfd;
    border: 1px solid #ddd;
    color: #444;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* ===========================
   FLOATING ACTION BUTTONS
   =========================== */

.floating-download-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #f8f9fa;
    color: #555;
    border: 1px solid #ddd;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-download-btn:hover {
    background-color: #f1f1f1;
    color: #222;
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #bbb;
}

.floating-download-btn:active {
    transform: translateY(0) scale(0.95);
}

.floating-download-btn svg {
    transition: transform 0.2s;
}

.floating-download-btn:hover svg {
    transform: translateY(2px);
}

/* ===========================
   WAITING MODAL & SPINNER
   =========================== */

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #7c366b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#waiting-modal .modal-content {
    border-top: 6px solid #7c366b;
    animation: fadeInModal 0.3s ease-out;
}

@keyframes fadeInModal {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

#tip-text {
    animation: fadeInTip 0.5s ease-in-out;
}

@keyframes fadeInTip {
    from { opacity: 0; }
    to { opacity: 1; }
}