/* Define animatable gradient angle property */
@property --gradient-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@property --gradient-angle-2 {
    syntax: '<angle>';
    initial-value: 180deg;
    inherits: false;
}



body {
    font-family: var(--font-body);
    font-weight: 400;
    letter-spacing: 0.3px;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Hexagonal background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.05;
    background-image: url('data:image/svg+xml;utf8,<svg width="100" height="87" xmlns="http://www.w3.org/2000/svg"><polygon points="50,10 90,30 90,70 50,90 10,70 10,30" fill="none" stroke="%2300b8d4" stroke-width="1"/></svg>');
    background-size: 100px 87px;
    pointer-events: none;
}

/* Animated energy field */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: radial-gradient(
            circle at 20% 50%,
            rgba(0, 229, 255, 0.03) 0%,
            transparent 40%
    ),
    radial-gradient(
            circle at 80% 50%,
            rgba(255, 149, 0, 0.02) 0%,
            transparent 40%
    );
    animation: energyPulse 8s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes energyPulse {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

/* Header */
.header {
    background: linear-gradient(
            135deg,
            var(--bg-secondary) 0%,
            rgba(0, 180, 212, 0.1) 100%
    );
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    border-bottom: 2px solid var(--cyan-medium);
    box-shadow:
            0 2px 20px rgba(0, 229, 255, 0.2),
            inset 0 -2px 10px rgba(0, 229, 255, 0.1);
    position: relative;
    flex-shrink: 0;
    height: 64px;
    z-index: 1;

    /* Angular corner decoration */
    clip-path: polygon(
            0 0,
            100% 0,
            100% calc(100% - 8px),
            calc(100% - 8px) 100%,
            0 100%
    );
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    background: linear-gradient(90deg, rgba(0, 229, 255, 0.15), transparent);
    position: relative;
}

.header-title {
    font-size: 1.4rem;
    font-weight: 700;
    font-family: var(--font-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--cyan-bright);
    text-shadow:
            0 0 10px var(--cyan-glow),
            0 0 20px var(--cyan-glow);
    position: relative;
}

/* Monitor Core Icon */
.monitor-core {
    width: 28px;
    height: 32px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.monitor-core::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background:
            conic-gradient(
                    from 0deg,
                    var(--cyan-bright),
                    var(--orange-bright),
                    var(--cyan-bright)
            );
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    animation: coreRotate 8s linear infinite;
    filter: blur(1px);
}

.monitor-core::after {
    content: '';
    position: absolute;
    width: 50%;
    height: 50%;
    background: var(--cyan-bright);
    clip-path: circle(50%);
    box-shadow:
            0 0 15px var(--cyan-bright),
            inset 0 0 10px rgba(255, 255, 255, 0.5);
    animation: corePulse 2s ease-in-out infinite;
}

@keyframes coreRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes corePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.header-title .subtitle {
    font-size: 0.5em;
    display: block;
    margin-top: -4px;
    letter-spacing: 2px;
    font-weight: 500;
    color: var(--text-secondary);
    text-shadow: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
}

.user-email {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
    position: relative;
    padding-left: 20px;
}

/* User status indicator */
.user-email::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--success);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    box-shadow: 0 0 10px var(--success);
    animation: statusBlink 2s ease-in-out infinite;
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.btn {
    padding: 10px 20px;
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-primary);
    letter-spacing: 1px;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;

    /* Angular shape */
    clip-path: polygon(
            4px 0,
            100% 0,
            100% calc(100% - 4px),
            calc(100% - 4px) 100%,
            0 100%,
            0 4px
    );
}

/* Scan-line effect on buttons */
.btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
            to bottom,
            transparent 0%,
            rgba(255, 255, 255, 0.1) 50%,
            transparent 100%
    );
    transform: translateY(-100%);
    transition: transform 0.6s ease;
}

.btn:hover::before {
    transform: translateY(100%);
}

