/* Chatbase Clone - Main Styles */

:root {
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #16213e;
    --sidebar-active: #0f3460;
    --primary-color: #0066af;
    --primary-hover: #005494;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --border-color: #e5e7eb;
    --bg-light: #f5f5f5;
    --bg-white: #ffffff;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --chat-bubble-bg: #f0f0f0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.5;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Left Sidebar */
.sidebar {
    width: 240px;
    background-color: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.workspace-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
}

.workspace-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.workspace-name {
    font-weight: 600;
    font-size: 15px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
    color: #fff;
}

.nav-item.active {
    background-color: var(--sidebar-active);
    color: #fff;
}

.nav-item svg {
    width: 18px;
    height: 18px;
}

.nav-section-title {
    padding: 16px 16px 8px;
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.5px;
}

/* Agents List */
.agents-list {
    padding: 0 8px;
}

.agent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    transition: all 0.2s;
}

.agent-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.agent-item.active {
    background: var(--primary-color);
    color: #fff;
}

.agent-avatar {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
}

/* Top Bar */
.top-bar {
    height: 56px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

/* Playground Layout */
.playground-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Chat Panel */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-light);
}

.chat-header {
    padding: 16px 24px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-list-sidebar {
    width: 260px;
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.chat-list-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.chat-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: all 0.2s;
}

.chat-item:hover {
    background: var(--bg-light);
}

.chat-item.active {
    background: var(--primary-color);
    color: #fff;
}

.chat-item-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-date {
    font-size: 12px;
    color: var(--text-light);
}

.chat-item.active .chat-item-date {
    color: rgba(255,255,255,0.7);
}

.chat-item-content {
    flex: 1;
    min-width: 0;
}

.chat-delete-btn {
    display: none;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(0,0,0,0.1);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    transition: all 0.2s;
}

.chat-item:hover .chat-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-delete-btn:hover {
    background: var(--danger-color);
    color: #fff;
}

.chat-item.active .chat-delete-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.chat-item.active .chat-delete-btn:hover {
    background: var(--danger-color);
}

/* Chat Widget Header */
.chat-widget-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #004d82 100%);
    color: #fff;
    border-radius: 16px 16px 0 0;
}

.chat-widget-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: #0a1628;
    flex-shrink: 0;
}

.chat-widget-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-widget-title {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
}

.chat-refresh-btn {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-refresh-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* Messages Area */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-light);
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

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

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

/* Assistant message with header */
.message.assistant .message-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.message-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.message.assistant .message-avatar {
    background: #0a1628;
}

.message.assistant .message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message.user .message-avatar {
    display: none;
}

.message-sender-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.message-content {
    padding: 14px 18px;
    font-size: 15px;
    line-height: 1.6;
}

.message.assistant .message-content {
    background: var(--chat-bubble-bg);
    border-radius: 18px;
    color: var(--text-primary);
}

.message.assistant .message-content p {
    margin: 0 0 12px 0;
}

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

.message.assistant .message-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.message.assistant .message-content .response-list {
    margin: 8px 0;
}

.message.assistant .message-content .list-item {
    display: flex;
    gap: 8px;
    margin: 6px 0;
    padding-left: 4px;
}

.message.assistant .message-content .list-number,
.message.assistant .message-content .list-bullet {
    color: var(--primary-color);
    font-weight: 600;
    flex-shrink: 0;
}

.message.user .message-content {
    background: var(--primary-color);
    color: #fff;
    border-radius: 18px;
}

/* Chat Links */
.message.assistant .message-content a.chat-link {
    color: var(--primary-color);
    text-decoration: underline;
    word-break: break-all;
    transition: color 0.2s;
    display: block;
    margin-bottom: 16px;
}

.message.assistant .message-content a.chat-link:last-child {
    margin-bottom: 0;
}

.message.assistant .message-content a.chat-link:hover {
    color: var(--primary-hover);
}

