:root {
    --primary-bg: #000000;
    --secondary-bg: #1a1a1a;
    --accent-bg: #2a2a2a;
    --border-color: rgba(255, 255, 255, 0.1);
    --primary-text: #ffffff;
    --secondary-text: #a0a0a0;
    --accent-color: steelblue;
    --accent-hover: #3a7ca5;
    --warning-color: #ff6b6b;
    --success-color: #4CAF50;
    --glass-bg: rgba(30, 30, 30, 0.6);
    --glass-border: rgba(70, 130, 180, 0.3);
}

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

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--primary-bg);
    color: var(--primary-text);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.1;
}

.neural-network {
    position: absolute;
    width: 100%;
    height: 100%;
}

.node {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: pulse 3s infinite ease-in-out;
}

.connection {
    position: absolute;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    animation: flow 2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.5); }
}

@keyframes flow {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    padding: 1rem 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
}

.agenth1 {
    color: white;
    font-family: sans-serif;
    font-size: 2rem;
    text-decoration: none;
    font-weight: 700;
}

.agenth1 span:first-child {
    color: steelblue;
}

.agenth1 span:last-child {
    color: white;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--secondary-text);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    font-family: "Bebas Neue", serif;
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.nav-link:hover {
    color: var(--accent-color);
    background: var(--glass-bg);
}

.nav-link.active {
    color: var(--accent-color);
    background: rgba(70, 130, 180, 0.1);
}

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.connection-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning-color);
    animation: pulse-warning 2s infinite;
}