.btn-primary {
    background: linear-gradient(135deg, var(--cyan-medium), var(--cyan-dark));
    color: var(--text-primary);
    border: 1px solid var(--cyan-bright);
    box-shadow:
            0 0 15px var(--cyan-glow),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--cyan-bright), var(--cyan-medium));
    box-shadow:
            0 0 25px var(--cyan-glow),
            0 0 40px rgba(0, 229, 255, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    border-color: var(--cyan-medium);
    box-shadow:
            0 0 15px rgba(0, 180, 212, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

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

.btn-ghost:hover {
    color: var(--cyan-bright);
    border-color: var(--border-subtle);
    background: rgba(0, 180, 212, 0.1);
    text-shadow: 0 0 10px var(--cyan-glow);
}

/* Main Layout */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(
            180deg,
            rgba(20, 35, 50, 0.95) 0%,
            rgba(10, 20, 35, 0.98) 100%
    );
    border-right: 2px solid var(--cyan-medium);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;

    /* Hexagonal pattern overlay */
    background-image:
            linear-gradient(
                    180deg,
                    rgba(20, 35, 50, 0.95) 0%,
                    rgba(10, 20, 35, 0.98) 100%
            ),
            repeating-linear-gradient(
                    60deg,
                    transparent,
                    transparent 40px,
                    rgba(0, 180, 212, 0.03) 40px,
                    rgba(0, 180, 212, 0.03) 42px
            );

    box-shadow:
            inset -2px 0 20px rgba(0, 229, 255, 0.1),
            2px 0 30px rgba(0, 0, 0, 0.5);
}

/* Animated side glow */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(
            180deg,
            transparent 0%,
            var(--cyan-bright) 50%,
            transparent 100%
    );
    animation: sidebarGlow 3s ease-in-out infinite;
}

@keyframes sidebarGlow {
    0%, 100% { transform: translateY(-50%); }
    50% { transform: translateY(50%); }
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-medium);
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.1), transparent);
    position: relative;
}

.sidebar-header::after {
    content: 'SESSION ARCHIVE';
    position: absolute;
    top: 6px;
    left: 16px;
    font-size: 0.65rem;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 600;
    font-family: var(--font-primary);
}

.new-chat-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    margin-top: 16px;
    font-size: 0.8rem;
}

/* Plus icon enhancement */
.new-chat-btn span:first-child {
    font-size: 1.2rem;
    font-weight: 700;
    text-shadow: 0 0 10px var(--cyan-bright);
}

.session-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
}

.session-item {
    padding: 10px 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    background: rgba(20, 35, 50, 0.3);
    border: 1px solid transparent;

    /* Angular cut on bottom-right */
    clip-path: polygon(
            0 0,
            100% 0,
            100% calc(100% - 6px),
            calc(100% - 6px) 100%,
            0 100%
    );
}

.session-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--cyan-medium);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.session-item:hover {
    background: rgba(0, 180, 212, 0.15);
    border-color: var(--border-subtle);
    transform: translateX(4px);
}

.session-item:hover::before {
    transform: scaleY(1);
}

.session-item.active {
    background: linear-gradient(90deg, rgba(0, 229, 255, 0.2), rgba(0, 180, 212, 0.1));
    border-color: var(--cyan-medium);
    box-shadow:
            0 0 15px rgba(0, 229, 255, 0.2),
            inset 0 0 20px rgba(0, 229, 255, 0.05);
}

.session-item.active::before {
    transform: scaleY(1);
    box-shadow: 0 0 10px var(--cyan-bright);
}

.session-title {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.session-item.active .session-title {
    color: var(--cyan-bright);
    text-shadow: 0 0 8px var(--cyan-glow);
}

.session-delete {
    opacity: 0;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    transition: all 0.2s;
    font-size: 1rem;
}

.session-item:hover .session-delete {
    opacity: 1;
}

.session-delete:hover {
    color: var(--error);
    text-shadow: 0 0 10px var(--error);
    transform: rotate(90deg);
}

/* Chat Area */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    opacity: 0.95;

    /* Subtle grid background */
    background-image:
            linear-gradient(var(--bg-primary) 0%, var(--bg-primary) 100%),
            repeating-linear-gradient(
                    0deg,
                    transparent,
                    transparent 30px,
                    rgba(0, 180, 212, 0.02) 30px,
                    rgba(0, 180, 212, 0.02) 31px
            ),
            repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 30px,
                    rgba(0, 180, 212, 0.02) 30px,
                    rgba(0, 180, 212, 0.02) 31px
            );
}

