:root {
    --charcoal-primary: #1a1a1a;
    --charcoal-secondary: #2d2d2d;
    --charcoal-tertiary: #3d3d3d;
    --gold-primary: #f59e0b;
    --gold-secondary: #fbbf24;
    --gold-gradient: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --border-color: rgba(255, 255, 255, 0.1);
    --success-color: #22c55e;
    --error-color: #ef4444;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--charcoal-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

.dashboard-header {
    background: linear-gradient(135deg, var(--charcoal-primary) 0%, var(--charcoal-secondary) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.header-logo img {
    height: 40px;
    width: auto;
}

.header-logo span {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--charcoal-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 220px;
    padding: 0.5rem 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    margin-top: 0.5rem;
}

.nav-dropdown:hover .nav-dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.tier-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    color: var(--gold-primary);
    background: rgba(245, 158, 11, 0.15);
    border-radius: 20px;
    margin-left: 0.5rem;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #2c5530, #3a6e3f);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.user-button.admin {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.loading-small {
    padding: 0.6rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.main-content {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 400px;
    max-height: calc(100vh - 320px);
}

.welcome-message {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.welcome-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.welcome-message h2 {
    color: var(--gold-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.welcome-message p {
    color: var(--text-muted);
}

.message {
    max-width: 80%;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    line-height: 1.6;
}

.user-message {
    align-self: flex-end;
    background: var(--gold-gradient);
    color: var(--charcoal-primary);
    border-bottom-right-radius: 4px;
}

.ai-message {
    align-self: flex-start;
    background: var(--charcoal-tertiary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message-content {
    word-wrap: break-word;
}

.message-meta {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    opacity: 0.7;
}

.user-message .message-meta {
    color: var(--charcoal-secondary);
}

.ai-message .message-meta {
    color: var(--text-muted);
}

.loading-dots span {
    animation: blink 1.4s infinite both;
}

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

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

@keyframes blink {
    0%, 80%, 100% { opacity: 0.2; }
    40% { opacity: 1; }
}

.chat-input-container {
    padding: 1rem 1.5rem;
    background: var(--charcoal-secondary);
    border-top: 1px solid var(--border-color);
}

.chat-form {
    display: flex;
    gap: 0.75rem;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.875rem 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.chat-input:focus {
    border-color: var(--gold-secondary);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.chat-submit {
    background: var(--gold-gradient);
    border: none;
    border-radius: 8px;
    padding: 0.875rem 1.25rem;
    color: var(--charcoal-primary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

.chat-submit:active:not(:disabled) {
    transform: translateY(0);
}

.chat-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--charcoal-tertiary);
}

.submit-icon {
    font-size: 1.25rem;
}

.input-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.app-footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

.app-footer a {
    color: var(--gold-secondary);
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .header-nav {
        gap: 0.5rem;
    }

    .nav-item {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .main-content {
        padding: 0.75rem;
    }

    .chat-messages {
        min-height: 300px;
        padding: 1rem;
    }

    .message {
        max-width: 90%;
    }
}
