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

:root {
    --bg-primary: #0a1628;
    --bg-secondary: #0f2137;
    --bg-tertiary: #13294b;
    --bg-card: rgba(19, 41, 75, 0.6);
    --border-color: rgba(0, 212, 255, 0.2);
    --border-hover: rgba(0, 212, 255, 0.5);
    --text-primary: #e8f4fc;
    --text-secondary: #8ba3c7;
    --text-muted: #5a7a9e;
    --accent-cyan: #00d4ff;
    --accent-blue: #0066ff;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --glow-cyan: 0 0 20px rgba(0, 212, 255, 0.3);
    --glow-blue: 0 0 30px rgba(0, 102, 255, 0.2);
    --gradient-primary: linear-gradient(135deg, #00d4ff 0%, #0066ff 100%);
    --gradient-card: linear-gradient(135deg, rgba(19, 41, 75, 0.8) 0%, rgba(15, 33, 55, 0.9) 100%);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at top left, rgba(0, 102, 255, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(0, 212, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    background: var(--gradient-card);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--border-hover);
    border-radius: 10px;
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.4));
}

.logo-icon svg {
    width: 28px;
    height: 28px;
}

.title {
    font-size: 22px;
    font-weight: 600;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
}

.header-right .subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.nav-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 16px 40px;
    background: rgba(10, 22, 40, 0.5);
    border-bottom: 1px solid var(--border-color);
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0.1;
    transition: left 0.3s ease;
}

.nav-tab:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.nav-tab:hover::before {
    left: 0;
}

.nav-tab.active {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: var(--glow-cyan);
}

.nav-tab.active::before {
    left: 0;
    opacity: 0.15;
}

.tab-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 212, 255, 0.15);
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
}

.nav-tab.active .tab-icon {
    background: var(--gradient-primary);
    color: var(--bg-primary);
}

.tab-text {
    font-weight: 500;
}

.main-content {
    flex: 1;
    padding: 24px;
}

.tab-panel {
    display: none;
    height: 100%;
}

.tab-panel.active {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    height: 100%;
    min-height: calc(100vh - 200px);
}

.control-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-section {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    backdrop-filter: blur(10px);
    transition: border-color 0.3s ease;
}

.panel-section:hover {
    border-color: var(--border-hover);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-cyan);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.control-group {
    margin-bottom: 12px;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.control-label span {
    color: var(--accent-cyan);
    font-weight: 600;
    font-size: 15px;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    position: relative;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--glow-cyan);
    transition: transform 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: var(--glow-cyan);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-tertiary);
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-item:hover .checkmark {
    border-color: var(--border-hover);
}

.checkbox-item input[type="checkbox"]:checked + .checkmark {
    background: var(--gradient-primary);
    border-color: var(--accent-cyan);
}

.checkbox-item input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--bg-primary);
    font-size: 12px;
    font-weight: bold;
}

.calc-group {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--border-color);
}

.calc-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.calc-row label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.calc-row input[type="number"],
.calc-row input[type="text"],
.calc-row select {
    flex: 1;
    max-width: 120px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.3s ease;
    text-align: right;
    font-family: 'Consolas', 'Monaco', monospace;
}

.calc-row input[readonly] {
    background: rgba(0, 212, 255, 0.05);
    color: var(--accent-cyan);
    cursor: default;
}

.calc-row input:focus,
.calc-row select:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

.calc-row select {
    cursor: pointer;
    text-align: left;
}

.btn-primary,
.btn-secondary {
    width: 100%;
    padding: 9px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 4px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 2px 12px rgba(0, 102, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 102, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-cyan);
    border: 1px solid var(--border-hover);
}

.btn-secondary:hover {
    background: rgba(0, 212, 255, 0.2);
    transform: translateY(-1px);
}

.chart-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.chart-container {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    backdrop-filter: blur(10px);
    transition: border-color 0.3s ease;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chart-container:hover {
    border-color: var(--border-hover);
}

.chart-header {
    margin-bottom: 14px;
    flex-shrink: 0;
}

.chart-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.chart-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.chart-box {
    flex: 1;
    min-height: 280px;
    width: 100%;
}

.footer {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border-color);
    background: rgba(10, 22, 40, 0.5);
}

.footer p {
    letter-spacing: 1px;
}