.message {
    max-width: 80%;
    animation: messageAppear 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-bubble {
    padding: 14px 18px;
    font-size: 0.95rem;
    line-height: 1.6;
    position: relative;
}

/* USER MESSAGE - Angular holographic panel */
.message.user .message-bubble {
    background: linear-gradient(
            135deg,
            rgba(0, 180, 212, 0.2) 0%,
            rgba(0, 180, 212, 0.1) 100%
    );
    border: 1px solid var(--cyan-medium);
    position: relative;

    /* Angular clip */
    clip-path: polygon(
            6px 0,
            100% 0,
            100% calc(100% - 6px),
            calc(100% - 6px) 100%,
            0 100%,
            0 6px
    );

    box-shadow:
            0 4px 20px rgba(0, 229, 255, 0.15),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

/* Corner accent marker */
.message.user .message-bubble::before {
    content: '';
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    background: var(--cyan-bright);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
    box-shadow: 0 0 10px var(--cyan-bright);
}

/* ASSISTANT MESSAGE - Monitor transmission panel */
.message.assistant .message-bubble {
    background: linear-gradient(
            135deg,
            rgba(20, 35, 50, 0.8) 0%,
            rgba(15, 25, 40, 0.9) 100%
    );
    padding: 16px 20px;
    border: 1px solid var(--border-medium);
    position: relative;
    overflow: hidden; /* Contain the scan-line animation within the bubble */

    /* Angular clip (opposite corner) */
    clip-path: polygon(
            0 0,
            calc(100% - 6px) 0,
            100% 6px,
            100% 100%,
            6px 100%,
            0 calc(100% - 6px)
    );

    box-shadow:
            0 4px 25px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(0, 229, 255, 0.1);
    backdrop-filter: blur(8px);
}

/* Monitor signature marker */
.message.assistant .message-bubble::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    width: 40px;
    height: 3px;
    background: linear-gradient(90deg, var(--cyan-bright), transparent);
    box-shadow: 0 0 10px var(--cyan-bright);
}

/* Scan-line animation on assistant messages */
.message.assistant .message-bubble::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
            180deg,
            transparent 0%,
            rgba(0, 229, 255, 0.05) 50%,
            transparent 100%
    );
    pointer-events: none;
    animation: scanLine 3s linear infinite;
}

@keyframes scanLine {
    from { transform: translateY(-100%); }
    to { transform: translateY(100%); }
}

