:root {
    --primary: 210 100% 40%; /* #0066CC */
    --primary-light: 210 100% 95%; /* #E3F2FD */
    --secondary: 210 11% 95%; /* #F0F2F5 */
    --success: 142 71% 45%; /* #34A853 */
    --danger: 0 65% 51%; /* #DC3545 */
    --warning: 45 100% 51%; /* #FFC107 */
    --dark: 0 0% 10%; /* #1A1A1A */
    --muted: 210 8% 55%; /* #8A8A8A */
    --light: 0 0% 98%; /* #FAFAFA */
    --border: 210 14% 89%; /* #E0E6ED */
    --gradient: linear-gradient(135deg, hsl(210 100% 40%) 0%, hsl(210 100% 50%) 100%);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: hsl(var(--secondary));
    color: hsl(var(--dark));
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* Utility Classes */
.text-primary { color: hsl(var(--primary)) !important; }
.bg-primary { background-color: hsl(var(--primary)) !important; }
.text-muted { color: hsl(var(--muted)) !important; }

/* Navigation */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
}

.navbar-brand {
    font-size: 1.5rem;
    color: hsl(var(--primary)) !important;
}

/* Hero Section */
.hero-section {
    min-height: calc(100vh - 76px);
    display: flex;
    align-items: center;
    background: var(--gradient);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='7' cy='7' r='7'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-icon {
    font-size: 4rem;
    opacity: 0.9;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.3rem;
    font-weight: 300;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

.btn-google {
    background-color: hsl(var(--success));
    border-color: hsl(var(--success));
    color: white;
    font-weight: 500;
    padding: 12px 32px;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.btn-google:hover {
    background-color: hsl(142 71% 40%);
    border-color: hsl(142 71% 40%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 168, 83, 0.3);
}

.auth-note {
    opacity: 0.8;
}

/* Feature Cards */
.feature-card {
    padding: 2rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.feature-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.feature-description {
    opacity: 0.8;
    line-height: 1.6;
}

/* Chat Container */
.chat-container {
    height: calc(100vh - 76px);
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.chat-container .row {
    height: 100%;
    margin: 0;
}

/* Sidebar */
.sidebar {
    background: white;
    border-right: 1px solid hsl(var(--border));
    padding: 0;
    overflow-y: auto;
}

.sidebar-content {
    padding: 1.5rem;
    height: 100%;
}

.sidebar-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--muted));
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.model-section select {
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    padding: 0.5rem;
}

/* Upload Section */
.upload-form input[type="file"] {
    border: 2px dashed hsl(var(--border));
    border-radius: 8px;
    padding: 0.75rem;
    background: hsl(var(--light));
    transition: border-color 0.3s ease;
}

.upload-form input[type="file"]:hover {
    border-color: hsl(var(--primary));
}

/* Document Items */
.document-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: hsl(var(--light));
    border-radius: 8px;
    border: 1px solid hsl(var(--border));
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-meta {
    margin-top: 0.25rem;
}

/* Conversation Items */
.conversation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: hsl(var(--light));
    border-radius: 8px;
    border: 1px solid hsl(var(--border));
    cursor: pointer;
    transition: all 0.2s ease;
}

.conversation-item:hover {
    background: hsl(var(--primary-light));
    border-color: hsl(var(--primary));
}

.conversation-item.active {
    background: hsl(var(--primary-light));
    border-color: hsl(var(--primary));
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-title {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat Area */
.chat-area {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: white;
    padding: 0;
}

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

.chat-title {
    color: hsl(var(--dark));
    font-weight: 600;
}

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

.welcome-message {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    text-align: center;
}

.welcome-content {
    max-width: 500px;
    color: hsl(var(--muted));
}

.welcome-icon {
    font-size: 4rem;
    color: hsl(var(--primary));
    margin-bottom: 1rem;
}

.message {
    display: flex;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease-out;
}

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

.message.user {
    justify-content: flex-end;
}

.message.ai {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    position: relative;
    word-wrap: break-word;
}

.message.user .message-content {
    background: hsl(var(--primary));
    color: white;
    border-bottom-right-radius: 4px;
}

.message.ai .message-content {
    background: hsl(var(--light));
    color: hsl(var(--dark));
    border: 1px solid hsl(var(--border));
    border-bottom-left-radius: 4px;
}

.message-meta {
    font-size: 0.75rem;
    color: hsl(var(--muted));
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.context-indicator {
    background: hsl(var(--success));
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.625rem;
    font-weight: 500;
}

/* Chat Input */
.chat-input-area {
    padding: 1.5rem;
    border-top: 1px solid hsl(var(--border));
    background: white;
}

.input-group {
    margin-bottom: 0.5rem;
}

.chat-input-area input {
    border: 1px solid hsl(var(--border));
    border-radius: 24px;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    resize: none;
    transition: all 0.3s ease;
}

.chat-input-area input:focus {
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

.chat-input-area button {
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(var(--primary));
    border: none;
    transition: all 0.3s ease;
}

.chat-input-area button:hover {
    background: hsl(210 100% 35%);
    transform: translateY(-2px);
}

.chat-input-area button:disabled {
    background: hsl(var(--muted));
    transform: none;
}

.input-help {
    text-align: center;
}

/* Loading States */
.loading-message {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: hsl(var(--muted));
    font-style: italic;
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: hsl(var(--primary));
    animation: typing 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 991.98px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .sidebar {
        position: fixed;
        left: -100%;
        top: 76px;
        width: 300px;
        height: calc(100vh - 76px);
        z-index: 1050;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .chat-area {
        width: 100%;
    }
    
    .message-content {
        max-width: 85%;
    }
}

@media (max-width: 575.98px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .chat-messages {
        padding: 1rem;
    }
    
    .chat-input-area {
        padding: 1rem;
    }
    
    .message-content {
        max-width: 90%;
        padding: 0.75rem 1rem;
    }
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: hsl(var(--light));
}

.chat-messages::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background: hsl(var(--border));
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted));
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

.btn-primary:hover {
    background: hsl(210 100% 35%);
    border-color: hsl(210 100% 35%);
    transform: translateY(-1px);
}

.btn-success {
    background: hsl(var(--success));
    border-color: hsl(var(--success));
}

.btn-success:hover {
    background: hsl(142 71% 40%);
    border-color: hsl(142 71% 40%);
}

/* Form Controls */
.form-control:focus {
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

.form-select:focus {
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
}

.alert-success {
    background: hsl(var(--success) / 0.1);
    color: hsl(var(--success));
}

.alert-danger {
    background: hsl(var(--danger) / 0.1);
    color: hsl(var(--danger));
}

.alert-warning {
    background: hsl(var(--warning) / 0.1);
    color: hsl(45 100% 35%);
}
