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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f0f;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: #171717;
    border-right: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #2a2a2a;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

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

.logo-text {
    font-size: 18px;
    font-weight: 600;
}

.new-chat-btn {
    width: 100%;
    padding: 10px 16px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background: #3a3a3a;
}

.nav-menu {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: #2a2a2a;
}

.nav-item.active {
    background: #667eea;
    color: white;
}

.nav-item:not(.active) {
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item:not(.active):hover {
    background: #2a2a2a;
    transform: translateX(2px);
}

.nav-section {
    margin-bottom: 4px;
}

.nav-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    justify-content: space-between;
}

.nav-section-header:hover {
    background: #2a2a2a;
}

.nav-arrow {
    font-size: 10px;
    color: #888;
    transition: transform 0.2s;
}

.nav-section.expanded .nav-arrow {
    transform: rotate(180deg);
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-left: 24px;
}

.nav-section.expanded .nav-submenu {
    max-height: 300px;
}

.nav-subitem {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 13px;
    color: #ccc;
    margin-bottom: 1px;
}

.nav-subitem:hover {
    background: #2a2a2a;
    color: white;
}

.nav-icon {
    width: 16px;
    text-align: center;
    font-size: 14px;
}

.nav-text {
    flex: 1;
}

/* More submenu styles */
.nav-more {
    justify-content: space-between;
}

.nav-arrow-sub {
    font-size: 8px;
    color: #888;
    transition: transform 0.2s;
}

.nav-more.expanded .nav-arrow-sub {
    transform: rotate(180deg);
}

.nav-more-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-left: 12px;
    border-left: 1px solid #333;
    padding-left: 12px;
}

.nav-more.expanded + .nav-more-submenu {
    max-height: 500px;
}

.nav-category {
    margin-bottom: 12px;
}

.nav-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-category-items {
    margin-left: 20px;
}

.nav-category-item {
    padding: 4px 8px;
    font-size: 12px;
    color: #999;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    margin-bottom: 1px;
}

.nav-category-item:hover {
    background: #2a2a2a;
    color: white;
}

/* New badge */
.new-badge {
    background: #10b981;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 600;
    margin-left: auto;
}

/* Subsections */
.nav-subsection {
    margin: 8px 0;
    margin-left: 12px;
}

.nav-subsection-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-subsection-items {
    margin-left: 16px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #2a2a2a;
}

.settings-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    transition: background 0.2s;
}

.settings-btn:hover {
    background: #2a2a2a;
}

/* User Section */
.user-section {
    margin-bottom: 12px;
    padding: 12px;
    background: #2a2a2a;
    border-radius: 8px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: #667eea;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 2px;
}

.user-email {
    font-size: 12px;
    color: #888;
}

.logout-btn {
    width: 100%;
    padding: 8px 12px;
    background: #ff4444;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: #cc3333;
}

.auth-section {
    margin-bottom: 12px;
}

.auth-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #667eea;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.auth-btn:hover {
    background: #5a67d8;
}

/* Upgrade Section */
.upgrade-section {
    position: relative;
    margin-bottom: 12px;
}

.upgrade-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    transition: background 0.2s;
    width: 100%;
}

.upgrade-btn:hover {
    background: #2a2a2a;
}

.upgrade-icon {
    font-size: 16px;
}

.upgrade-title {
    font-weight: 500;
}

.upgrade-subtitle {
    font-size: 12px;
    color: #888;
}

/* Upgrade Popup */
.upgrade-popup {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    width: 320px;
}

.upgrade-section:hover .upgrade-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.popup-header {
    margin-bottom: 16px;
}

.popup-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
}

.plan-tier {
    margin-bottom: 12px;
    padding: 12px;
    background: #2a2a2a;
    border-radius: 8px;
}

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

.tier-name {
    font-weight: 600;
    color: #ffffff;
    font-size: 14px;
}

