/* ==========================================================================
   🤖 DISCIPLINE ASSISTANT (COPILOT) GLOBAL STYLESHEET
   ========================================================================== */

/* Assistant Floating Orb */
#assistant-orb {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1f6feb, #238636);
    box-shadow: 0 8px 32px rgba(31, 111, 235, 0.4), 
                0 0 0 1px rgba(255, 255, 255, 0.1) inset,
                0 0 20px rgba(31, 111, 235, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99999;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    animation: orbPulse 3s infinite alternate;
}

#assistant-orb:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 12px 40px rgba(31, 111, 235, 0.6), 
                0 0 0 1px rgba(255, 255, 255, 0.2) inset,
                0 0 30px rgba(35, 134, 54, 0.8);
}

#assistant-orb:active {
    transform: scale(0.95);
}

#assistant-orb span {
    font-size: 26px;
    transition: transform 0.3s ease;
}

#assistant-orb.panel-open span {
    transform: rotate(135deg) scale(0.9);
}

/* Assistant Panel Container */
#assistant-panel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 580px;
    max-height: calc(100vh - 140px);
    border-radius: 16px;
    background: linear-gradient(155deg, rgba(13, 20, 30, 0.95), rgba(7, 11, 17, 0.98));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 
                0 0 0 1px rgba(88, 166, 255, 0.05) inset;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99998;
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.165, 0.84, 0.44, 1);
}

#assistant-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.assistant-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(22, 30, 43, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.assistant-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.assistant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1f6feb, #238636);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.assistant-title-box h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #ffffff;
}

.assistant-title-box span {
    font-size: 11px;
    color: #3fb950;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.assistant-title-box span::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3fb950;
    box-shadow: 0 0 8px #3fb950;
}

.assistant-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.assistant-header-btn {
    background: transparent;
    border: none;
    color: #8b949e;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.assistant-header-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.assistant-header-btn.close-btn:hover {
    background: #da3633;
    color: white;
}

/* Chat History Vewport */
.assistant-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

/* Bubble Styling */
.assistant-msg {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    animation: bubbleFadeIn 0.3s ease forwards;
}

.assistant-msg.coach {
    align-self: flex-start;
}

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

.msg-bubble {
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}

