/* Admin AI Chat */
.tnv-ai-wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    background:
        radial-gradient(circle at 50% 32%, rgba(0, 184, 212, 0.08), transparent 30%),
        linear-gradient(180deg, #f7fbfc 0%, #ffffff 42%, #f8fafc 100%);
    font-family: 'Inter', 'Roboto', sans-serif;
    position: relative;
    overflow: hidden;
}

.tnv-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
    scroll-behavior: smooth;
}

.tnv-ai-messages-inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.tnv-ai-messages::-webkit-scrollbar { width: 6px; }
.tnv-ai-messages::-webkit-scrollbar-track { background: transparent; }
.tnv-ai-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
.tnv-ai-messages::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

.tnv-ai-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 26px 20px 20px;
    animation: fadeIn 0.5s ease-out;
}

.tnv-ai-welcome-logo {
    width: 150px;
    height: 124px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
}

.tnv-ai-welcome-logo:before {
    content: "";
    position: absolute;
    width: 128px;
    height: 54px;
    border-radius: 999px;
    background: rgba(0, 194, 168, 0.15);
    filter: blur(18px);
    bottom: 18px;
}

.tnv-ai-cloud-svg {
    width: 142px;
    height: 96px;
    position: relative;
    z-index: 2;
    overflow: visible;
    filter: drop-shadow(0 18px 28px rgba(0, 104, 127, 0.22));
}

.tnv-ai-cloud-svg path {
    fill: url(#tnv-ai-cloud-gradient);
    stroke: #008ea1;
    stroke-width: 13;
    stroke-linecap: round;
    stroke-linejoin: round;
    paint-order: stroke fill;
}

.tnv-ai-cloud-node {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #00c2a8;
    box-shadow: 0 0 0 5px rgba(0, 194, 168, 0.14), 0 0 24px rgba(0, 194, 168, 0.75);
    z-index: 3;
    animation: tnv-ai-node-pulse 2.4s ease-in-out infinite;
}

.tnv-ai-cloud-node-one {
    left: 14px;
    top: 62px;
}

.tnv-ai-cloud-node-two {
    right: 12px;
    top: 42px;
}

.tnv-ai-cloud-node-three {
    left: 72px;
    bottom: 4px;
}

.tnv-ai-logo-ring {
    position: absolute;
    width: 132px;
    height: 94px;
    border-radius: 50%;
    border: 1px solid rgba(0, 194, 168, 0.34);
    transform: rotate(-13deg);
    z-index: 1;
    animation: tnv-ai-ring 8s linear infinite;
}

.tnv-ai-logo-ring:before,
.tnv-ai-logo-ring:after {
    content: "";
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #eafffb;
    box-shadow: 0 0 18px rgba(0, 194, 168, 0.95);
}

.tnv-ai-logo-ring:before {
    left: 12px;
    top: 47px;
}

.tnv-ai-logo-ring:after {
    right: 18px;
    top: 18px;
}

.tnv-ai-logo-scan {
    position: absolute;
    width: 104px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(234,255,251,0.95), transparent);
    top: 68px;
    z-index: 4;
    box-shadow: 0 0 18px rgba(0, 194, 168, 0.55);
    animation: tnv-ai-scan 2.8s ease-in-out infinite;
}

.tnv-ai-logo-pulse {
    position: absolute;
    border-radius: 999px;
    border: 1px solid rgba(0, 104, 127, 0.18);
    z-index: 0;
}

.tnv-ai-logo-pulse-one {
    width: 148px;
    height: 82px;
    animation: tnv-ai-pulse 3.2s ease-in-out infinite;
}

.tnv-ai-logo-pulse-two {
    width: 118px;
    height: 118px;
    border-color: rgba(0, 194, 168, 0.16);
    transform: rotate(34deg);
    animation: tnv-ai-pulse 3.2s ease-in-out infinite 0.8s;
}

@keyframes tnv-ai-ring {
    from { transform: rotate(-13deg); }
    to { transform: rotate(347deg); }
}

@keyframes tnv-ai-scan {
    0%, 100% { opacity: 0.2; transform: translateY(-10px) scaleX(0.72); }
    50% { opacity: 1; transform: translateY(10px) scaleX(1); }
}

@keyframes tnv-ai-pulse {
    0%, 100% { opacity: 0.28; transform: scale(0.96); }
    50% { opacity: 0.75; transform: scale(1.04); }
}

@keyframes tnv-ai-node-pulse {
    0%, 100% { opacity: 0.72; transform: scale(0.92); }
    50% { opacity: 1; transform: scale(1.12); }
}

.tnv-ai-welcome-title {
    font-size: 34px;
    font-weight: 800;
    color: #07151d;
    margin: 0 0 10px;
    letter-spacing: 0;
}

.tnv-ai-welcome-sub {
    font-size: 16px;
    color: #43515c;
    margin: 0 0 28px;
    max-width: 650px;
    line-height: 1.55;
}

