/**
 * kAI Components Styles
 * 
 * Styling for persistent kAI components including:
 * - Floating kAI button (bottom-right)
 * - kAI side panel (chat interface)
 * - Toast notifications
 * - Tab notification indicators
 * - Context-aware inline suggestions
 */

/* ===== FLOATING kAI BUTTON ===== */

.kai-floating-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    box-shadow: var(--shadow-lg), 0 0 0 0 rgba(91, 71, 251, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    z-index: 1000;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: var(--shadow-lg), 0 0 0 0 rgba(91, 71, 251, 0.4);
    }
    50% {
        box-shadow: var(--shadow-lg), 0 0 0 8px rgba(91, 71, 251, 0);
    }
    100% {
        box-shadow: var(--shadow-lg), 0 0 0 0 rgba(91, 71, 251, 0);
    }
}

.kai-floating-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

.kai-floating-btn.panel-open {
    background: var(--gray-700);
    animation: none;
}

.kai-floating-btn .close-icon {
    display: none;
}

.kai-floating-btn.panel-open .kai-icon-btn {
    display: none;
}

.kai-floating-btn.panel-open .close-icon {
    display: block;
}

/* ===== kAI SIDE PANEL ===== */

.kai-side-panel {
    position: fixed;
    top: 0;
    right: -440px;
    width: 440px;
    height: 100vh;
    background: var(--gray-50);
    border-left: 1px solid var(--gray-200);
    transition: right 0.3s ease, top 0.3s ease, height 0.3s ease;
    z-index: 999;
    display: flex;
    flex-direction: column;
}

.kai-side-panel.open {
    right: 0;
}

/* Push content left when panel is open */
.container {
    transition: margin-right 0.3s ease;
}

.kai-side-panel.open ~ .container,
.kai-panel-open-body .container {
    margin-right: 440px;
}

.kai-panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    background: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.kai-panel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.kai-panel-title-section {
    flex: 1;
}

.kai-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 2px;
}

.kai-panel-subtitle {
    font-size: 13px;
    color: var(--gray-600);
}

.kai-panel-close {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 18px;
}

.kai-panel-close:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

/* Mode Tabs */
.kai-panel-tabs {
    display: flex;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 16px;
}

.kai-panel-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--gray-600);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.kai-panel-tab:hover {
    color: var(--gray-900);
    background: var(--gray-50);
}

.kai-panel-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.kai-panel-tab .tab-icon {
    font-size: 16px;
}

.kai-panel-tab .tab-label {
    font-weight: 500;
}

/* Mode Content */
.kai-panel-mode-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.kai-panel-mode-content.hidden {
    display: none;
}

.kai-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--gray-50);
}

.kai-panel-message {
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: fadeIn 0.3s ease;
}

.kai-panel-message.user {
    align-items: flex-end;
}

.kai-panel-message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.kai-panel-message.user .kai-panel-message-bubble {
    background: var(--primary);
    color: white;
}

.kai-panel-message.assistant .kai-panel-message-bubble {
    background: white;
    color: var(--gray-900);
    border: 1px solid var(--gray-200);
}

.kai-panel-message-time {
    font-size: 11px;
    color: var(--gray-500);
    padding: 0 4px;
}

.kai-panel-input-wrapper {
    padding: 16px;
    border-top: 1px solid var(--gray-200);
    background: white;
}

.kai-panel-input-container {
    position: relative;
    display: flex;
    align-items: flex-end;
}

.kai-panel-input {
    flex: 1;
    padding: 12px 48px 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    line-height: 1.5;
    transition: all 0.2s;
    background: white;
}

.kai-panel-input:focus {
    outline: none;
    border-color: var(--gray-400);
    background: white;
}

.kai-panel-send-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kai-panel-send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.kai-panel-send-btn:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    transform: none;
}

.kai-panel-send-btn:disabled:hover {
    transform: none;
}

/* ===== SUGGESTIONS MODE ===== */

.kai-suggestions-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--gray-50);
}

.kai-suggestion-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.kai-suggestion-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(91, 71, 251, 0.1);
}

.kai-suggestion-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.kai-suggestion-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.kai-suggestion-content {
    flex: 1;
}

