/* ============================================
   SME Credit Scoring AI - Custom Styles
   Swin Hackathon 2026
   ============================================ */

/* General */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #ffffff;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #ffffff 0%, #f0f2f5 100%);
    border-bottom: 3px solid #0d6efd;
}

/* Cards */
.card {
    border-radius: 12px;
    transition: transform 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
}

/* Credit Score Circle */
.credit-score-circle {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 8px solid #ddd;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.credit-score-circle.success-ring {
    border-color: #198754;
}

.credit-score-circle.danger-ring {
    border-color: #dc3545;
}

.score-value {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1;
}

.success-ring .score-value {
    color: #198754;
}

.danger-ring .score-value {
    color: #dc3545;
}

.score-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 4px;
}

/* SHAP Bars */
.shap-feature {
    transition: background-color 0.2s ease;
}

.shap-feature:hover {
    background-color: #f8f9fa;
}

.shap-bar-container {
    min-height: 24px;
}

.shap-bar-center {
    width: 2px;
    height: 24px;
    background-color: #6c757d;
}

/* Metric boxes */
.metric-box {
    transition: background-color 0.2s ease;
}

.metric-box:hover {
    background-color: #f8f9fa;
}

/* Badges */
.badges .badge {
    font-size: 0.85rem;
    padding: 6px 12px;
}

/* Steps */
.step-list .step {
    padding-left: 10px;
    border-left: 3px solid #0d6efd;
}

/* Insights */
.insight {
    padding: 10px;
    border-radius: 8px;
    background-color: #f8f9fa;
}

/* Form styling */
.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* Progress bar in result */
.progress {
    border-radius: 12px;
}

.progress-bar {
    border-radius: 12px;
    font-weight: 600;
}

/* Footer */
footer {
    margin-top: auto;
}

/* Language Toggle */
.lang-toggle {
    background: rgba(13, 110, 253, 0.1);
    border-radius: 20px;
    padding: 4px 14px !important;
    font-weight: 600;
    transition: background 0.2s ease;
    white-space: nowrap;
    color: #0d6efd !important;
}

.lang-toggle:hover {
    background: rgba(13, 110, 253, 0.2);
}

.lang-flag {
    font-size: 1.1rem;
    margin-right: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .credit-score-circle {
        width: 120px;
        height: 120px;
    }
    
    .score-value {
        font-size: 2rem;
    }
    
    .hero-section h1 {
        font-size: 1.5rem;
    }
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    animation: fadeIn 0.3s ease-out;
}

/* Print styles */
@media print {
    .navbar, footer, .btn, #chatbot-widget {
        display: none !important;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* ============================================
   Chatbot Widget - Yordle 🧚
   ============================================ */

/* Toggle Button */
.chat-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
    z-index: 9999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(102, 126, 234, 0.7);
}

.chat-toggle-btn.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.chat-toggle-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.chat-toggle-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.4);
    animation: chatPulse 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes chatPulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
}

.chat-toggle-btn.active .chat-toggle-pulse {
    display: none;
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 370px;
    height: 500px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.3s ease-out;
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.chat-avatar {
    font-size: 1.1rem;
    background: rgba(255,255,255,0.2);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-header-info strong {
    font-size: 1rem;
    display: block;
    line-height: 1.2;
}

.chat-status {
    font-size: 0.7rem;
    opacity: 0.85;
    display: block;
}

.chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    padding: 0 4px;
    line-height: 1;
}

.chat-close-btn:hover {
    opacity: 1;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f0ff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: #d4b8e8;
    border-radius: 10px;
}

/* Message Bubbles */
.chat-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 85%;
    animation: fadeIn 0.3s ease-out;
}

.chat-msg.bot {
    align-self: flex-start;
}

.chat-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg-avatar {
    font-size: 0.9rem;
    width: 30px;
    height: 30px;
    background: #e8d5f5;
    color: #764ba2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.88rem;
    line-height: 1.45;
    word-break: break-word;
}

.chat-msg.bot .chat-msg-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.chat-msg.user .chat-msg-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

/* Typing Indicator */
.typing-indicator .chat-msg-bubble {
    display: flex;
    gap: 4px;
    padding: 12px 18px;
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    background: #b8a0d0;
    border-radius: 50%;
    animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-indicator .dot:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator .dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Chat Input */
.chat-input-area {
    padding: 12px;
    background: white;
    border-top: 1px solid #f0e0f8;
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    border: 2px solid #e8d5f5;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #764ba2;
}

.chat-input::placeholder {
    color: #b8a0d0;
}

.chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.08);
}

/* Responsive Chat */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 120px);
        right: 10px;
        bottom: 80px;
        border-radius: 16px;
    }

    .chat-toggle-btn {
        width: 52px;
        height: 52px;
        bottom: 16px;
        right: 16px;
    }
}