/* Chat Input */
.chat-input-container {
    padding: 16px 24px;
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.send-btn {
    padding: 12px 20px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.send-btn:hover {
    background: var(--primary-hover);
}

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

/* Settings Panel */
.settings-panel {
    width: 320px;
    background: var(--bg-white);
    border-left: 1px solid var(--border-color);
    padding: 24px;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-select, .form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-white);
}

.form-select:focus, .form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Slider */
.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider {
    flex: 1;
    -webkit-appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.slider-value {
    font-size: 14px;
    font-weight: 500;
    min-width: 40px;
    text-align: right;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

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

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

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Files Page */
.files-container {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    margin-bottom: 24px;
    transition: all 0.2s;
    cursor: pointer;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--text-light);
}

.upload-text {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 13px;
    color: var(--text-light);
}

/* Files Table */
.files-table-container {
    background: var(--bg-white);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.files-table {
    width: 100%;
    border-collapse: collapse;
}

.files-table th, .files-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.files-table th {
    background: var(--bg-light);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.files-table tr:last-child td {
    border-bottom: none;
}

.files-table tr:hover td {
    background: var(--bg-light);
}

.file-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    width: 32px;
    height: 32px;
    background: var(--bg-light);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

/* Stats Panel */
.stats-panel {
    background: var(--bg-white);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Auth Pages */
.auth-page {
    overflow: hidden;
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    background: linear-gradient(135deg, #000000 0%, #0a0a1a 25%, #1a1a3a 50%, #0a0a1a 75%, #000000 100%);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
    overflow: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.auth-background {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 0;
}

/* Vertical Lightning effect */
.auth-lightning {
    position: absolute;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, 
        transparent 0%, 
        rgba(100, 150, 255, 0.8) 20%,
        rgba(150, 200, 255, 1) 50%,
        rgba(100, 150, 255, 0.8) 80%,
        transparent 100%);
    opacity: 0;
    box-shadow: 0 0 20px rgba(100, 150, 255, 0.8),
                0 0 40px rgba(100, 150, 255, 0.6),
                0 0 60px rgba(100, 150, 255, 0.4);
    animation: lightning 8s infinite;
}

.auth-lightning:nth-child(1) {
    left: 20%;
    animation-delay: 0s;
}

.auth-lightning:nth-child(2) {
    left: 50%;
    animation-delay: 2s;
    width: 3px;
    box-shadow: 0 0 30px rgba(100, 150, 255, 1),
                0 0 60px rgba(100, 150, 255, 0.8),
                0 0 90px rgba(100, 150, 255, 0.6);
}

.auth-lightning:nth-child(3) {
    left: 80%;
    animation-delay: 4s;
}

@keyframes lightning {
    0%, 90%, 100% {
        opacity: 0;
        transform: translateX(0) scaleY(0.5);
    }
    2%, 4% {
        opacity: 1;
        transform: translateX(-5px) scaleY(1);
    }
    3% {
        opacity: 0.8;
        transform: translateX(5px) scaleY(1.1);
    }
    6%, 8% {
        opacity: 0.6;
        transform: translateX(-3px) scaleY(0.9);
    }
}

/* Diagonal Lightning Strike Across Screen */
.auth-lightning-strike {
    position: absolute;
    width: 5px;
    height: 200vh;
    top: -50vh;
    left: 50%;
    background: linear-gradient(135deg,
        transparent 0%,
        rgba(200, 220, 255, 0.9) 10%,
        rgba(255, 255, 255, 1) 20%,
        rgba(200, 220, 255, 0.9) 30%,
        rgba(150, 200, 255, 0.8) 50%,
        rgba(200, 220, 255, 0.9) 70%,
        rgba(255, 255, 255, 1) 80%,
        rgba(200, 220, 255, 0.9) 90%,
        transparent 100%);
    opacity: 0;
    transform: rotate(45deg) translateX(-50%);
    transform-origin: center;
    box-shadow: 0 0 40px rgba(200, 220, 255, 1),
                0 0 80px rgba(150, 200, 255, 0.9),
                0 0 120px rgba(100, 150, 255, 0.7),
                0 0 160px rgba(100, 150, 255, 0.5);
    animation: lightningStrike 12s infinite;
    z-index: 1;
}

.auth-lightning-strike::before {
    content: '';
    position: absolute;
    width: 2px;
    height: 100%;
    left: -10px;
    background: linear-gradient(135deg,
        transparent 0%,
        rgba(150, 200, 255, 0.6) 30%,
        rgba(200, 220, 255, 0.8) 50%,
        rgba(150, 200, 255, 0.6) 70%,
        transparent 100%);
    box-shadow: 0 0 20px rgba(150, 200, 255, 0.8);
}

.auth-lightning-strike::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 100%;
    right: -10px;
    background: linear-gradient(135deg,
        transparent 0%,
        rgba(150, 200, 255, 0.6) 30%,
        rgba(200, 220, 255, 0.8) 50%,
        rgba(150, 200, 255, 0.6) 70%,
        transparent 100%);
    box-shadow: 0 0 20px rgba(150, 200, 255, 0.8);
}

@keyframes lightningStrike {
    0%, 88%, 100% {
        opacity: 0;
        transform: rotate(45deg) translateX(-50%) scale(0.8);
        filter: blur(0px);
    }
    89% {
        opacity: 0.2;
        transform: rotate(45deg) translateX(-50%) scale(0.9);
        filter: blur(2px);
    }
    90% {
        opacity: 0.6;
        transform: rotate(45deg) translateX(-50%) scale(1);
        filter: blur(1px);
    }
    91% {
        opacity: 1;
        transform: rotate(45deg) translateX(-50%) scale(1.1);
        filter: blur(0px);
    }
    91.3% {
        opacity: 0.8;
        transform: rotate(45deg) translateX(-50%) scale(1.05);
        filter: blur(0.5px);
    }
    91.6% {
        opacity: 1;
        transform: rotate(45deg) translateX(-50%) scale(1.1);
        filter: blur(0px);
    }
    92% {
        opacity: 0.9;
        transform: rotate(45deg) translateX(-50%) scale(1.05);
        filter: blur(0.5px);
    }
    92.5% {
        opacity: 0.7;
        transform: rotate(45deg) translateX(-50%) scale(1);
        filter: blur(1px);
    }
    93% {
        opacity: 0.4;
        transform: rotate(45deg) translateX(-50%) scale(0.95);
        filter: blur(2px);
    }
    94% {
        opacity: 0.2;
        transform: rotate(45deg) translateX(-50%) scale(0.9);
        filter: blur(3px);
    }
    95%, 99% {
        opacity: 0;
        transform: rotate(45deg) translateX(-50%) scale(0.8);
        filter: blur(4px);
    }
}

/* Lightning Strike Branch */
.auth-lightning-branch {
    position: absolute;
    width: 2px;
    height: 40%;
    background: linear-gradient(135deg,
        transparent 0%,
        rgba(200, 220, 255, 0.8) 20%,
        rgba(255, 255, 255, 1) 50%,
        rgba(200, 220, 255, 0.8) 80%,
        transparent 100%);
    opacity: 0;
    transform: rotate(30deg);
    box-shadow: 0 0 20px rgba(200, 220, 255, 0.9),
                0 0 40px rgba(150, 200, 255, 0.7);
    animation: lightningBranch 12s infinite;
    z-index: 1;
}

.auth-lightning-branch:nth-child(2) {
    top: 20%;
    left: 30%;
    animation-delay: 0.1s;
}

.auth-lightning-branch:nth-child(3) {
    top: 60%;
    left: 70%;
    transform: rotate(-30deg);
    animation-delay: 0.15s;
}

@keyframes lightningBranch {
    0%, 88%, 100% {
        opacity: 0;
        transform: scale(0.5);
    }
    90%, 92% {
        opacity: 0.8;
        transform: scale(1);
    }
    91% {
        opacity: 1;
        transform: scale(1.1);
    }
    93% {
        opacity: 0.4;
        transform: scale(0.9);
    }
    94% {
        opacity: 0;
        transform: scale(0.5);
    }
}

/* Spark particles */
.auth-spark {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(100, 150, 255, 0.8) 50%, transparent 100%);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(100, 150, 255, 1),
                0 0 20px rgba(100, 150, 255, 0.8);
    animation: spark 3s infinite;
    opacity: 0;
}

.auth-spark:nth-child(4) {
    top: 20%;
    left: 15%;
    animation-delay: 0.5s;
}

.auth-spark:nth-child(5) {
    top: 40%;
    left: 70%;
    animation-delay: 1.5s;
    width: 6px;
    height: 6px;
}

.auth-spark:nth-child(6) {
    top: 60%;
    left: 30%;
    animation-delay: 2.5s;
}

.auth-spark:nth-child(7) {
    top: 80%;
    left: 85%;
    animation-delay: 1s;
    width: 5px;
    height: 5px;
}

.auth-spark:nth-child(8) {
    top: 30%;
    left: 60%;
    animation-delay: 2s;
}

.auth-spark:nth-child(9) {
    top: 70%;
    left: 45%;
    animation-delay: 0.8s;
}

@keyframes spark {
    0% {
        opacity: 0;
        transform: scale(0) translate(0, 0);
    }
    10% {
        opacity: 1;
        transform: scale(1) translate(0, 0);
    }
    50% {
        opacity: 1;
        transform: scale(1.5) translate(20px, -30px);
    }
    100% {
        opacity: 0;
        transform: scale(0) translate(40px, -60px);
    }
}

/* Additional spark bursts */
.auth-spark-burst {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(100, 150, 255, 1);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(100, 150, 255, 1);
    animation: sparkBurst 4s infinite;
    opacity: 0;
}

.auth-spark-burst:nth-child(10) {
    top: 25%;
    left: 40%;
    animation-delay: 0s;
}

.auth-spark-burst:nth-child(11) {
    top: 55%;
    left: 25%;
    animation-delay: 1.5s;
}

.auth-spark-burst:nth-child(12) {
    top: 75%;
    left: 65%;
    animation-delay: 3s;
}

@keyframes sparkBurst {
    0%, 85%, 100% {
        opacity: 0;
        transform: scale(0);
    }
    5% {
        opacity: 1;
        transform: scale(1);
    }
    10% {
        opacity: 0.8;
        transform: scale(2);
    }
    15% {
        opacity: 0;
        transform: scale(3);
    }
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out, cardGlow 4s ease-in-out infinite;
}

@keyframes cardGlow {
    0%, 100% {
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(100, 150, 255, 0.1);
    }
    50% {
        box-shadow: 0 20px 60px rgba(100, 150, 255, 0.3), 0 0 0 1px rgba(100, 150, 255, 0.3), 0 0 40px rgba(100, 150, 255, 0.2);
    }
}

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

.auth-logo {
    text-align: center;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.auth-logo-wrapper {
    width: 120px;
    height: 120px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 102, 175, 0.3), 0 0 0 0 rgba(0, 102, 175, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    animation: logoFloat 4s ease-in-out infinite, logoGlow 3s ease-in-out infinite;
    overflow: hidden;
}

.auth-logo-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shine 4s infinite;
    z-index: 0;
}

.auth-logo-wrapper::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--primary-color), #764ba2, #f093fb, var(--primary-color));
    background-size: 300% 300%;
    z-index: -1;
    opacity: 0.6;
    animation: borderRotate 8s linear infinite;
    filter: blur(8px);
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-12px) rotate(2deg);
    }
    50% {
        transform: translateY(-8px) rotate(0deg);
    }
    75% {
        transform: translateY(-12px) rotate(-2deg);
    }
}