.message-content {
    word-wrap: break-word;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

/* Message Metadata - Timestamp and Sender */
.message-metadata {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.message:hover .message-metadata {
    opacity: 1;
}

.message.user .message-metadata {
    justify-content: flex-end;
    text-align: right;
}

.message.assistant .message-metadata {
    justify-content: flex-start;
    text-align: left;
}

.message-sender {
    color: var(--text-secondary);
    font-weight: 500;
}

.message.user .message-sender {
    color: var(--cyan-medium);
}

.message.assistant .message-sender {
    color: var(--orange-medium);
}

.metadata-separator {
    color: var(--border-medium);
    opacity: 0.5;
}

.message-timestamp {
    cursor: help;
}

.message-timestamp:hover {
    color: var(--text-secondary);
}

.message-content code {
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.85em;
}

.message-content pre {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
    font-family: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    display: block;
    color: var(--text-primary);
}

/* Markdown Headers */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.message-content h1 {
    font-size: 1.75rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 8px;
}

.message-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

.message-content h3 {
    font-size: 1.25rem;
}

.message-content h4 {
    font-size: 1.1rem;
}

.message-content h5 {
    font-size: 1rem;
}

.message-content h6 {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Lists */
.message-content ul,
.message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-content li {
    margin: 4px 0;
    line-height: 1.6;
}

.message-content ul ul,
.message-content ol ol,
.message-content ul ol,
.message-content ol ul {
    margin: 4px 0;
}

.message-content li > p {
    margin: 4px 0;
}

/* Links */
.message-content a {
    color: var(--cyan-bright);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
    text-shadow: 0 0 10px rgba(0, 229, 255, 0);
}

.message-content a:hover {
    border-bottom-color: var(--cyan-bright);
    text-shadow: 0 0 10px var(--cyan-glow);
}

/* Images */
.message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
    display: block;
}

/* Blockquotes - Monitor Citations */
.message-content blockquote {
    margin: 16px 0;
    padding: 12px 16px;
    padding-left: 28px;
    border-left: 4px solid var(--orange-medium);
    background: linear-gradient(
            90deg,
            rgba(255, 149, 0, 0.15) 0%,
            rgba(255, 149, 0, 0.05) 100%
    );
    color: var(--text-secondary);
    font-style: italic;
    position: relative;
    clip-path: polygon(
            0 0,
            100% 0,
            100% calc(100% - 6px),
            calc(100% - 6px) 100%,
            0 100%
    );
}

.message-content blockquote::before {
    content: '▸';
    position: absolute;
    left: 8px;
    top: 12px;
    color: var(--orange-bright);
    font-size: 1.2rem;
    text-shadow: 0 0 10px var(--orange-glow);
}

.message-content blockquote p {
    margin: 4px 0;
}

/* Tables - Data Matrices */
.message-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 16px 0;
    font-size: 0.875rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-medium);
    overflow: hidden;

    clip-path: polygon(
            6px 0,
            calc(100% - 6px) 0,
            100% 6px,
            100% calc(100% - 6px),
            calc(100% - 6px) 100%,
            6px 100%,
            0 calc(100% - 6px),
            0 6px
    );
}

.message-content thead {
    background: linear-gradient(
            135deg,
            rgba(0, 180, 212, 0.3),
            rgba(0, 180, 212, 0.15)
    );
}

.message-content th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid var(--cyan-medium);
    color: var(--cyan-bright);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.75rem;
    font-family: var(--font-primary);
}

.message-content td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.message-content tr:last-child td {
    border-bottom: none;
}

.message-content tbody tr:hover {
    background: rgba(0, 180, 212, 0.08);
    color: var(--text-primary);
}

/* Accent line on first column */
.message-content td:first-child {
    border-left: 2px solid transparent;
}

.message-content tbody tr:hover td:first-child {
    border-left-color: var(--cyan-medium);
}

/* Horizontal Rule */
.message-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

/* Task Lists (GFM) */
.message-content input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
}

/* Strikethrough (GFM) */
.message-content del {
    color: var(--text-secondary);
}

/* Strong/Emphasis */
.message-content strong {
    font-weight: 600;
    color: var(--text-primary);
}

.message-content em {
    font-style: italic;
    color: var(--text-secondary);
}

/* Highlight.js overrides for dark theme consistency */
.message-content .hljs {
    background: transparent;
    color: var(--text-primary);
}

/* Inline code - Cyan holographic */
.message-content code:not(.hljs) {
    background: rgba(0, 180, 212, 0.1);
    padding: 2px 8px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.875em;
    color: var(--cyan-bright);
    border: 1px solid rgba(0, 180, 212, 0.3);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.1);
}

/* Code blocks - Terminal style */
.message-content pre {
    background: linear-gradient(
            135deg,
            rgba(0, 0, 0, 0.6) 0%,
            rgba(10, 20, 30, 0.8) 100%
    );
    padding: 16px;
    padding-top: 40px;  /* Space for terminal header */
    margin: 12px 0;
    border: 1px solid var(--border-medium);
    max-height: 600px;
    overflow-y: auto;
    position: relative;

    /* Angular clip */
    clip-path: polygon(
            6px 0,
            calc(100% - 6px) 0,
            100% 6px,
            100% calc(100% - 6px),
            calc(100% - 6px) 100%,
            6px 100%,
            0 calc(100% - 6px),
            0 6px
    );

    box-shadow:
            0 4px 20px rgba(0, 0, 0, 0.4),
            inset 0 1px 0 rgba(0, 229, 255, 0.1);
}