@media (max-width: 1024px) {
    .tab-panel.active {
        grid-template-columns: 1fr;
    }

    .control-panel {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 640px) {
    .header {
        padding: 16px 20px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .nav-tabs {
        padding: 12px 16px;
        gap: 4px;
    }

    .nav-tab {
        padding: 8px 16px;
        font-size: 13px;
    }

    .main-content {
        padding: 16px;
    }

    .control-panel {
        grid-template-columns: 1fr;
    }
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

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

.chat-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 380px;
    height: 550px;
    background: rgba(10, 30, 50, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(0, 150, 255, 0.2);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, rgba(0, 168, 232, 0.3), rgba(0, 119, 182, 0.3));
    color: #e0f7ff;
    padding: 12px 16px;
    border-radius: 16px 16px 0 0;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bot-avatar-small {
    width: 32px;
    height: 32px;
}

.bot-avatar-small svg {
    width: 100%;
    height: 100%;
}

.chat-title {
    font-weight: 500;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: messageSlide 0.3s ease forwards;
}

@keyframes messageSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.avatar svg { width: 100%; height: 100%; }

.message {
    max-width: 70%;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-line;
}

.user-message {
    background: linear-gradient(135deg, #00a8e8, #0077b6);
    color: white;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 4px 15px rgba(0, 168, 232, 0.3);
}

.bot-message {
    background: rgba(20, 50, 80, 0.8);
    color: #e0f7ff;
    border-radius: 16px 16px 16px 4px;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.input-container {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid rgba(0, 212, 255, 0.2);
    background: rgba(10, 30, 50, 0.8);
    gap: 10px;
}

#user-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 20px;
    background: rgba(20, 50, 80, 0.5);
    color: #e0f7ff;
    font-size: 13px;
    outline: none;
    transition: all 0.3s ease;
}

#user-input::placeholder { color: rgba(160, 216, 255, 0.5); }

#user-input:focus {
    border-color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

#send-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #00d4ff, #0096ff);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

#send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.5);
}

#send-btn svg { color: white; }

.loading-wrapper .message { padding: 15px 20px; }

.loading span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #00d4ff;
    border-radius: 50%;
    margin: 0 3px;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

.minimized { transform: translateY(calc(100% - 56px)); }

.minimize-btn {
    background: transparent;
    border: none;
    color: #e0f7ff;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.minimize-btn:hover { background: rgba(0, 212, 255, 0.2); }

.voice-input-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 212, 255, 0.12);
    border: 1px solid rgba(0, 212, 255, 0.4);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #00d4ff;
    flex-shrink: 0;
}
.voice-input-btn:hover {
    background: rgba(0, 212, 255, 0.25);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.4);
}
.voice-input-btn.recording {
    background: #ff4d6d;
    border-color: #ff4d6d;
    color: #fff;
    animation: voice-pulse 1.2s infinite ease-in-out;
    box-shadow: 0 0 18px rgba(255, 77, 109, 0.6);
}
@keyframes voice-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

.chat-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 380px;
    height: 550px;
    background: rgba(10, 30, 50, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(0, 150, 255, 0.2);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, rgba(0, 168, 232, 0.3), rgba(0, 119, 182, 0.3));
    color: #e0f7ff;
    padding: 12px 16px;
    border-radius: 16px 16px 0 0;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bot-avatar-small {
    width: 32px;
    height: 32px;
}

.bot-avatar-small svg {
    width: 100%;
    height: 100%;
}

.chat-title {
    font-weight: 500;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    animation: messageSlide 0.3s ease forwards;
}

@keyframes messageSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.avatar svg { width: 100%; height: 100%; }

.message {
    max-width: 70%;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-line;
}

.user-message {
    background: linear-gradient(135deg, #00a8e8, #0077b6);
    color: white;
    border-radius: 16px 16px 4px 16px;
    box-shadow: 0 4px 15px rgba(0, 168, 232, 0.3);
}

.bot-message {
    background: rgba(20, 50, 80, 0.8);
    color: #e0f7ff;
    border-radius: 16px 16px 16px 4px;
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.input-container {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid rgba(0, 212, 255, 0.2);
    background: rgba(10, 30, 50, 0.8);
    gap: 10px;
}

#user-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 20px;
    background: rgba(20, 50, 80, 0.5);
    color: #e0f7ff;
    font-size: 13px;
    outline: none;
    transition: all 0.3s ease;
}

#user-input::placeholder { color: rgba(160, 216, 255, 0.5); }

#user-input:focus {
    border-color: #00d4ff;
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.2);
}

#send-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #00d4ff, #0096ff);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

#send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.5);
}

#send-btn svg { color: white; }

.loading-wrapper .message { padding: 15px 20px; }

.loading span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #00d4ff;
    border-radius: 50%;
    margin: 0 3px;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

.minimized { transform: translateY(calc(100% - 56px)); }

.minimize-btn {
    background: transparent;
    border: none;
    color: #e0f7ff;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.minimize-btn:hover { background: rgba(0, 212, 255, 0.2); }
