@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #000000;
    --bg-darker: #000000;
    --primary: #ffffff;
    --secondary: #a3a3a3;
    --text-main: #ededed;
    --text-muted: #888888;
    
    --glass-bg: #0a0a0a;
    --glass-border: #1a1a1a;
    
    --error-color: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #333333;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #555555;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Navbar */
.navbar {
    width: 100%;
    padding: 1.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: absolute;
    top: 0;
    z-index: 10;
}

.logo {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.5px;
}

/* Landing Page */
.landing-page {
    position: relative;
    display: flex;
    flex-direction: column;
}

.hero-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 80vh;
    padding: 6rem 2rem 2rem 2rem;
    animation: fadeIn 0.8s ease-out;
}

.hero-content {
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 2rem;
    letter-spacing: 0.5px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero-section h1 {
    font-size: 5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: -2.5px;
    color: #ffffff;
    line-height: 1.1;
}

.hero-section p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin-bottom: 3rem;
    font-weight: 400;
}

.auth-buttons {
    display: flex;
    gap: 1rem;
}

/* Features Section */
.features-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 4rem 2rem;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.feature-card {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 12px;
    padding: 2.5rem;
    transition: transform 0.2s, border-color 0.2s;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: #333333;
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #111111;
    border: 1px solid #222222;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    margin-bottom: 1.5rem;
}

.feature-card h3 {
    font-size: 1.2rem;
    color: #ffffff;
    margin-bottom: 1rem;
    font-weight: 600;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid #1a1a1a;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #ffffff;
    color: #000000;
}

.btn-primary:hover {
    background: #e5e5e5;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: #111111;
    border-color: #333333;
}

.w-100 { width: 100%; }

/* Auth Container (Login/Register) */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-container {
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 3rem;
    width: 100%;
    max-width: 400px;
}

.auth-container h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 500;
    color: #ffffff;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-floating {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-floating input {
    width: 100%;
    padding: 1rem 1rem 0.5rem 1rem;
    background: #0a0a0a;
    border: 1px solid #222222;
    color: #ffffff;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s;
}

.form-floating label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: all 0.2s ease-out;
    pointer-events: none;
    font-size: 1rem;
}

.form-floating input:focus,
.form-floating input:not(:placeholder-shown) {
    border-color: #555555;
    background: #111111;
    outline: none;
    padding-top: 1.25rem;
    padding-bottom: 0.25rem;
}

.form-floating input:focus ~ label,
.form-floating input:not(:placeholder-shown) ~ label {
    top: 0.25rem;
    transform: translateY(0);
    font-size: 0.75rem;
    color: #888888;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    background: #000000;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #555555;
}

.auth-link {
    margin-top: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-link a {
    color: #ffffff;
    text-decoration: none;
}

.auth-link a:hover {
    text-decoration: underline;
}

.error-msg {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    text-align: center;
}

/* ====== CHAT LAYOUT (ChatGPT Clone) ====== */
.chat-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #000000;
}

.chat-container {
    display: flex;
    width: 100%;
    height: 100%;
}

.sidebar {
    width: 260px;
    background: #000000;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    height: 100%;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 500;
    color: #ffffff;
}

.collapse-sidebar-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
}

.collapse-sidebar-btn:hover {
    background: #212121;
    color: #ffffff;
}

.btn-new-chat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #212121;
    color: #ffffff;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    text-decoration: none;
    font-size: 0.875rem;
    margin: 0 0.5rem 1rem 0.5rem;
    transition: background 0.2s;
}

.btn-new-chat:hover {
    background: #212121;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: background 0.2s;
}

.sidebar-link:hover {
    background: #212121;
}

.sidebar-section-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    margin-top: 0.5rem;
    font-weight: 600;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-item-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.chat-item {
    flex: 1;
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
    padding-right: 2.5rem;
}

.chat-item:hover {
    background: #212121;
}

.chat-item.active {
    background: #212121;
    font-weight: 500;
}

.delete-chat-btn {
    position: absolute;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.chat-item-wrapper:hover .delete-chat-btn {
    opacity: 1;
}

.sidebar-footer {
    padding: 1rem 0.5rem;
}

/* Chat Main Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000000;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    position: relative;
}

.empty-state-header {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 2rem;
}

.empty-state-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 0;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
}

.empty-state {
    display: none;
}

.input-area {
    padding: 0 2rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chat-pill {
    width: 100%;
    max-width: 800px;
    background: #2f2f2f;
    border: none;
    border-radius: 50px;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.attach-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 50%;
}

.attach-btn:hover {
    background: #404040;
}

#message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1rem;
    padding: 0.5rem;
    resize: none;
    outline: none;
    font-family: inherit;
    line-height: 1.5;
    max-height: 200px;
}

#message-input::placeholder {
    color: #999999;
}

.pill-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Custom Dropdown UI */
.custom-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    background: transparent;
    border: none;
    color: #999999;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    border-radius: 8px;
}

.dropdown-toggle:hover {
    color: #ffffff;
}

.dropdown-menu {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 0.5rem;
    background: #111111;
    border-radius: 8px;
    border: 1px solid #333333;
    overflow: hidden;
    min-width: 120px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    z-index: 100;
}

.custom-dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    color: #ffffff;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background 0.1s;
}

.dropdown-item:hover, .dropdown-item.active {
    background: #2b70c9;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: #404040;
}

#send-btn {
    background: #ffffff;
    color: #000000;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin-left: 0.25rem;
}

#send-btn:hover {
    background: #e0e0e0;
}

#send-btn:disabled {
    background: #404040;
    color: #999999;
    cursor: not-allowed;
}

#stop-btn {
    background: transparent;
    color: #ffffff;
    border: 1px solid #404040;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.action-pills {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.action-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid #404040;
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.action-pill:hover {
    background: #212121;
}

.message {
    padding: 1.5rem 2rem;
    width: 100%;
}

.message-inner {
    display: flex;
    gap: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.message.user .message-inner {
    flex-direction: row-reverse;
}

.message.user .content {
    background: #2f2f2f;
    padding: 0.75rem 1.25rem;
    border-radius: 20px;
    max-width: 80%;
}

.message.assistant .content {
    flex: 1;
    overflow-x: hidden;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.message.user .avatar { display: none; }
.message.assistant .avatar {
    background: #ffffff;
    color: #000000;
}

.content {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-main);
}

.content p {
    margin-bottom: 1rem;
}

.content p:last-child {
    margin-bottom: 0;
}

pre {
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
    position: relative;
}

code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #222;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    margin: -1rem -1rem 1rem -1rem;
    font-size: 0.75rem;
    color: #aaa;
}

.copy-btn {
    background: transparent;
    border: none;
    color: #aaa;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
}

.copy-btn:hover {
    color: #fff;
}

/* ====== TYPING INDICATOR ====== */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.5rem 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: #888;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