@keyframes logoGlow {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(0, 102, 175, 0.3), 0 0 0 0 rgba(0, 102, 175, 0.4);
    }
    50% {
        box-shadow: 0 8px 32px rgba(0, 102, 175, 0.5), 0 0 20px rgba(0, 102, 175, 0.6);
    }
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

@keyframes borderRotate {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.auth-logo-wrapper:hover {
    transform: scale(1.15) rotate(8deg);
    animation-play-state: paused;
    box-shadow: 0 12px 40px rgba(0, 102, 175, 0.6), 0 0 30px rgba(0, 102, 175, 0.8);
}

.auth-logo-wrapper:hover::after {
    animation-duration: 2s;
    opacity: 0.8;
}

.auth-logo-img {
    width: 100px;
    height: 100px;
    border-radius: 16px;
    object-fit: cover;
    position: relative;
    z-index: 1;
    animation: imagePulse 3s ease-in-out infinite;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: brightness(1) contrast(1);
}

@keyframes imagePulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        filter: brightness(1) contrast(1);
    }
    25% {
        opacity: 0.98;
        transform: scale(0.99);
        filter: brightness(1.05) contrast(1.05);
    }
    50% {
        opacity: 1;
        transform: scale(1.01);
        filter: brightness(1.1) contrast(1.1);
    }
    75% {
        opacity: 0.98;
        transform: scale(0.99);
        filter: brightness(1.05) contrast(1.05);
    }
}