.assistant-msg.coach .msg-bubble {
    background: rgba(22, 30, 45, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #e6edf3;
    border-top-left-radius: 2px;
}

.assistant-msg.user .msg-bubble {
    background: linear-gradient(135deg, #1f6feb, #1752b4);
    color: #ffffff;
    border-top-right-radius: 2px;
    box-shadow: 0 4px 12px rgba(31, 111, 235, 0.15);
}

/* Inside coach bubble rich items */
.msg-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 12px;
}

.msg-bubble th, .msg-bubble td {
    padding: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

.msg-bubble th {
    color: #58a6ff;
    font-weight: 700;
}

.msg-bubble ul, .msg-bubble ol {
    margin: 6px 0;
    padding-left: 20px;
}

.msg-bubble li {
    margin-bottom: 4px;
}

.msg-time {
    font-size: 10px;
    color: #8b949e;
    margin-top: 4px;
    padding: 0 4px;
}

.assistant-msg.user .msg-time {
    text-align: right;
}

/* Insight Cards Inside Chat */
.chat-insight-card {
    background: rgba(88, 166, 255, 0.06);
    border: 1px solid rgba(88, 166, 255, 0.15);
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 6px;
    font-size: 12px;
}

.chat-insight-card.warning {
    background: rgba(210, 153, 34, 0.06);
    border-color: rgba(210, 153, 34, 0.2);
}

.chat-insight-card.strength {
    background: rgba(46, 160, 67, 0.06);
    border-color: rgba(46, 160, 67, 0.2);
}

.chat-insight-card-header {
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(22, 30, 45, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    border-top-left-radius: 2px;
    width: fit-content;
    align-self: flex-start;
    animation: bubbleFadeIn 0.2s ease forwards;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #8b949e;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* Suggestion Chips Box */
.assistant-chips-container {
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    scroll-behavior: smooth;
}

.assistant-chips-container::-webkit-scrollbar {
    height: 0px; /* Hide scrollbar for clean chip strip */
}

.suggestion-chip {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(31, 111, 235, 0.08);
    border: 1px solid rgba(31, 111, 235, 0.22);
    color: #58a6ff;
    border-radius: 20px;
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.suggestion-chip:hover {
    background: rgba(31, 111, 235, 0.16);
    border-color: #58a6ff;
    transform: translateY(-1.5px);
}

.suggestion-chip:active {
    transform: scale(0.95);
}

/* Slash Autocomplete Menu */
.slash-menu {
    position: absolute;
    bottom: 60px;
    left: 12px;
    right: 12px;
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.5);
    z-index: 99999;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    flex-direction: column;
}

.slash-item {
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    font-size: 12.5px;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.slash-item:last-child {
    border-bottom: none;
}

.slash-item:hover, .slash-item.selected {
    background: rgba(31, 111, 235, 0.15);
}

.slash-cmd {
    color: #58a6ff;
    font-weight: 700;
}

.slash-desc {
    color: #8b949e;
}

/* Footer & Input Area */
.assistant-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(13, 20, 30, 0.85);
    position: relative;
}

.assistant-input-wrap {
    display: flex;
    align-items: center;
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 4px 6px 4px 12px;
    transition: border-color 0.2s;
}

.assistant-input-wrap:focus-within {
    border-color: #1f6feb;
}

#assistant-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 13.5px;
    padding: 6px 0;
    outline: none;
    font-family: inherit;
}

#assistant-input::placeholder {
    color: #57606a;
}

.assistant-send-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1f6feb;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.assistant-send-btn:hover {
    background: #2a7df7;
    transform: scale(1.05);
}

.assistant-send-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: #57606a;
    cursor: not-allowed;
    transform: none;
}

/* Animations */
@keyframes orbPulse {
    0% {
        box-shadow: 0 8px 24px rgba(31, 111, 235, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    }
    100% {
        box-shadow: 0 8px 32px rgba(31, 111, 235, 0.6), 0 0 20px rgba(35, 134, 54, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    }
}

@keyframes bubbleFadeIn {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Custom Scrollbars for messages */
.assistant-messages::-webkit-scrollbar {
    width: 6px;
}
.assistant-messages::-webkit-scrollbar-track {
    background: transparent;
}
.assistant-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}
.assistant-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}



/* Light Theme Styling overrides */
body.light-theme #assistant-panel {
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.98), rgba(240, 244, 248, 0.98));
    border-color: #cbd5e1;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.02) inset;
}

body.light-theme .assistant-header {
    background: rgba(240, 244, 248, 0.5);
    border-bottom-color: #cbd5e1;
}

body.light-theme .assistant-title-box h3 {
    color: #0f172a;
}

body.light-theme .assistant-msg.coach .msg-bubble {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

body.light-theme .assistant-msg.user .msg-bubble {
    background: linear-gradient(135deg, #1f6feb, #1656b8);
    color: white;
}

body.light-theme .slash-menu {
    background: #ffffff;
    border-color: #cbd5e1;
}

body.light-theme .slash-item {
    border-bottom-color: #cbd5e1;
}

body.light-theme .slash-item:hover, body.light-theme .slash-item.selected {
    background: rgba(31, 111, 235, 0.1);
}

body.light-theme .assistant-footer {
    background: rgba(240, 244, 248, 0.85);
    border-top-color: #cbd5e1;
}

body.light-theme .assistant-input-wrap {
    background: white;
    border-color: #cbd5e1;
}

body.light-theme #assistant-input {
    color: #0f172a;
}

body.light-theme #assistant-input::placeholder {
    color: #94a3b8;
}