.tnv-ai-chips {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 600px;
}

.tnv-ai-chip {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #374151;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.tnv-ai-chip i {
    color: #00687f;
    font-size: 18px;
}

.tnv-ai-chip:hover {
    background: #f9fafb;
    border-color: #00687f;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 104, 127, 0.05);
}

.tnv-ai-turn {
    display: flex;
    gap: 20px;
    padding: 30px 0;
    border-bottom: 1px solid #f3f4f6;
    animation: fadeIn 0.3s ease-out;
}

.tnv-ai-turn:last-child { border-bottom: none; }

.tnv-ai-turn-user {
    justify-content: flex-end;
}

.tnv-ai-user-text {
    background: #f3f4f6;
    color: #111827;
    font-size: 15px;
    padding: 14px 20px;
    border-radius: 20px 20px 4px 20px;
    max-width: 80%;
    line-height: 1.6;
}

.tnv-ai-turn-ai {
    justify-content: flex-start;
}

.tnv-ai-bot-icon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    background:
        radial-gradient(circle at 50% 38%, rgba(234,255,251,0.18), transparent 34%),
        linear-gradient(145deg, rgba(7,21,29,0.96), rgba(0,63,80,0.96) 54%, rgba(0,104,127,0.98));
    border: 1px solid rgba(147, 240, 229, 0.34);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    position: relative;
    box-shadow:
        0 16px 34px rgba(0, 104, 127, 0.22),
        inset 0 1px 0 rgba(255,255,255,0.20),
        inset 0 -16px 30px rgba(0,0,0,0.16);
    overflow: hidden;
}

.tnv-ai-bot-icon:before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 12px;
    border: 1px solid rgba(234,255,251,0.18);
    background: linear-gradient(135deg, rgba(255,255,255,0.10), transparent 42%);
}

.tnv-ai-bot-icon:after {
    content: "";
    position: absolute;
    width: 64px;
    height: 64px;
    border: 1px solid rgba(147,240,229,0.20);
    border-radius: 50%;
    transform: rotate(-24deg) scaleY(0.56);
}

.tnv-ai-bot-orbit {
    position: absolute;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(234,255,251,0.24);
    border-radius: 50%;
    transform: rotate(28deg) scaleY(0.62);
    z-index: 2;
}

.tnv-ai-bot-core {
    width: 15px;
    height: 15px;
    position: relative;
    z-index: 3;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, #ffffff 0%, #dffefa 18%, #00c2a8 58%, #00687f 100%);
    box-shadow:
        0 0 0 5px rgba(0,194,168,0.08),
        0 0 24px rgba(0,194,168,0.72);
}

.tnv-ai-bot-node {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #eafffb;
    box-shadow: 0 0 12px rgba(234,255,251,0.9);
    z-index: 4;
}

.tnv-ai-bot-node-a {
    top: 12px;
    right: 13px;
}

.tnv-ai-bot-node-b {
    left: 12px;
    bottom: 13px;
}

.tnv-ai-bot-node-c {
    right: 15px;
    bottom: 12px;
    background: #00c2a8;
}

.tnv-ai-bot-core:before {
    content: "";
    position: absolute;
    width: 42px;
    height: 1px;
    left: -13px;
    top: 7px;
    background: linear-gradient(90deg, transparent, rgba(234,255,251,0.74), transparent);
    transform: rotate(-18deg);
}

.tnv-ai-response {
    flex: 1;
    min-width: 0;
    color: #1f2937;
}

.tnv-ai-response-body {
    font-size: 15px;
    line-height: 1.7;
}

.tnv-ai-response-body p { margin: 0 0 16px; }
.tnv-ai-response-body p:last-child { margin-bottom: 0; }
.tnv-ai-response-body strong { color: #111827; font-weight: 600; }

.tnv-ai-response-body ul {
    margin: 12px 0 16px;
    padding-left: 24px;
}

.tnv-ai-response-body li { margin-bottom: 6px; }

.tnv-ai-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.tnv-ai-table th {
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    border-bottom: 1px solid #e5e7eb;
}

.tnv-ai-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

.tnv-ai-table tr:last-child td { border-bottom: none; }
.tnv-ai-table tr:hover td { background: #f9fafb; }

.tnv-ai-sql {
    margin-top: 20px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.tnv-ai-sql summary {
    cursor: pointer;
    color: #4b5563;
    font-size: 13px;
    font-weight: 500;
    padding: 12px 16px;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f3f4f6;
}

.tnv-ai-sql summary:hover { color: #00687f; }

.tnv-ai-sql pre {
    margin: 0;
    padding: 16px;
    font-size: 13px;
    color: #1f2937;
    overflow-x: auto;
    border-top: 1px solid #e5e7eb;
    font-family: 'Consolas', 'Monaco', monospace;
}

.tnv-ai-typing {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 0;
}

.tnv-ai-typing span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: tnv-bounce 1.4s infinite ease-in-out both;
}

.tnv-ai-typing span:nth-child(1) { animation-delay: -0.32s; }
.tnv-ai-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes tnv-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); background: #00687f; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tnv-ai-input-area {
    background: linear-gradient(180deg, rgba(248,250,252,0) 0%, rgba(248,250,252,0.94) 24%, rgba(248,250,252,1) 100%);
    padding: 10px 20px 14px;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.tnv-ai-input-wrapper {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 16px;
}

.tnv-ai-input-box {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid rgba(0, 104, 127, 0.18);
    border-radius: 18px;
    padding: 8px 8px 8px 18px;
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.10), inset 0 1px 0 rgba(255,255,255,0.9);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.tnv-ai-input-box:before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(0, 194, 168, 0.10), transparent 35%, rgba(0, 104, 127, 0.08));
}

