/* ====================================
   Director AI Chatbot Styles
   ==================================== */

/* Floating Button */
.director-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    z-index: 9998;
}
.director-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}
.director-fab.open {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
}

/* Mobile: move FAB above bottom nav */
@media (max-width: 768px) {
    .director-fab {
        bottom: 80px;
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
}

/* Chat Window */
.director-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 420px;
    max-width: calc(100vw - 32px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: var(--bg-card, #fff);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px var(--border, #e5e7eb);
    display: flex;
    flex-direction: column;
    z-index: 9997;
    overflow: hidden;
    animation: director-slide-up 0.3s ease;
}

@keyframes director-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .director-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
}

/* Header */
.director-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    flex-shrink: 0;
}
.director-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}
.director-header-actions {
    display: flex;
    gap: 4px;
}
.director-header-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: background 0.2s;
}
.director-header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Presets Panel */
.director-presets {
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
}
.director-preset-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 10px;
    background: var(--bg, #f9fafb);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-size: 12px;
    line-height: 1.3;
}
.director-preset-btn:hover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
    transform: translateY(-1px);
}
.director-preset-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.director-preset-label {
    font-weight: 500;
    color: var(--text, #111827);
}
.director-preset-desc {
    font-size: 10px;
    color: var(--text-muted, #6b7280);
    margin-top: 2px;
}

/* Messages Area */
.director-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.director-msg {
    display: flex;
    flex-direction: column;
    max-width: 90%;
    animation: director-msg-in 0.2s ease;
}
@keyframes director-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.director-msg.user {
    align-self: flex-end;
}
.director-msg.assistant {
    align-self: flex-start;
}

.director-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}
.director-msg.user .director-msg-bubble {
    background: #6366f1;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.director-msg.assistant .director-msg-bubble {
    background: var(--bg, #f3f4f6);
    color: var(--text, #111827);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border, #e5e7eb);
}

.director-msg-time {
    font-size: 10px;
    color: var(--text-muted, #9ca3af);
    margin-top: 4px;
    padding: 0 4px;
}
.director-msg.user .director-msg-time {
    text-align: right;
}

/* Loading animation */
.director-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}
.director-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted, #9ca3af);
    animation: director-bounce 1.4s infinite ease-in-out both;
}
.director-typing span:nth-child(1) { animation-delay: -0.32s; }
.director-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes director-bounce {
    0%, 80%, 100% { transform: scale(0.6); }
    40% { transform: scale(1); }
}

/* Input Area */
.director-input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--border, #e5e7eb);
    flex-shrink: 0;
    background: var(--bg-card, #fff);
}
.director-input textarea {
    flex: 1;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    min-height: 38px;
    outline: none;
    background: var(--bg, #f9fafb);
    color: var(--text, #111827);
    transition: border-color 0.2s;
}
.director-input textarea:focus {
    border-color: #6366f1;
}
.director-input textarea::placeholder {
    color: var(--text-muted, #9ca3af);
}
.director-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: #6366f1;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
    flex-shrink: 0;
}
.director-send-btn:hover {
    background: #4f46e5;
}
.director-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Conversation List */
.director-conv-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.director-conv-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}
.director-conv-item:hover {
    background: var(--bg, #f3f4f6);
    border-color: var(--border, #e5e7eb);
}
.director-conv-item.active {
    background: rgba(99, 102, 241, 0.08);
    border-color: #6366f1;
}
.director-conv-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}
.director-conv-date {
    font-size: 10px;
    color: var(--text-muted, #9ca3af);
}
.director-conv-delete {
    background: none;
    border: none;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
}
.director-conv-item:hover .director-conv-delete {
    opacity: 1;
}
.director-conv-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Telegram Panel */
.director-telegram {
    padding: 16px;
    text-align: center;
}
.director-telegram-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 12px;
}
.director-telegram-status.linked {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.director-telegram-status.unlinked {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.director-telegram-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.director-telegram-btn.link {
    background: #0088cc;
    color: #fff;
}
.director-telegram-btn.link:hover {
    background: #0077b3;
}
.director-telegram-btn.unlink {
    background: var(--bg, #f3f4f6);
    color: var(--text-muted, #6b7280);
    border: 1px solid var(--border, #e5e7eb);
}
.director-telegram-btn.unlink:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* Tables in messages */
.director-table-wrap {
    overflow-x: auto;
    margin: 8px 0;
    border-radius: 8px;
    border: 1px solid var(--border, #e5e7eb);
}
.director-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.director-table-wrap th {
    background: var(--bg, #f3f4f6);
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--text, #111827);
    border-bottom: 2px solid var(--border, #e5e7eb);
    white-space: nowrap;
}
.director-table-wrap td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    color: var(--text, #374151);
}
.director-table-wrap tr:last-child td {
    border-bottom: none;
}
.director-table-wrap tr:hover td {
    background: rgba(99, 102, 241, 0.04);
}

/* Chart containers */
.director-chart-container {
    margin: 8px 0;
    padding: 8px;
    border-radius: 8px;
    background: var(--bg, #f9fafb);
    border: 1px solid var(--border, #e5e7eb);
}

/* User dropdown entry */
.bc-user-dropdown-item.director-item {
    color: #6366f1 !important;
    font-weight: 500;
}
.bc-user-dropdown-item.director-item i {
    color: #6366f1;
}