.kai-suggestion-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.kai-suggestion-description {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.5;
}

.kai-suggestion-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.kai-suggestion-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-700);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.kai-suggestion-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.kai-suggestion-btn.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.kai-suggestion-btn.primary:hover {
    background: var(--primary-dark);
}

.kai-suggestions-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--gray-500);
}

.kai-suggestions-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.kai-suggestions-empty-text {
    font-size: 14px;
    line-height: 1.6;
}

/* ===== TAB NOTIFICATION INDICATORS ===== */

.nav-link {
    position: relative;
}

.nav-link .notification-dot {
    position: absolute;
    top: 8px;
    right: -8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 0 0 var(--warning);
    animation: notification-pulse 2s infinite;
}

@keyframes notification-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

/* ===== TOAST NOTIFICATIONS ===== */

.toast-container {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 1001;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    padding: 16px 20px;
    min-width: 300px;
    max-width: 400px;
    display: flex;
    align-items: start;
    gap: 12px;
    border-left: 4px solid var(--success);
    animation: toastSlideIn 0.3s ease;
    pointer-events: auto;
    transition: all 0.3s ease;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.removing {
    animation: toastSlideOut 0.3s ease;
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.toast-message {
    font-size: 13px;
    color: var(--gray-600);
}

.toast-close {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* ===== CONTEXT-AWARE INLINE SUGGESTIONS ===== */

.kai-inline-suggestion {
    display: none;
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease;
}

.kai-inline-suggestion.active {
    display: block;
}

/* ===== CREATION PROGRESS MODAL ===== */

.creation-progress-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.creation-progress-overlay.active {
    display: flex;
}

.creation-progress-modal {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-2xl);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow: hidden;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.creation-progress-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 32px;
    text-align: center;
}

.creation-progress-avatar {
    font-size: 48px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.creation-progress-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.creation-progress-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.creation-progress-body {
    padding: 32px;
    max-height: calc(85vh - 180px);
    overflow-y: auto;
}

.creation-progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 32px;
}

.creation-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.creation-workflow-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.workflow-step {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.workflow-step.active {
    background: var(--primary-light);
    border-color: var(--primary);
}

.workflow-step.completed {
    background: var(--success-light);
    border-color: var(--success);
}

.workflow-step-icon {
    font-size: 28px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.workflow-step.active .workflow-step-icon {
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.workflow-step.completed .workflow-step-icon {
    filter: grayscale(0);
}

.workflow-step-content {
    flex: 1;
}

.workflow-step-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.workflow-step-description {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.4;
}

.workflow-step-status {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.workflow-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.workflow-step.completed .workflow-step-status::before {
    content: '✓';
    font-size: 20px;
    font-weight: 700;
    color: var(--success);
}

.creation-activity-message {
    padding: 16px;
    background: var(--gray-100);
    border-radius: 8px;
    text-align: center;
    color: var(--gray-700);
    font-size: 14px;
    font-style: italic;
    animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

/* ===== CONFIRMATION MODAL ===== */

.confirmation-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 10001;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.confirmation-modal-overlay.active {
    display: flex;
}

.confirmation-modal {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-2xl);
    padding: 32px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.confirmation-modal-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.confirmation-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.confirmation-modal-message {
    font-size: 14px;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 24px;
}

.confirmation-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirmation-modal-actions .btn {
    min-width: 100px;
}

/* ===== MOBILE ADJUSTMENTS ===== */

@media (max-width: 768px) {
    .kai-side-panel {
        width: 100%;
        right: -100%;
    }

    .toast-container {
        bottom: 90px;
        right: 12px;
        left: 12px;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }

    .creation-progress-modal {
        width: 95%;
        max-height: 90vh;
    }

    .creation-progress-header {
        padding: 24px;
    }

    .creation-progress-title {
        font-size: 20px;
    }

    .creation-progress-body {
        padding: 20px;
    }

    .workflow-step {
        padding: 12px;
        gap: 12px;
    }

    .workflow-step-icon {
        font-size: 24px;
    }

    .workflow-step-title {
        font-size: 14px;
    }

    .workflow-step-description {
        font-size: 12px;
    }
}
