/* ============================================================
   Nico'Immo - Assistant Plugin Styles
   ============================================================ */

/* ── Toggle Button ────────────────────────────────────────── */

.assistant-toggle {
    position: fixed;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #00d4ff;
    background: linear-gradient(135deg, #0a1628 0%, #050d1a 100%);
    cursor: pointer;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3), inset 0 0 10px rgba(0, 212, 255, 0.1);
}

.assistant-toggle:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.5), inset 0 0 15px rgba(0, 212, 255, 0.2);
    border-color: #00ffcc;
}

.assistant-toggle.active {
    border-color: #00ffcc;
    box-shadow: 0 0 25px rgba(0, 255, 204, 0.4);
}

.assistant-toggle-icon {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 22px;
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.assistant-toggle.active .assistant-toggle-icon {
    color: #00ffcc;
}

.assistant-pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid rgba(0, 212, 255, 0.4);
    animation: assistant-pulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes assistant-pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.assistant-toggle.has-unread .assistant-pulse-ring {
    border-color: #ffd700;
    animation: assistant-pulse-urgent 1s ease-in-out infinite;
}

@keyframes assistant-pulse-urgent {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

.assistant-unread {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ffd700;
    color: #050d1a;
    font-family: 'Rajdhani', sans-serif;
    font-size: 12px;
    font-weight: 600;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Panel ────────────────────────────────────────────────── */

.assistant-panel {
    position: fixed;
    top: 50%;
    left: 80px;
    transform: translateY(-50%) translateX(-20px) scale(0.95);
    width: 380px;
    height: 520px;
    background: linear-gradient(180deg, #0d1f3c 0%, #050d1a 100%);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    z-index: 1150;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 212, 255, 0.1);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.assistant-panel.open {
    opacity: 1;
    transform: translateY(-50%) translateX(0) scale(1);
    pointer-events: all;
}

/* ── Panel Header ─────────────────────────────────────────── */

.assistant-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 212, 255, 0.05);
    border-bottom: 1px solid rgba(0, 212, 255, 0.15);
    flex-shrink: 0;
}

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

.assistant-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #555;
    transition: background 0.3s;
}

.assistant-status-dot.connected {
    background: #00ff88;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

.assistant-status-dot.error {
    background: #ff4444;
    box-shadow: 0 0 8px rgba(255, 68, 68, 0.5);
}

.assistant-header-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #00d4ff;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.assistant-btn-minimize {
    background: none;
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: #00d4ff;
    font-size: 18px;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.assistant-btn-minimize:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: #00d4ff;
}

/* ── Messages Area ────────────────────────────────────────── */

.assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.2) transparent;
}

.assistant-messages::-webkit-scrollbar {
    width: 4px;
}

.assistant-messages::-webkit-scrollbar-track {
    background: transparent;
}

.assistant-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 212, 255, 0.2);
    border-radius: 2px;
}

/* ── Message Bubbles ──────────────────────────────────────── */

.assistant-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 10px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
}

.assistant-message.user {
    align-self: flex-end;
    background: rgba(0, 212, 255, 0.12);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-bottom-right-radius: 2px;
    color: #e0f7ff;
}

.assistant-message.assistant {
    align-self: flex-start;
    background: rgba(255, 215, 0, 0.06);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-bottom-left-radius: 2px;
    color: #fff8e1;
}

.assistant-message.system {
    align-self: center;
    max-width: 90%;
    background: rgba(0, 255, 204, 0.05);
    border: 1px solid rgba(0, 255, 204, 0.1);
    color: rgba(0, 255, 204, 0.7);
    font-size: 12px;
    text-align: center;
    border-radius: 6px;
    padding: 6px 12px;
}

.assistant-message-text {
    margin: 0;
}

.assistant-message-text pre {
    margin: 4px 0 0;
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    white-space: pre-wrap;
    color: inherit;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 4px;
}

.assistant-message-text strong {
    color: #ffd700;
}

