/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0F0F23;
    --bg-secondary: #1A1A2E;
    --bg-card: #16213E;
    --accent: #8B5CF6;
    --accent-hover: #7C3AED;
    --text-primary: #FFFFFF;
    --text-secondary: #A0AEC0;
    --text-muted: #718096;
    --border: #2D3748;
    --success: #10B981;
    --error: #EF4444;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --radius: 16px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== Background Animation ===== */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        var(--bg-primary);
}

/* ===== Header ===== */
.header {
    text-align: center;
    padding: 2rem 1rem 1rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* ===== Navigation ===== */
.nav-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    position: sticky;
    top: 0;
    background: rgba(15, 15, 35, 0.9);
    backdrop-filter: blur(10px);
    z-index: 100;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.nav-tab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.tab-icon {
    font-size: 1.1rem;
}

/* ===== Container ===== */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: 100px;
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

.tab-content.hidden {
    display: none;
}

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

/* ===== Section Header ===== */
.section-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.section-header p {
    color: var(--text-secondary);
}

/* ===== Stories Grid ===== */
.stories-grid {
    display: grid;
    gap: 1rem;
}

.story-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.story-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.story-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.story-content {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.story-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.empty-state small {
    color: var(--text-muted);
}

/* ===== Form Card ===== */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.form-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.form-subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-group textarea,
.form-group input {
    width: 100%;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.3s ease;
}

.form-group textarea:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.char-counter {
    text-align: right;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* ===== Category Grid ===== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.category-btn {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.category-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.category-btn.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent) 0%, #7C3AED 100%);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

/* ===== Chat Container ===== */
.chat-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 250px);
    min-height: 400px;
}

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

.chat-header h2 {
    font-size: 1.1rem;
}

.online-badge {
    background: var(--success);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-message {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    animation: slideIn 0.2s ease;
}

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

.chat-message.own {
    background: var(--accent);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.other {
    background: var(--bg-secondary);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-username {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.chat-message.own .chat-username {
    color: rgba(255,255,255,0.7);
}

.chat-text {
    font-size: 0.9rem;
    word-wrap: break-word;
}

.chat-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    text-align: right;
}

.chat-message.own .chat-time {
    color: rgba(255,255,255,0.5);
}

/* Agent Message */
.chat-message.agent {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    border: 1px solid #A78BFA;
}

.chat-message.agent .chat-username {
    color: #E9D5FF;
}

.chat-message.agent .chat-time {
    color: rgba(255,255,255,0.6);
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #A78BFA;
    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% { transform: translateY(0); opacity: 0.6; }
    30% { transform: translateY(-8px); opacity: 1; }
}

.chat-system {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.chat-system small {
    display: block;
    margin-top: 0.25rem;
    opacity: 0.7;
}

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

.mood-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.mood-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.mood-btn:hover {
    border-color: var(--accent);
    transform: scale(1.1);
}

.mood-btn.selected {
    background: var(--accent);
    border-color: var(--accent);
}

.chat-input-row {
    display: flex;
    gap: 0.5rem;
}

.chat-input-row input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
}

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

.btn-send {
    width: 48px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-send:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 640px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .nav-tabs {
        gap: 0.25rem;
        padding: 0.75rem;
    }
    
    .nav-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .tab-text {
        display: none;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .chat-message {
        max-width: 90%;
    }
}