.auth-logo-wrapper:hover .auth-logo-img {
    animation: imagePulse 0.6s ease-in-out infinite;
    transform: scale(1.08);
    filter: brightness(1.2) contrast(1.15);
}

.auth-logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.5px;
    animation: titleFadeIn 0.8s ease-out 0.2s both;
}

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

.auth-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.auth-description {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

.auth-form .form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-light);
    z-index: 1;
    transition: color 0.2s;
}

.form-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    background: var(--bg-white);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 102, 175, 0.1);
    transform: translateY(-2px);
    animation: inputFocus 0.3s ease-out;
}

@keyframes inputFocus {
    0% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-2px) scale(1.01);
    }
    100% {
        transform: translateY(-2px) scale(1);
    }
}

.form-input:focus + .form-input-icon,
.form-input:focus ~ .form-input-icon {
    color: var(--primary-color);
}

.form-input::placeholder {
    color: var(--text-light);
}

.btn-auth-submit {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-auth-submit::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-auth-submit:hover::before {
    width: 300px;
    height: 300px;
}

.btn-auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 102, 175, 0.4);
}

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

.btn-icon {
    transition: transform 0.2s;
}

.btn-auth-submit:hover .btn-icon {
    transform: translateX(4px);
}

.auth-footer {
    text-align: center;
    margin-top: 32px;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.auth-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    position: relative;
}

.auth-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.auth-link:hover {
    color: var(--primary-hover);
}

.auth-link:hover::after {
    width: 100%;
}

/* Alert Messages */
.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease-out;
}

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

.alert-icon {
    flex-shrink: 0;
}

.alert span {
    flex: 1;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* Checkbox */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--text-light);
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state-text {
    font-size: 14px;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1366px) {
    .settings-panel {
        width: 280px;
    }
    
    .chat-list-sidebar {
        width: 220px;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    
    .main-content {
        margin-left: 200px;
    }
    
    .settings-panel {
        width: 260px;
    }
}

/* Hidden file input */
.hidden-input {
    display: none;
}

/* Trained badge */
.trained-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.trained-badge::before {
    content: '●';
    font-size: 8px;
}

/* Instructions textarea */
.instructions-textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

.instructions-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}
