/* 
 * Modern Seamless Design Override (v2 - No Gaps / Split Pane)
 * Focus: Borderless feel, Full layout usage, Inter font
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #673ab7;
    --primary-soft: rgba(103, 58, 183, 0.08);
    --body-bg: #ffffff;
    /* Changed to White for seamless merge */
    --text-color: #374151;
    /* Gray-700 */
    --heading-color: #111827;
    /* Gray-900 */
    --border-color: #e5e7eb;
    /* Light border */
    --card-bg: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --radius-md: 16px;
    /* Restored rounded look */
    --radius-btn: 50rem;
    /* Pill shape for buttons */
}

html.dark-theme {
    --body-bg: #16191c;
    --text-color: #ccced1;
    --heading-color: #e7e9ec;
    --border-color: rgba(255, 255, 255, 0.12);
    --card-bg: #1a1e21;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-color);
}

/* --- Layout Structure (Split Pane) --- */

.wrapper {
    background-color: var(--body-bg);
}

/* Sidebar */
.sidebar-wrapper {
    background-color: #fff;
    border-right: 1px solid var(--border-color);
    /* Separator */
    box-shadow: none;
    z-index: 50;
    /* Ensure on top */
}

.sidebar-header {
    border-bottom: 1px solid var(--border-color);
    /* Align with header border */
    background: transparent;
}

/* Header */
.top-header {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    /* Separator */
    box-shadow: none;
    /* Flat seamless look */
    z-index: 40;
}

/* Content Area - remove gaps */
.page-wrapper {
    margin-top: 70px;
    background-color: var(--body-bg);
}

.page-content-wrapper {
    /* Ensure content touches sidebar */
    background-color: var(--body-bg);
}

.page-content {
    padding: 1.5rem;
    /* Restore standard padding inside the content area */
    /* Remove the gray background gap by making page-content transparent over white body */
}

/* --- Components --- */

/* Cards are now subtle containers or flat */
.card {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    background-color: var(--card-bg);
    margin-bottom: 1.5rem;
}

    .card:hover {
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    }

/* Adjust MetisMenu for seamless look (Side-Pill Style - Restored) */
.sidebar-wrapper .metismenu {
    padding-top: 10px;
    padding-left: 0;
    /* Touch left edge */
    padding-right: 10px;
    /* Space on right for the pill end */
}

.metismenu li a {
    color: #555;
    padding: 12px 20px;
    /* More padding */
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 0 30px 30px 0;
    /* Side Pill: Round on right only */
    margin-bottom: 0px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    border-left: 4px solid transparent;
    /* Prepare for active border */
}

    .metismenu li a i {
        font-size: 1.25rem;
        margin-right: 12px;
        color: #777;
        transition: color 0.2s;
    }

    .metismenu li a:hover {
        background-color: var(--primary-soft);
        color: var(--primary-color);
        padding-left: 25px;
        /* Slight movement */
    }

        .metismenu li a:hover i {
            color: var(--primary-color);
        }

/* Active State */
.metismenu li.mm-active > a {
    background-color: var(--primary-soft);
    /* Light BG */
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    /* Identity line */
    font-weight: 600;
}

    .metismenu li.mm-active > a i {
        color: var(--primary-color);
    }

.sidebar-wrapper .metismenu li:first-child {
    margin-top: 0px;
}

.sidebar-wrapper .metismenu li:last-child {
    margin-bottom: 0px;
}


.sidebar-wrapper .metismenu ul {
    margin-top: 2px;
}

.mm-collapse {
    border-radius: 0 22px 22px 0;
}

/* Light theme: opened submenu background */
html:not(.dark-theme):not(.dark-sidebar) .sidebar-wrapper .metismenu ul.mm-collapse.mm-show {
    background: rgb(245, 245, 245) !important;
}
/* Buttons */
.btn {
    border-radius: var(--radius-btn);
    box-shadow: none;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

    .btn-primary:hover {
        background-color: #5b32a3;
        /* Darker shade */
        box-shadow: var(--shadow-sm);
    }
/* Hide the user-provided gaps if they come from specific elements */
.page-content-wrapper {
    padding-bottom: 0;
    /* Remove bottom padding gap */
}
/* Header User Box */
.user-box {
    /*border-left: 1px solid var(--border-color);*/
}
/* --- Bootstrap Tabs Modernization (Overlap Fix) --- */

.nav-tabs {
    border-bottom: 1px solid var(--border-color);
    /* The base line */
    gap: 6px;
    padding-left: 10px;
    /* Indent tabs slightly */
}

    .nav-tabs .nav-link {
        border: 1px solid transparent;
        border-bottom: none;
        background: transparent;
        color: #6b7280;
        font-weight: 500;
        padding: 10px 20px;
        border-radius: 12px 12px 0 0 !important;
        margin-bottom: -1px;
        /* Push down to sit ON the line */
        transition: all 0.2s;
    }

        .nav-tabs .nav-link:hover {
            color: var(--primary-color);
            background: var(--primary-soft);
            border-color: transparent;
        }

        .nav-tabs .nav-link.active {
            color: var(--primary-color);
            background: #fff;
            font-weight: 600;
            border-color: var(--border-color);
            border-bottom-color: #fff;
            /* Erase the line below */
            z-index: 5;
            /* Sit above content border */
            box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.02);
        }
