/* ==============================================================================
   WORKSPACE365 AI — ULTRA-PREMIUM CYBER DARK THEME
   Directly matching the design system of https://workspace365.in/
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
    /* WORKSPACE365 Official Palette */
    --bg-main: #050505;
    --bg-sidebar: #0a0d14;
    --bg-card: rgba(15, 20, 32, 0.7);
    --bg-card-hover: rgba(22, 30, 48, 0.85);
    
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 240, 255, 0.35);
    
    --msg-user: rgba(0, 102, 255, 0.12);
    --msg-ai: rgba(15, 20, 32, 0.85);
    
    --accent: #00f0ff;          /* Cyber Neon Cyan */
    --accent-secondary: #0066ff;/* Electric Blue */
    --accent-orange: #ff5e00;   /* Neon Orange */
    --accent-hover: #00d4e3;
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-sidebar: #f1f5f9;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-glow: rgba(0, 102, 255, 0.35);
    --msg-user: #e0f2fe;
    --msg-ai: #ffffff;
    --accent: #0066ff;
    --accent-secondary: #00f0ff;
    --accent-hover: #0052cc;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
}

h1, h2, h3, h4, .brand-title {
    font-family: var(--font-heading);
    letter-spacing: -0.02em;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(0, 240, 255, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(0, 102, 255, 0.04) 0%, transparent 40%);
}

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

/* ==============================================================================
   SIDEBAR
   ============================================================================== */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 16px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
    z-index: 10;
}

.new-chat-btn {
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.12), rgba(0, 102, 255, 0.12));
    border: 1px solid var(--border-glow);
    border-radius: 10px;
    color: var(--accent);
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.new-chat-btn:hover {
    background: linear-gradient(135deg, #00f0ff, #0066ff);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.35);
    border-color: transparent;
    transform: translateY(-1px);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.history-list::-webkit-scrollbar {
    width: 4px;
}
.history-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.history-item {
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-muted);
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid transparent;
}

.history-item:hover {
    background-color: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border-color);
}

.history-item.active {
    background: rgba(0, 240, 255, 0.08);
    color: var(--accent);
    border-color: rgba(0, 240, 255, 0.25);
    font-weight: 500;
}

.history-item .delete-chat {
    opacity: 0;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.history-item:hover .delete-chat {
    opacity: 1;
}

.history-item .delete-chat:hover {
    color: #ef4444;
}

.sidebar-footer {
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer button {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px 14px;
    width: 100%;
    text-align: left;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.2s;
}

.sidebar-footer button:hover {
    background-color: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border-color);
}

/* ==============================================================================
   MAIN CHAT AREA
   ============================================================================== */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-main);
    position: relative;
}

.chat-header {
    height: 64px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: rgba(10, 13, 20, 0.6);
    backdrop-filter: blur(12px);
    z-index: 5;
}

.chat-header h2 {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #00f0ff, #0066ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

.search-toggle {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.search-toggle input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
}

.mode-selector {
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.mode-selector:hover, .mode-selector:focus {
    border-color: var(--border-glow);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

/* ==============================================================================
   CHAT MESSAGES
   ============================================================================== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px 0;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 6px;
}

/* Empty State / Welcome Screen */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 20px rgba(0, 240, 255, 0.4));
}

.empty-state h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
    font-family: var(--font-heading);
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 24px;
    color: var(--text-muted);
}

/* Suggestion Grid (Cards) */
.suggestion-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    max-width: 640px;
    width: 100%;
}

.suggestion-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-main);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(8px);
}

.suggestion-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 240, 255, 0.15);
    color: var(--accent);
}

/* Message Rows */
.message {
    display: flex;
    padding: 20px calc((100% - 760px) / 2);
    gap: 16px;
    transition: background-color 0.2s;
}

.message.user {
    background-color: var(--msg-user);
    border-top: 1px solid rgba(0, 102, 255, 0.06);
    border-bottom: 1px solid rgba(0, 102, 255, 0.06);
}

.message.ai {
    background-color: transparent;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    font-family: var(--font-heading);
}

.message.user .avatar {
    background: linear-gradient(135deg, #0066ff, #00f0ff);
    color: #000;
    box-shadow: 0 0 12px rgba(0, 102, 255, 0.4);
}

.message.ai .avatar {
    background: linear-gradient(135deg, #00f0ff, #ff5e00);
    color: #000;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.content {
    flex: 1;
    line-height: 1.7;
    font-size: 14px;
    color: var(--text-main);
    word-break: break-word;
}

.content p {
    margin-bottom: 14px;
}

.content p:last-child {
    margin-bottom: 0;
}

/* Markdown Code Blocks */
.content pre {
    background: #020408 !important;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 16px;
    margin: 14px 0;
    overflow-x: auto;
}

.content code {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 13px;
}

.content :not(pre) > code {
    background: rgba(0, 240, 255, 0.1);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Copy Button on AI responses */
.copy-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    color: var(--text-muted);
    margin-top: 10px;
    display: inline-block;
    transition: all 0.2s;
    font-family: var(--font-heading);
}

.copy-btn:hover {
    background: rgba(0, 240, 255, 0.15);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

/* Streaming Cursor */
.streaming-cursor::after {
    content: '▌';
    color: var(--accent);
    animation: blink 0.7s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Generated Image */
.generated-image {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 12px;
    border: 1px solid var(--border-glow);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 240, 255, 0.15);
}

/* Voice Recording State */
#voice-btn.recording {
    color: #ef4444 !important;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.15); }
}

/* ==============================================================================
   INPUT CONTAINER
   ============================================================================== */
.chat-input-container {
    padding: 0 20px 20px 20px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.input-wrapper {
    background: rgba(15, 20, 32, 0.85);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    display: flex;
    align-items: center;
    padding: 8px 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: all 0.25s ease;
    backdrop-filter: blur(12px);
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 240, 255, 0.25);
}

.attachment-btn {
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 6px;
    transition: color 0.2s;
    user-select: none;
}

.attachment-btn:hover {
    color: var(--accent);
}

#voice-btn, #image-gen-btn {
    transition: all 0.2s;
}
#voice-btn:hover, #image-gen-btn:hover {
    transform: scale(1.15);
    color: var(--accent) !important;
}

textarea#message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    max-height: 200px;
    resize: none;
    outline: none;
}

textarea#message-input::placeholder {
    color: var(--text-muted);
}

#send-btn {
    background: linear-gradient(135deg, #00f0ff, #0066ff);
    border: none;
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

#send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

#send-btn:disabled {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
}

.disclaimer {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 10px;
}

/* ==============================================================================
   ADSENSE & LEGAL LINKS
   ============================================================================== */
.ad-slot {
    background: rgba(15, 20, 32, 0.6);
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    padding: 10px;
    margin: 12px 0;
    text-align: center;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sidebar-ad {
    margin: 14px 4px;
}

.ad-badge {
    font-size: 9px;
    color: var(--accent);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 6px;
    opacity: 0.8;
}

.legal-links {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.legal-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.legal-links a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* ==============================================================================
   MODAL (SETTINGS & MEMORY)
   ============================================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #0a0d14;
    border: 1px solid var(--border-glow);
    border-radius: 14px;
    padding: 24px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 240, 255, 0.15);
}

.modal-content h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

/* ==============================================================================
   RESPONSIVE
   ============================================================================== */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    .message {
        padding: 16px 20px;
    }
    .suggestion-grid {
        grid-template-columns: 1fr;
    }
}