/* Terminal-style header */
.message-content pre::before {
    content: '> TERMINAL_OUTPUT';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px 16px;
    background: rgba(0, 180, 212, 0.2);
    border-bottom: 1px solid var(--cyan-dark);
    font-size: 0.7rem;
    letter-spacing: 1px;
    color: var(--cyan-medium);
    font-family: var(--font-mono);
}

/* Paragraph spacing */
.message-content p {
    margin: 8px 0;
}

.message-content p:first-child {
    margin-top: 0;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Tool Calls - Energy Containment Fields */
.tool-call {
    background: linear-gradient(
            135deg,
            rgba(10, 25, 40, 0.9) 0%,
            rgba(15, 30, 45, 0.95) 100%
    );
    border: 1px solid var(--orange-medium);
    margin: 12px 0;
    overflow: hidden;
    position: relative;

    /* Hexagonal clip for containment field */
    clip-path: polygon(
            8px 0,
            calc(100% - 8px) 0,
            100% 8px,
            100% calc(100% - 8px),
            calc(100% - 8px) 100%,
            8px 100%,
            0 calc(100% - 8px),
            0 8px
    );

    box-shadow:
            0 4px 20px rgba(255, 149, 0, 0.2),
            inset 0 1px 0 rgba(255, 149, 0, 0.2);
}

/* Animated energy field border */
.tool-call::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid transparent;
    background: linear-gradient(
            45deg,
            var(--orange-bright),
            var(--orange-dark),
            var(--orange-bright)
    ) border-box;
    -webkit-mask:
            linear-gradient(#fff 0 0) padding-box,
            linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tool-call:hover::before {
    opacity: 1;
}

.tool-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 149, 0, 0.05);
    position: relative;
}

.tool-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(
            90deg,
            transparent 0%,
            var(--orange-medium) 50%,
            transparent 100%
    );
}

.tool-header:hover {
    background: rgba(255, 149, 0, 0.1);
}

.tool-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.875rem;
    font-family: var(--font-primary);
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--orange-bright);
}

/* Tool icon as geometric shape */
.tool-icon {
    font-size: 0;  /* Hide emoji */
    width: 20px;
    height: 20px;
    position: relative;
    display: inline-flex;
}

.tool-icon::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--orange-bright);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    animation: toolRotate 4s linear infinite;
}

.tool-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40%;
    height: 40%;
    background: var(--bg-primary);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

@keyframes toolRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.tool-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-family: var(--font-mono);
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 3px;
}

.tool-status.pending {
    color: var(--warning);
    background: rgba(255, 196, 0, 0.1);
    border: 1px solid var(--warning);
    animation: statusPulse 1.5s ease-in-out infinite;
}

.tool-status.success {
    color: var(--success);
    background: rgba(0, 230, 118, 0.1);
    border: 1px solid var(--success);
}

.tool-status.error {
    color: var(--error);
    background: rgba(255, 61, 0, 0.1);
    border: 1px solid var(--error);
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.tool-details {
    border-top: 1px solid var(--orange-dark);
    padding: 16px;
    display: none;
    background: rgba(10, 15, 25, 0.6);
}

.tool-details.expanded {
    display: block;
    animation: detailsExpand 0.3s ease-out;
}

@keyframes detailsExpand {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.tool-section {
    margin-bottom: 12px;
}

.tool-section:last-child {
    margin-bottom: 0;
}

.tool-section-label {
    font-size: 0.7rem;
    color: var(--orange-medium);
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 1.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-primary);
}

.tool-section-label::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--orange-bright);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    box-shadow: 0 0 8px var(--orange-bright);
}

.tool-section-content {
    background: rgba(0, 0, 0, 0.4);
    padding: 12px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

/* Thinking Indicator - Analyzing State */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(
            135deg,
            rgba(0, 180, 212, 0.15) 0%,
            rgba(0, 180, 212, 0.05) 100%
    );
    clip-path: polygon(
            0 0,
            calc(100% - 6px) 0,
            100% 6px,
            100% 100%,
            6px 100%,
            0 calc(100% - 6px)
    );
    font-size: 0.875rem;
    color: var(--cyan-bright);
    font-family: var(--font-mono);
    letter-spacing: 1px;
    border: 1px solid var(--cyan-medium);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.2);
    position: relative;
}