/* Tab Content Box */
.tab-content {
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: none;
    /* Rely on nav-tabs border-bottom for the top line */
    border-radius: 0 0 16px 16px;
    /* Round bottom only */
    padding: 24px;
    margin-top: 0;
    position: relative;
    z-index: 1;
}
html.dark-theme .nav-tabs {
    border-bottom: 1px solid var(--border-color);
}
html.dark-theme .nav-tabs .nav-link {
    color: #9ea4aa;
    background: transparent;
}
html.dark-theme .nav-tabs .nav-link:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.06);
}
html.dark-theme .nav-tabs .nav-link.active {
    color: var(--text-color);
    background: var(--card-bg);
    border-color: var(--border-color);
    border-bottom-color: var(--card-bg);
    box-shadow: none;
}
html.dark-theme .tab-content {
    background: var(--card-bg);
    border-color: var(--border-color);
}
/* Special Case: If tab content is STANDALONE (not sharing border with tabs line) */
/* We force the nav-tabs line to ACT as the top border of the content */
/* Override specifics to ensure whiteness */
html:not(.dark-theme),
html:not(.dark-theme) body,
html:not(.dark-theme) .wrapper,
html:not(.dark-theme) .page-wrapper,
html:not(.dark-theme) .page-content-wrapper {
    background-color: #ffffff !important;
}
/* If cards are inside .page-content, they will now sit on white.
   The border makes them visible. */
/* --- SPECIAL PAGE OVERRIDES --- */
/* Chat Page Integration (Seamless) */
.page-content:has(.chat-page-my) {
    padding: 0 !important;
    overflow: hidden;
    /* Prevent double scrollbars */
    height: calc(100vh - 70px);
    /* Full height minus header */
}
/* --- Agent Selection Tiles (Modern Redesign v2) --- */

.agent-tiles-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 0.5rem;
}

.agent-tile.modern-card {
    background: var(--card-bg);
    color: var(--text-color);
    /* Booklet style left border or top border */
    border: 1px solid var(--border-color);
    /*border-top: 5px solid var(--agent-color, var(--primary-color));*/
    border-radius: 20px;
    /* Highly rounded */
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer;
    transition: border-color 0.2s ease;
    box-shadow: none;
    position: relative;
    overflow: hidden;
}

    .agent-tile.modern-card:hover {
        box-shadow: none;
        border-color: var(--agent-color, var(--primary-color));
    }
/* Icon Circle */
.agent-icon-circle {
    width: 80px;
    min-width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--agent-color, var(--primary-color));
    background-color: transparent;
    border: 6px solid var(--agent-color, var(--primary-color));
    box-shadow: none;
    overflow: hidden;
    padding: 0;
}

/* Image inside fills the circle completely */
.agent-icon-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.agent-tile-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--heading-color);
    letter-spacing: -0.02em;
}

.agent-tile-description {
    font-size: 0.95rem;
    color: var(--text-color);
    line-height: 1.6;
    flex-grow: 1;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.agent-tile-meta.border-top-dashed {
    border-top: 1px dashed var(--border-color);
    padding-top: 1rem;
}
/* Filled Button Style (Override Razor class) */
.agent-tile-footer .btn-outline-primary {
    background-color: var(--agent-color, var(--primary-color));
    border-color: var(--agent-color, var(--primary-color));
    color: #fff;
    border-radius: 50rem;
    padding: 0.6rem 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: none;
    transition: filter 0.2s;
}

    .agent-tile-footer .btn-outline-primary:hover {
        filter: brightness(1.1);
    }

.hover-primary:hover {
    color: var(--primary-color) !important;
}