.assistant-message-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 4px;
    text-align: right;
}

/* ── Action Badges ────────────────────────────────────────── */

.assistant-action-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.assistant-action-badge {
    display: inline-block;
    font-family: 'Rajdhani', sans-serif;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0, 255, 204, 0.1);
    border: 1px solid rgba(0, 255, 204, 0.3);
    color: #00ffcc;
    letter-spacing: 0.5px;
}

/* ── Typing Indicator ─────────────────────────────────────── */

.assistant-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    flex-shrink: 0;
}

.assistant-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.5);
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.assistant-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.assistant-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ── Input Area ───────────────────────────────────────────── */

.assistant-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(0, 212, 255, 0.15);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.assistant-input {
    flex: 1;
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    color: #e0f7ff;
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.assistant-input:focus {
    border-color: #00d4ff;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.15);
}

.assistant-input::placeholder {
    color: rgba(0, 212, 255, 0.35);
}

.assistant-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.assistant-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.assistant-send-btn:hover:not(:disabled) {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

.assistant-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 480px) {
    .assistant-panel {
        width: calc(100vw - 16px);
        left: 8px;
        top: auto;
        bottom: 80px;
        height: 60vh;
        transform: translateY(20px) scale(0.95);
    }

    .assistant-panel.open {
        transform: translateY(0) scale(1);
    }

    .assistant-toggle {
        left: 8px;
        top: auto;
        bottom: 12px;
        transform: none;
        width: 48px;
        height: 48px;
    }

    .assistant-toggle:hover {
        transform: scale(1.1);
    }

    .assistant-toggle-icon {
        font-size: 18px;
    }
}

/* Thinking animation */
.assistant-thinking .assistant-message-text {
    opacity: 0.7;
}

.thinking-dots span {
    animation: thinkingDot 1.4s infinite;
    font-weight: bold;
    font-size: 1.2em;
}

.thinking-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinkingDot {
    0%, 20% { opacity: 0.2; }
    40% { opacity: 1; }
    60%, 100% { opacity: 0.2; }
}

/* ── Attach Button ───────────────────────────────────────── */

.assistant-attach-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(0, 212, 255, 0.2);
    background: rgba(0, 212, 255, 0.05);
    color: #00d4ff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.assistant-attach-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: #00d4ff;
    box-shadow: 0 0 8px rgba(0, 212, 255, 0.15);
}

/* ── CSV Preview Modal ───────────────────────────────────── */

.csv-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.csv-preview-overlay.visible {
    opacity: 1;
}

.csv-preview-modal {
    width: 90vw;
    max-width: 720px;
    max-height: 80vh;
    background: linear-gradient(180deg, #0d1f3c 0%, #050d1a 100%);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 212, 255, 0.1);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.csv-preview-overlay.visible .csv-preview-modal {
    transform: scale(1);
}

.csv-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.15);
    flex-shrink: 0;
}

.csv-preview-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #00d4ff;
    letter-spacing: 0.5px;
}

.csv-preview-count {
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

.csv-preview-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 18px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.1);
    flex-shrink: 0;
}

.csv-col-badge {
    font-family: 'Rajdhani', sans-serif;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.3px;
}

.csv-col-badge.found {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: #00ff88;
}

.csv-col-badge.missing {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    color: #ff4444;
}

.csv-col-badge.optional {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.4);
}

.csv-preview-table-wrap {
    flex: 1;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.2) transparent;
}

.csv-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Rajdhani', sans-serif;
    font-size: 12px;
}

.csv-preview-table th {
    position: sticky;
    top: 0;
    background: rgba(0, 212, 255, 0.08);
    color: #00d4ff;
    font-weight: 600;
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 212, 255, 0.2);
    white-space: nowrap;
    z-index: 1;
}