/* Scan-line effect */
.thinking-indicator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(
            90deg,
            transparent 0%,
            var(--cyan-bright) 50%,
            transparent 100%
    );
    animation: thinkingScan 2s linear infinite;
}

@keyframes thinkingScan {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

.thinking-dots {
    display: flex;
    gap: 6px;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    background: var(--cyan-bright);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    animation: thinkingPulse 1.4s infinite ease-in-out;
    box-shadow: 0 0 10px var(--cyan-bright);
}

.thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinkingPulse {
    0%, 80%, 100% {
        transform: scale(0.8) rotate(0deg);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2) rotate(45deg);
        opacity: 1;
    }
}

.thinking-label {
    text-transform: uppercase;
    font-weight: 600;
}

/* Input Area - Transmission Console */
.input-area {
    padding: 14px 8px;
    background: linear-gradient(
            180deg,
            rgba(10, 20, 35, 0.95) 0%,
            rgba(15, 25, 40, 0.98) 100%
    );
    border-top: 2px solid var(--cyan-medium);
    box-shadow:
            0 -4px 30px rgba(0, 0, 0, 0.5),
            inset 0 2px 20px rgba(0, 229, 255, 0.1);
    flex-shrink: 0;
    position: relative;
}

.input-area::before {
    content: 'TRANSMISSION CONSOLE';
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 0.65rem;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 600;
    font-family: var(--font-primary);
}

.input-container {
    display: flex;
    gap: 12px;
    max-width: 1000px;
    margin: 0 auto;
    margin-top: 10px;
}

.message-input {
    flex: 1;
    background: rgba(15, 25, 40, 0.9);
    border: 1px solid var(--border-medium);
    padding: 14px 18px;
    font-size: 0.95rem;
    color: var(--text-primary);
    resize: none;
    min-height: 52px;
    max-height: 200px;
    font-family: var(--font-body);
    line-height: 1.5;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;

    /* Angular clip */
    clip-path: polygon(
            6px 0,
            calc(100% - 6px) 0,
            100% 6px,
            100% calc(100% - 6px),
            calc(100% - 6px) 100%,
            6px 100%,
            0 calc(100% - 6px),
            0 6px
    );

    box-shadow:
            inset 0 2px 10px rgba(0, 0, 0, 0.3),
            0 0 0 rgba(0, 229, 255, 0);
}

.message-input:focus {
    outline: none;
    border-color: var(--cyan-bright);
    box-shadow:
            inset 0 2px 10px rgba(0, 0, 0, 0.3),
            0 0 20px rgba(0, 229, 255, 0.3),
            0 0 40px rgba(0, 229, 255, 0.1);
    background: rgba(20, 35, 50, 0.95);
}

.message-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* Scan-line effect while typing */
.message-input:not(:placeholder-shown) {
    background-image:
            linear-gradient(rgba(15, 25, 40, 0.9), rgba(15, 25, 40, 0.9)),
            repeating-linear-gradient(
                    0deg,
                    transparent,
                    transparent 2px,
                    rgba(0, 229, 255, 0.03) 2px,
                    rgba(0, 229, 255, 0.03) 4px
            );
}

.send-btn {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}

/* Replace arrow with holographic symbol */
.send-btn::before {
    content: '▶';
    position: absolute;
    font-size: 1.2rem;
    color: var(--text-primary);
    text-shadow: 0 0 10px var(--cyan-bright);
    transition: all 0.3s ease;
}

.send-btn:hover::before {
    transform: translateX(3px) scale(1.1);
    color: var(--cyan-bright);
    text-shadow:
            0 0 15px var(--cyan-bright),
            0 0 30px var(--cyan-glow);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.send-btn:disabled::before {
    transform: none;
}

/* Metrics Bar - HUD Display */
.metrics-bar {
    display: flex;
    gap: 24px;
    justify-content: center;
    padding: 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: linear-gradient(
            90deg,
            rgba(0, 180, 212, 0.05) 0%,
            rgba(0, 180, 212, 0.1) 50%,
            rgba(0, 180, 212, 0.05) 100%
    );
    border-top: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    letter-spacing: 1px;
    position: relative;
}

.metrics-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(
            90deg,
            transparent 0%,
            var(--cyan-medium) 50%,
            transparent 100%
    );
}