.connection-indicator.connected {
    background: var(--success-color);
    animation: pulse-success 2s infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

@keyframes pulse-success {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Main Container */
.main-container {
    margin-top: 80px;
    padding: 2rem;
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.agent-workspace {
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    height: calc(100vh - 120px);
}

/* Panel Views */
.panel-view {
    display: none;
    grid-column: 1 / -1;
}

.panel-view.active {
    display: block;
}

.panel-view.active#agentPanel {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
}

.panel-container {
    width: 100%;
    padding: 20px;
}

.panel-title {
    color: white;
    margin-bottom: 30px;
    font-size: 2rem;
    font-weight: 600;
}

.panel-title i {
    margin-right: 15px;
    color: var(--accent-color);
}

/* Chat Area */
.chat-area {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.chat-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(70, 130, 180, 0.05);
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid var(--success-color);
    border-radius: 2rem;
    font-size: 0.9rem;
}

.status-indicator.offline {
    background: rgba(255, 107, 107, 0.1);
    border-color: var(--warning-color);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    animation: pulse-status 2s infinite;
}

.status-dot.offline {
    background: var(--warning-color);
}

@keyframes pulse-status {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.agent-info {
    flex: 1;
    text-align: center;
}

.agent-info h2 {
    color: var(--accent-color);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-family: 'Lato', sans-serif;
}

.agent-info p {
    color: var(--secondary-text);
    font-size: 0.95rem;
}

.agent-character {
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-character img {
    width: 264px;
    height: 264px;
    border-radius: 15px;
    border: 2px solid var(--accent-color);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Messages */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-bg);
    font-weight: 600;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.message.user .message-avatar {
    background: var(--secondary-bg);
    color: var(--primary-text);
    border: 2px solid var(--border-color);
}

.message-content {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    max-width: 80%;
    position: relative;
    line-height: 1.6;
}

.message.user .message-content {
    background: rgba(70, 130, 180, 0.1);
    border-color: var(--accent-color);
}

.message-time {
    font-size: 0.8rem;
    color: var(--secondary-text);
    margin-top: 0.5rem;
}

.tools-used {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.tool-tag {
    background: rgba(70, 130, 180, 0.2);
    color: var(--accent-color);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    border: 1px solid rgba(70, 130, 180, 0.3);
}

/* Thinking indicator */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-color);
    font-style: italic;
}

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

.thinking-dots span {
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.thinking-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input Area */
.input-area {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(42, 42, 42, 0.8);
}

.examples-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.example-btn {
    background: rgba(70, 130, 180, 0.2);
    border: 1px solid rgba(70, 130, 180, 0.3);
    color: #4682b4;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.example-btn:hover {
    background: rgba(70, 130, 180, 0.3);
    transform: translateY(-1px);
}

.input-container {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.message-input {
    width: 100%;
    background: #3a3a3a;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 1rem 1.5rem;
    color: var(--primary-text);
    font-size: 1rem;
    resize: none;
    min-height: 50px;
    max-height: 150px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.message-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(70, 130, 180, 0.3);
}

.message-input::placeholder {
    color: var(--secondary-text);
}

.send-button {
    background: var(--accent-color);
    border: none;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.send-button:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.send-button:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
}

/* Error messages */
.error-message {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid var(--warning-color);
    color: var(--warning-color);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease;
}

.notification.success {
    background: #10b981;
}

.notification.error {
    background: #ef4444;
}

.notification.info {
    background: #6366f1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    backdrop-filter: blur(20px);
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.panel-header h3 {
    color: var(--accent-color);
    font-size: 1.1rem;
    font-weight: 600;
}

.panel-content {
    padding: 1rem 1.5rem;
}

/* Tools Panel */
.tool-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tool-item:hover {
    background: rgba(70, 130, 180, 0.1);
}

.tool-item.active {
    background: rgba(70, 130, 180, 0.2);
    border: 1px solid rgba(70, 130, 180, 0.3);
}

.tool-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tool-icon {
    width: 32px;
    height: 32px;
    background: var(--secondary-bg);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
}

.tool-info {
    flex: 1;
}

.tool-info h4 {
    font-size: 0.9rem;
    color: var(--primary-text);
    margin-bottom: 0.25rem;
}

.tool-info p {
    font-size: 0.8rem;
    color: var(--secondary-text);
}

.tool-usage {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--secondary-text);
    background: rgba(70, 130, 180, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    min-width: 30px;
    text-align: center;
}

/* Activity Panel */
.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(70, 130, 180, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    font-size: 0.8rem;
}

.activity-text {
    flex: 1;
    font-size: 0.9rem;
}

.activity-time {
    font-size: 0.8rem;
    color: var(--secondary-text);
}

/* Memory Panel */
.memory-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.memory-item h4 {
    color: var(--accent-color);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.memory-item p {
    font-size: 0.8rem;
    color: var(--secondary-text);
    line-height: 1.4;
}

/* Tools Management Panels */
.tools-panel {
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 20px;
}

.tools-panel h2 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
}

.tool-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 10px;
}

.tool-control h4 {
    color: white;
    margin: 0;
    font-size: 1rem;
}

.tool-control p {
    color: rgba(255,255,255,0.7);
    margin: 5px 0 0 0;
    font-size: 14px;
}

.tool-control small {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
}

.tool-toggle {
    width: 50px;
    height: 24px;
    background: #374151;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.tool-toggle.enabled {
    background: #10b981;
}

.tool-toggle::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.tool-toggle.enabled::after {
    transform: translateX(26px);
}

.memory-item-detailed {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.memory-item-detailed h4 {
    color: white;
    margin: 0 0 10px 0;
}

.memory-item-detailed p {
    color: rgba(255,255,255,0.7);
    margin: 0;
    line-height: 1.5;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 10px;
}

.setting-item label {
    color: white;
    font-weight: 500;
}

.setting-item h4 {
    color: white;
    margin: 0;
}

.setting-item p {
    color: rgba(255,255,255,0.7);
    margin: 5px 0 0 0;
    font-size: 14px;
}

.setting-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 8px 12px;
    color: white;
    min-width: 120px;
    font-family: inherit;
}

.setting-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(70, 130, 180, 0.3);
}

/* Buttons */
.btn {
    background: #6366f1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    background: #5b5bf6;
    transform: translateY(-1px);
}

.btn.danger {
    background: #ef4444;
}

.btn.danger:hover {
    background: #dc2626;
}

.btn i {
    font-size: 0.9rem;
}

/* Status Badges */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.online {
    background: #10b981;
    color: white;
}

.status-badge.offline {
    background: #ef4444;
    color: white;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .agent-workspace {
        max-width: 1200px;
        grid-template-columns: 1fr 350px;
    }
}

@media (max-width: 1200px) {
    .agent-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        height: auto;
        min-height: calc(100vh - 120px);
    }

    .panel-view.active#agentPanel {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }

    .sidebar {
        flex-direction: row;
        overflow-x: auto;
        gap: 1rem;
    }

    .sidebar-panel {
        min-width: 280px;
        flex-shrink: 0;
    }

    .chat-area {
        min-height: 60vh;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
    }

    .nav-link {
        font-size: 1rem;
        padding: 0.4rem 0.8rem;
    }

    .main-container {
        padding: 1rem;
        margin-top: 100px;
    }

    .agent-workspace {
        gap: 1rem;
    }

    .sidebar {
        flex-direction: column;
    }

    .sidebar-panel {
        min-width: auto;
    }

    .agent-status {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .agent-character {
        order: -1;
    }

    .chat-area {
        min-height: 50vh;
    }

    .messages-container {
        padding: 1rem;
    }

    .message-content {
        max-width: 90%;
        padding: 1rem;
    }

    .input-area {
        padding: 1rem;
    }

    .examples-container {
        gap: 8px;
    }

    .example-btn {
        font-size: 11px;
        padding: 6px 10px;
    }

    .panel-container {
        padding: 15px;
    }

    .panel-title {
        font-size: 1.6rem;
        margin-bottom: 20px;
    }

    .tools-panel {
        padding: 15px;
        margin-bottom: 15px;
    }

    .tools-panel h2 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }

    .tool-control {
        padding: 12px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .tool-toggle {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .agenth1 {
        font-size: 1.6rem;
    }

    .nav-links {
        justify-content: center;
        width: 100%;
    }

    .connection-status {
        font-size: 0.8rem;
    }

    .agent-info h2 {
        font-size: 1.3rem;
    }

    .agent-info p {
        font-size: 0.9rem;
    }

    .message-avatar {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }

    .message-content {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }

    .input-container {
        gap: 0.5rem;
    }

    .send-button {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--secondary-bg);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #3a3a3a var(--secondary-bg);
}

/* Enhanced animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message {
    animation: fadeIn 0.3s ease;
}

.tool-item.active {
    animation: slideInFromRight 0.3s ease;
}

.activity-item {
    animation: fadeIn 0.3s ease;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Focus states for accessibility */
.nav-link:focus,
.send-button:focus,
.btn:focus,
.message-input:focus,
.setting-input:focus,
.tool-toggle:focus,
.example-btn:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
    :root {
        --border-color: rgba(255, 255, 255, 0.3);
        --secondary-text: #d0d0d0;
        --glass-bg: rgba(30, 30, 30, 0.9);
    }
}

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

    .node,
    .connection,
    .thinking-dots span {
        animation: none;
    }
}