.csv-preview-table td {
    padding: 4px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: #e0f7ff;
    white-space: nowrap;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.csv-preview-table tr:hover td {
    background: rgba(0, 212, 255, 0.04);
}

.csv-preview-table .row-num {
    color: rgba(255, 255, 255, 0.25);
    font-size: 11px;
    width: 30px;
}

.csv-preview-more {
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
    padding: 8px !important;
}

.csv-preview-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid rgba(0, 212, 255, 0.15);
    flex-shrink: 0;
}

.csv-preview-warn {
    font-family: 'Rajdhani', sans-serif;
    font-size: 12px;
    color: #ffd700;
    margin-right: auto;
}

.csv-preview-error {
    font-family: 'Rajdhani', sans-serif;
    font-size: 12px;
    color: #ff4444;
    margin-right: auto;
}

.csv-preview-btn {
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid;
}

.csv-preview-btn.cancel {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
}

.csv-preview-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.csv-preview-btn.confirm {
    background: rgba(0, 255, 136, 0.15);
    border-color: rgba(0, 255, 136, 0.4);
    color: #00ff88;
}

.csv-preview-btn.confirm:hover:not(:disabled) {
    background: rgba(0, 255, 136, 0.25);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

.csv-preview-btn.confirm:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Transposed format badge */
.csv-transposed-badge {
    display: inline-block;
    font-family: 'Rajdhani', sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    margin-left: 8px;
    border-radius: 4px;
    background: rgba(255, 170, 0, 0.15);
    border: 1px solid rgba(255, 170, 0, 0.4);
    color: #ffaa00;
    vertical-align: middle;
}

/* Fuzzy match source indicator */
.csv-col-source {
    font-size: 10px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
    margin-left: 2px;
}

/* Matched column highlighting in table */
.csv-preview-table th.matched {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
}

.csv-preview-table td.matched {
    background: rgba(0, 255, 136, 0.03);
}

/* ── Report Modal ────────────────────────────────────────── */

.report-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.report-overlay.visible {
    opacity: 1;
}

.report-modal {
    width: 90vw;
    max-width: 800px;
    max-height: 85vh;
    background: linear-gradient(180deg, #0d1f3c 0%, #050d1a 100%);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 212, 255, 0.1);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.report-overlay.visible .report-modal {
    transform: scale(1);
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.15);
    flex-shrink: 0;
}

.report-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #00d4ff;
    letter-spacing: 0.5px;
    margin: 0;
}

.report-actions {
    display: flex;
    gap: 6px;
}

.report-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.05);
    color: #00d4ff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.report-btn:hover {
    background: rgba(0, 212, 255, 0.15);
    border-color: #00d4ff;
}

.report-btn.close {
    font-size: 20px;
}

.report-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    color: #e0f7ff;
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    line-height: 1.7;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 212, 255, 0.2) transparent;
}

.report-content h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    color: #00d4ff;
    margin: 24px 0 12px;
    border-bottom: 1px solid rgba(0, 212, 255, 0.15);
    padding-bottom: 6px;
}

.report-content h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    color: #00d4ff;
    margin: 20px 0 10px;
}

.report-content h3 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #00ffcc;
    margin: 16px 0 8px;
}

.report-content p {
    margin: 8px 0;
}

.report-content ul, .report-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.report-content li {
    margin: 4px 0;
}

.report-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
}

.report-content th {
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    font-weight: 600;
    text-align: left;
}

.report-content th,
.report-content td {
    border: 1px solid rgba(0, 212, 255, 0.15);
    padding: 8px 12px;
    font-size: 13px;
}

.report-content tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.15);
}

.report-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 13px;
    color: #ffd700;
}

.report-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 14px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 12px 0;
}

.report-content pre code {
    background: none;
    padding: 0;
    color: #e0f7ff;
}

.report-content strong {
    color: #ffd700;
}

.report-content em {
    color: rgba(255, 255, 255, 0.7);
}

.report-content .mermaid {
    margin: 16px 0;
    text-align: center;
}

.report-content .mermaid svg {
    max-width: 100%;
}