.metric {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    clip-path: polygon(
            3px 0,
            calc(100% - 3px) 0,
            100% 3px,
            100% calc(100% - 3px),
            calc(100% - 3px) 100%,
            3px 100%,
            0 calc(100% - 3px),
            0 3px
    );
}

.metric::before {
    content: '◆';
    color: var(--cyan-medium);
    font-size: 0.6rem;
    text-shadow: 0 0 8px var(--cyan-glow);
}

/* Empty State - Monitor Introduction */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-align: center;
    padding: 60px 40px;
    position: relative;
}

/* Animated Forerunner symbol instead of emoji */
.empty-state-icon {
    font-size: 0;  /* Hide emoji */
    width: 120px;
    height: 120px;
    position: relative;
    margin-bottom: 32px;
}

/* Outer rotating hexagon ring - Dynamic fluid gradient */
.empty-state-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    --gradient-angle: 0deg;
    --gradient-angle-2: 180deg;
    background:
            conic-gradient(
                    from var(--gradient-angle),
                    var(--cyan-bright) 0deg,
                    #00fff2 45deg,
                    var(--cyan-medium) 90deg,
                    var(--orange-bright) 135deg,
                    #ffb84d 180deg,
                    var(--orange-medium) 225deg,
                    var(--cyan-medium) 270deg,
                    #00d4e6 315deg,
                    var(--cyan-bright) 360deg
            ),
            conic-gradient(
                    from var(--gradient-angle-2),
                    transparent 0deg,
                    rgba(0, 229, 255, 0.3) 90deg,
                    transparent 180deg,
                    rgba(255, 149, 0, 0.3) 270deg,
                    transparent 360deg
            );
    background-blend-mode: normal, screen;
    clip-path: polygon(
            50% 0%,
            93.3% 25%,
            93.3% 75%,
            50% 100%,
            6.7% 75%,
            6.7% 25%
    );
    animation: emptyIconRotate 12s linear infinite, rotateGradient 8s linear infinite, gradientShift 6s ease-in-out infinite;
    filter: drop-shadow(0 0 15px var(--cyan-glow)) brightness(1.1);
    z-index: 1;
}

@keyframes rotateGradient {
    0% {
        --gradient-angle: 0deg;
        --gradient-angle-2: 180deg;
    }
    100% {
        --gradient-angle: -360deg;
        --gradient-angle-2: -180deg;
    }
}

@keyframes gradientShift {
    0%, 100% {
        filter: drop-shadow(0 0 15px var(--cyan-glow)) brightness(1.1) hue-rotate(0deg) saturate(1);
    }
    25% {
        filter: drop-shadow(0 0 20px var(--cyan-glow)) brightness(1.2) hue-rotate(10deg) saturate(1.15);
    }
    50% {
        filter: drop-shadow(0 0 18px var(--orange-glow)) brightness(1.15) hue-rotate(-8deg) saturate(1.1);
    }
    75% {
        filter: drop-shadow(0 0 22px var(--cyan-glow)) brightness(1.18) hue-rotate(15deg) saturate(1.2);
    }
}

/* Middle hexagon - counter-rotating with blend modes */
.empty-state-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 70%;
    background: rgba(13, 28, 29, 1);
    clip-path: polygon(
            50% 5%,
            90% 30%,
            90% 70%,
            50% 95%,
            10% 70%,
            10% 30%
    );
    border: 2px solid var(--cyan-medium);
    box-shadow:
            inset 0 0 30px rgba(0, 229, 255, 0.3),
            0 0 20px rgba(0, 229, 255, 0.2);
    filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.4));
    z-index: 2;

    /* Counter-rotate and blend */
    animation: emptyIconRotateReverse 12s linear infinite;
    mix-blend-mode: normal;
}

@keyframes emptyIconRotateReverse {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(-360deg); }
}