.tier-credits {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.tier-models {
    font-size: 11px;
    color: #aaa;
    line-height: 1.4;
    margin-bottom: 4px;
}

.tier-bonus {
    font-size: 12px;
    color: #888;
    text-align: right;
}

.try-free-btn {
    width: 100%;
    padding: 10px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin: 16px 0;
    transition: background 0.2s;
}

.try-free-btn:hover {
    background: #5a67d8;
}

.bonus-section {
    margin: 16px 0;
    padding-top: 12px;
    border-top: 1px solid #333;
}

.bonus-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
}

.bonus-name {
    color: #ccc;
}

.bonus-credits {
    color: #667eea;
    font-weight: 600;
}

.invite-section {
    padding-top: 12px;
    border-top: 1px solid #333;
    text-align: center;
}

.invite-text {
    font-size: 12px;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
}

.invite-text:hover {
    color: #667eea;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f0f0f;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #2a2a2a;
}

.model-selector {
    display: flex;
    align-items: center;
}

.model-select {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    color: #ffffff;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
}

.url-input-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    max-width: 500px;
    margin-left: auto;
}

#urlInput {
    flex: 1;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    color: #ffffff;
    padding: 10px 16px;
    font-size: 14px;
}

#urlInput::placeholder {
    color: #888;
}

#urlInput:focus {
    outline: none;
    border-color: #667eea;
}

.analyze-btn {
    background: #667eea;
    border: none;
    border-radius: 8px;
    color: white;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.analyze-btn:hover {
    background: #5a67d8;
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Welcome Screen */
.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.welcome-content {
    text-align: center;
    max-width: 600px;
}

.welcome-content h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 32px;
    color: #ffffff;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #171717;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.quick-action:hover {
    background: #2a2a2a;
    border-color: #3a3a3a;
}

.action-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2a2a2a;
    border-radius: 8px;
}

.action-title {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
}

.action-desc {
    font-size: 14px;
    color: #888;
}

/* Messages */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

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

.ai-avatar, .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.ai-avatar {
    background: #667eea;
    color: white;
}

.user-avatar {
    background: #10b981;
    color: white;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
}

.ai-bubble {
    background: #2a2a2a;
    color: #ffffff;
}

.user-bubble {
    background: #667eea;
    color: white;
}

/* Chat Input */
.chat-input-container {
    padding: 24px;
    border-top: 1px solid #2a2a2a;
}

.input-wrapper {
    display: flex;
    align-items: end;
    gap: 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    padding: 12px 16px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: #667eea;
}

#chatInput {
    flex: 1;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
}

#chatInput::placeholder {
    color: #888;
}

#chatInput:focus {
    outline: none;
}

.send-btn {
    width: 32px;
    height: 32px;
    background: #667eea;
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #5a67d8;
}

.send-btn:disabled {
    background: #3a3a3a;
    cursor: not-allowed;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: #171717;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #2a2a2a;
}

.modal-header h3 {
    color: #ffffff;
}

.modal-content {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px;
    border-top: 1px solid #2a2a2a;
}

.close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.close-btn:hover {
    background: #2a2a2a;
    color: #ffffff;
}

/* Settings */
.setting-group {
    margin-bottom: 24px;
}

.setting-group h4 {
    margin-bottom: 16px;
    color: #ffffff;
}

.api-key-input {
    margin-bottom: 16px;
}

.api-key-input label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
}

.api-key-input input {
    width: 100%;
    padding: 10px 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
}

.api-key-input input::placeholder {
    color: #888;
}

.api-key-input input:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-secondary {
    background: #2a2a2a;
    color: #ffffff;
    border: 1px solid #3a3a3a;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #3a3a3a;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #888;
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 2px;
}

.typing-dots span {
    width: 4px;
    height: 4px;
    background: #888;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .main-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .url-input-container {
        max-width: none;
        margin-left: 0;
    }
    
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
    
    .welcome-content h1 {
        font-size: 24px;
    }
}