/* Dark Theme - Othership */
:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-elevated: #334155;
    --bg-input: #1e293b;
    --border-subtle: rgba(148, 163, 184, 0.12);
    --border-accent: rgba(45, 212, 191, 0.3);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #2dd4bf;
    --accent-hover: #5eead4;
    --accent-dim: rgba(45, 212, 191, 0.15);
    --header-bg: linear-gradient(135deg, #0f766e 0%, #0d9488 50%, #14b8a6 100%);
    --user-msg-bg: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
    --bot-msg-bg: #334155;
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-lg: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
}

.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 2rem;
}

.main-content h1 {
    font-size: 2.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2dd4bf 0%, #5eead4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.main-content p {
    font-size: 1.1rem;
    margin-top: 1rem;
    color: var(--text-secondary);
}

/* Chat Launcher */
.chat-launcher {
    position: fixed;
    bottom: 28px;
    left: 28px;
    width: 56px;
    height: 56px;
    background: var(--header-bg);
    color: white;
    border: none;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 999;
}

.chat-launcher:hover {
    transform: scale(1.05);
    box-shadow: 0 0 24px rgba(45, 212, 191, 0.4);
}

/* Chat Widget Container */
.chat-widget-container {
    position: fixed;
    bottom: 96px;
    left: 28px;
    width: 400px;
    height: 580px;
    max-height: calc(100vh - 130px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transform: scale(0.5) translateY(50%);
    opacity: 0;
    transform-origin: bottom left;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    z-index: 1000;
    display: flex;
    pointer-events: none;
    border: 1px solid var(--border-subtle);
}

.chat-widget-container.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.chat-widget-container.fullscreen {
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    bottom: 0;
    border-radius: 0;
    max-height: 100vh;
    border: none;
}

.chat-widget {
    width: 100%;
    height: 100%;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
}

/* Chat Header */
.chat-header {
    background: var(--header-bg);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header-title h2 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.chat-header-buttons {
    display: flex;
    gap: 8px;
}

.chat-header-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.chat-header-btn-clear {
    background: rgba(255, 255, 255, 0.15);
}

.chat-header-btn.is-hidden {
    display: none;
}

/* Chat Views */
.chat-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#main-menu {
    justify-content: flex-start;
    align-items: center;
    padding: 0;
    overflow-y: auto;
}

.main-menu-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.main-menu-header {
    background: var(--header-bg);
    color: white;
    padding: 28px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.platform-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: white;
    letter-spacing: -0.02em;
}

.platform-subtitle {
    font-size: 0.9rem;
    margin: 6px 0 0 0;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
}

.menu-cards {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    flex: 1;
    justify-content: center;
}

.menu-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 22px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.menu-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 1px var(--accent-dim), 0 8px 24px rgba(0, 0, 0, 0.3);
}

.menu-card-icon {
    font-size: 2.25rem;
    margin-bottom: 10px;
    display: block;
}

.menu-card h3 {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    font-weight: 600;
}

.menu-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.45;
}

/* Back Button */
.back-button {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 10px 16px;
    align-self: flex-start;
    border-radius: 8px;
    transition: background 0.2s;
}

.back-button:hover {
    background: var(--accent-dim);
}

/* Assignment View Header */
.assignment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
}

.session-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.session-badge {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-subtle);
}

.btn-secondary {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--accent);
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-card);
}

/* Messages */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    animation: fadeIn 0.35s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.bot-avatar {
    background: var(--header-bg);
    color: white;
}

.user-avatar {
    background: var(--bg-elevated);
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-text {
    padding: 14px 18px;
    border-radius: var(--radius);
    line-height: 1.55;
    font-size: 0.95rem;
    color: var(--text-primary);
    word-wrap: break-word;
}

.bot-message .message-text {
    background: var(--bot-msg-bg);
    border: 1px solid var(--border-subtle);
    border-top-left-radius: 4px;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-text {
    background: var(--user-msg-bg);
    color: white;
    border: none;
    border-top-right-radius: 4px;
}

.message-text strong {
    font-weight: 600;
}

.message-text p, .message-text ul {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.message-text ul {
    padding-left: 1.2em;
}

/* Input Container */
.input-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 14px 18px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-card);
    gap: 10px;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.input-field {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    resize: none;
    max-height: 120px;
    min-height: 44px;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.input-field::placeholder {
    color: var(--text-muted);
}

.input-field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.btn-send {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
    border: none;
    background: var(--header-bg);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 0 16px rgba(45, 212, 191, 0.4);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Microphone Button */
.btn-mic {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 18px;
}

.btn-mic:hover {
    background: var(--bg-elevated);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-mic.recording {
    background: #dc2626;
    border-color: #b91c1c;
    color: white;
    animation: mic-pulse 1.5s infinite;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5); }
    50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 380px;
    width: 90%;
    box-shadow: var(--shadow);
}

.modal-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.modal-content p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-cancel {
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.modal-btn-cancel:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.modal-btn-confirm {
    background: var(--header-bg);
    color: white;
}

.modal-btn-confirm:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Scrollbar */
.chat-container::-webkit-scrollbar { width: 6px; }
.chat-container::-webkit-scrollbar-track { background: transparent; }
.chat-container::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 3px;
}
.chat-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 480px) {
    .chat-widget-container {
        width: calc(100% - 36px);
        left: 18px;
        bottom: 88px;
        height: calc(100vh - 110px);
    }
    .chat-launcher {
        bottom: 18px;
        left: 18px;
    }
    .main-content h1 { font-size: 2rem; }
    .input-container { padding: 12px; }
    .btn-send, .btn-mic {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }
    .input-field { font-size: 0.85rem; padding: 10px 14px; }
}