/* Pulsing center core - rotating opposite direction */
.empty-state-icon > .core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: radial-gradient(
            circle at 30% 30%,
            rgba(255, 255, 255, 0.9),
            var(--cyan-bright) 50%,
            var(--cyan-medium)
    );
    border-radius: 50%;
    box-shadow:
            0 0 20px var(--cyan-bright),
            0 0 40px var(--cyan-glow),
            inset 0 0 10px rgba(255, 255, 255, 0.8);
    animation: emptyIconPulse 2s ease-in-out infinite, coreCounterRotate 8s ease-in-out infinite;
    filter: drop-shadow(0 0 8px var(--cyan-bright))
    drop-shadow(0 0 15px var(--cyan-glow))
    brightness(1.3)
    saturate(1.2);
    z-index: 3;
}

/* Counter-clockwise rotation for core with pulsing scale */
@keyframes coreCounterRotate {
    0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
    25% { transform: translate(-50%, -50%) rotate(-90deg) scale(1.3); }
    50% { transform: translate(-50%, -50%) rotate(-180deg) scale(1); }
    75% { transform: translate(-50%, -50%) rotate(-270deg) scale(1.3); }
    100% { transform: translate(-50%, -50%) rotate(-360deg) scale(1); }
}

@keyframes emptyIconRotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes emptyIconPulse {
    0%, 100% {
        opacity: 1;
        filter: drop-shadow(0 0 8px var(--cyan-bright))
        drop-shadow(0 0 15px var(--cyan-glow))
        brightness(1.3)
        saturate(1.2);
    }
    50% {
        opacity: 0.85;
        filter: drop-shadow(0 0 20px var(--cyan-bright))
        drop-shadow(0 0 35px var(--cyan-glow))
        brightness(1.5)
        saturate(1.4);
    }
}

.empty-state h2 {
    font-size: 1.8rem;
    margin-bottom: 16px;
    color: var(--cyan-bright);
    font-family: var(--font-primary);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 20px var(--cyan-glow);
}

.empty-state h2::before {
    content: '[ ';
    color: var(--orange-bright);
}

.empty-state h2::after {
    content: ' ]';
    color: var(--orange-bright);
}

.empty-state p {
    max-width: 500px;
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 1rem;
}

/* System Status Display */
#system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    font-family: var(--font-mono);
}

.status-badge {
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.status-badge.unlocked {
    color: var(--success);
    background: rgba(0, 230, 118, 0.15);
    border: 1px solid var(--success);
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.3);
}

.status-badge.locked {
    color: var(--error);
    background: rgba(255, 61, 0, 0.15);
    border: 1px solid var(--error);
    box-shadow: 0 0 8px rgba(255, 61, 0, 0.3);
    animation: lockedPulse 2s ease-in-out infinite;
}

@keyframes lockedPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.status-sep {
    color: var(--text-muted);
}

#status-containers {
    color: var(--text-secondary);
}

/* Scrollbar - Forerunner themed */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-left: 1px solid var(--border-subtle);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(
            180deg,
            var(--cyan-dark),
            var(--cyan-medium)
    );
    border: 1px solid var(--cyan-medium);
    box-shadow: inset 0 0 6px rgba(0, 229, 255, 0.3);

    /* Angular corners */
    clip-path: polygon(
            0 4px,
            4px 0,
            100% 0,
            100% calc(100% - 4px),
            calc(100% - 4px) 100%,
            0 100%
    );
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
            180deg,
            var(--cyan-medium),
            var(--cyan-bright)
    );
    box-shadow:
            inset 0 0 10px rgba(0, 229, 255, 0.5),
            0 0 10px var(--cyan-glow);
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 64px;
        height: calc(100% - 64px);
        z-index: 100;
        transition: left 0.3s ease;
    }

    .sidebar.mobile-open {
        left: 0;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.8);
    }

    .message {
        max-width: 95%;
    }

    .header-title .subtitle {
        display: none;
    }

    .empty-state::after {
        font-size: 0.6rem;
        bottom: 20px;
    }

    .input-area::before {
        font-size: 0.6rem;
    }
}