.tnv-ai-input-box:focus-within {
    border-color: rgba(0, 194, 168, 0.75);
    box-shadow: 0 0 0 4px rgba(0, 194, 168, 0.12), 0 22px 52px rgba(0, 104, 127, 0.16);
}

.tnv-ai-textarea {
    flex: 1;
    background: transparent !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    min-height: 0;
    resize: none;
    font-size: 15px;
    line-height: 1.45;
    color: #111827;
    max-height: 120px;
    padding: 8px 0;
    margin-right: 12px;
    position: relative;
    z-index: 1;
}

.tnv-ai-textarea::placeholder { color: #77838f; }

.tnv-ai-send {
    width: 48px;
    height: 48px;
    background:
        radial-gradient(circle at 72% 18%, rgba(234,255,251,0.35), transparent 18%),
        linear-gradient(145deg, #07151d 0%, #00687f 58%, #00c2a8 100%);
    color: #fff;
    border: 1px solid rgba(147,240,229,0.34);
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    box-shadow:
        0 16px 34px rgba(0, 104, 127, 0.24),
        inset 0 1px 0 rgba(255,255,255,0.22);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.tnv-ai-send:before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 12px;
    border: 1px solid rgba(234,255,251,0.16);
}

.tnv-ai-send:after {
    content: "";
    position: absolute;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: conic-gradient(from 210deg, transparent, rgba(234,255,251,0.26), transparent 34%);
    opacity: 0.75;
}

.tnv-ai-send-aura {
    position: absolute;
    inset: -18px;
    background: radial-gradient(circle, rgba(0,194,168,0.26), transparent 56%);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.tnv-ai-send-glyph {
    width: 18px;
    height: 18px;
    position: relative;
    z-index: 2;
    transform: translateX(-1px) rotate(-35deg);
}

.tnv-ai-send-glyph:before {
    content: "";
    position: absolute;
    inset: 1px 2px 1px 1px;
    background: linear-gradient(135deg, #ffffff, #dffefa);
    clip-path: polygon(0 42%, 100% 0, 62% 100%, 48% 56%);
    filter: drop-shadow(0 0 10px rgba(234,255,251,0.55));
}

.tnv-ai-send-glyph:after {
    content: "";
    position: absolute;
    width: 11px;
    height: 1px;
    left: 4px;
    top: 9px;
    background: rgba(0,104,127,0.42);
    transform: rotate(29deg);
}

.tnv-ai-send:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: rgba(234,255,251,0.52);
    box-shadow:
        0 22px 44px rgba(0, 104, 127, 0.32),
        0 0 0 4px rgba(0,194,168,0.10),
        inset 0 1px 0 rgba(255,255,255,0.28);
}

.tnv-ai-send:hover:not(:disabled) .tnv-ai-send-aura {
    opacity: 1;
}

.tnv-ai-send:hover:not(:disabled) .tnv-ai-send-glyph {
    transform: translate(1px, -1px) rotate(-35deg);
}

.tnv-ai-send:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    border-color: transparent;
    cursor: not-allowed;
    box-shadow: none;
}

.tnv-ai-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding: 0 8px;
    font-size: 12px;
}

.tnv-ai-hint {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tnv-ai-new-btn {
    background: none;
    border: none;
    color: #4b5563;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.tnv-ai-new-btn:hover { color: #00687f; }

@media (max-width: 767px) {
    .tnv-ai-welcome-title { font-size: 26px; }
    .tnv-ai-welcome-sub { font-size: 14px; }
    .tnv-ai-input-wrapper { padding: 0; }
    .tnv-ai-footer-row { flex-direction: column; gap: 8px; align-items: flex-start; }
}

.tnv-ai-actions {
    margin-top: 12px;
}

.tnv-ai-action-btn {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #4b5563;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.tnv-ai-action-btn:hover {
    color: #00687f;
    border-color: #00687f;
    background: #f0f7f9;
}
