/**
 * RentSmart FAQ Chatbot - Hierarchical Browse UI
 * Modern, clean design for category-based browsing
 */

/* Toggle Button */
#chatbot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #2980B9;
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(41, 128, 185, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 9998;
    transition: all 0.3s ease;
}

#chatbot-toggle:hover {
    transform: scale(1.1);
    background: #ff5e00;
    box-shadow: 0 6px 30px rgba(255, 94, 0, 0.6);
}

/* Chatbot Widget */
#chatbot-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
}

#chatbot-widget.open {
    display: flex;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.chatbot-header {
    background: #2980B9;
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 16px;
    flex: 1;
}

.chatbot-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.chatbot-controls {
    display: flex;
    gap: 8px;
}

.chatbot-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chatbot-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Body */
.chatbot-body {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
    padding: 20px;
}

.chatbot-body::-webkit-scrollbar {
    width: 6px;
}

.chatbot-body::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

/* Home Screen */
.chatbot-home {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.welcome-message {
    text-align: center;
    padding: 20px;
}

.welcome-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.welcome-message h3 {
    margin: 0 0 8px 0;
    color: #2d3748;
    font-size: 20px;
}

.welcome-message p {
    margin: 0;
    color: #718096;
    font-size: 14px;
}

.home-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.action-card:hover {
    border-color: #2980B9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(41, 128, 185, 0.15);
}

.action-card > i:first-child {
    font-size: 24px;
    color: #2980B9;
}

.action-card > div {
    flex: 1;
}

.action-card strong {
    display: block;
    color: #2d3748;
    margin-bottom: 4px;
    font-size: 15px;
}

.action-card span {
    color: #718096;
    font-size: 13px;
}

.action-card > i:last-child {
    color: #cbd5e0;
    font-size: 16px;
}

.contact-support {
    background: #edf2f7;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: #4a5568;
}

.contact-support i {
    color: #2980B9;
    margin-right: 4px;
}

/* Categories Grid */
.categories-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.category-card:hover {
    border-color: #2980B9;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(41, 128, 185, 0.15);
}

.category-icon {
    width: 48px;
    height: 48px;
    background: #2980B9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.category-info {
    flex: 1;
}

.category-info strong {
    display: block;
    color: #2d3748;
    margin-bottom: 4px;
    font-size: 15px;
}

.category-info span {
    color: #718096;
    font-size: 12px;
}

.category-card > i:last-child {
    color: #cbd5e0;
}

/* Questions List */
.questions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.question-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.question-item:hover {
    border-color: #2980B9;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(41, 128, 185, 0.1);
}

.question-text {
    flex: 1;
    color: #2d3748;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 8px;
}

.guide-indicator {
    color: #ffa726;
    font-size: 14px;
}

.question-item > i:last-child {
    color: #cbd5e0;
    font-size: 14px;
}

/* Answer Container */
.answer-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.answer-question {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.answer-question i {
    color: #2980B9;
    font-size: 20px;
    margin-top: 2px;
}

.answer-question strong {
    color: #2d3748;
    font-size: 16px;
    line-height: 1.5;
}

.answer-text {
    color: #4a5568;
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 20px;
}

.answer-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #2980B9;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.answer-action-btn:hover {
    transform: translateY(-2px);
    background: #ff5e00;
    box-shadow: 0 4px 12px rgba(255, 94, 0, 0.3);
}

/* Interactive Guidance */
#chatbot-guidance {
    background: #fff5e6;
    border-top: 2px solid #ffa726;
    padding: 16px;
    display: none;
    flex-shrink: 0;
    max-height: 250px;
    overflow-y: auto;
}

.guidance-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #e65100;
    margin-bottom: 12px;
}

.guidance-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.guidance-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    transition: all 0.2s;
}

.guidance-step:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.step-number {
    width: 28px;
    height: 28px;
    background: #ffa726;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
    font-size: 13px;
    color: #2d3748;
    line-height: 1.4;
}

.step-action {
    background: #2980B9;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.step-action:hover {
    background: #ff5e00;
    transform: scale(1.1);
}

/* Ask Question Form */
.ask-question-form {
    background: white;
    border-radius: 12px;
    padding: 20px;
}

.form-description {
    color: #4a5568;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    color: #2d3748;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-group textarea,
.form-group input,
.form-group select {
    width: 100%;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    background: white;
}

.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2980B9;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232980B9' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-group select option {
    padding: 8px;
}

.submit-ticket-btn {
    width: 100%;
    background: #2980B9;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.submit-ticket-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    background: #ff5e00;
    box-shadow: 0 4px 12px rgba(255, 94, 0, 0.3);
}

.submit-ticket-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.support-info {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
    color: #718096;
    text-align: center;
}

.support-info i {
    color: #2980B9;
}

.support-info a {
    color: #2980B9;
    text-decoration: none;
}

.support-info a:hover {
    text-decoration: underline;
}

/* Ticket Success */
.ticket-success {
    background: white;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
}

.success-icon {
    font-size: 64px;
    color: #48bb78;
    margin-bottom: 16px;
}

.ticket-success h3 {
    color: #2d3748;
    font-size: 20px;
    margin: 0 0 12px 0;
}

.ticket-success p {
    color: #4a5568;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.ticket-note {
    background: #edf2f7;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
}

.btn-home {
    margin-top: 20px;
    background: #2980B9;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-home:hover {
    transform: translateY(-2px);
    background: #ff5e00;
    box-shadow: 0 4px 12px rgba(255, 94, 0, 0.3);
}

/* Loading State */
.chatbot-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #2980B9;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.chatbot-loading p {
    margin-top: 16px;
    color: #718096;
    font-size: 14px;
}

/* Error State */
.chatbot-error {
    background: white;
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
}

.chatbot-error i {
    font-size: 48px;
    color: #f56565;
    margin-bottom: 16px;
}

.chatbot-error p {
    color: #4a5568;
    font-size: 14px;
    margin-bottom: 20px;
}

.btn-retry {
    background: #2980B9;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-retry:hover {
    background: #ff5e00;
    box-shadow: 0 4px 12px rgba(255, 94, 0, 0.3);
}

/* Highlight Effect */
.chatbot-highlight {
    animation: highlightPulse 2s ease-in-out;
    position: relative;
    z-index: 9997 !important;
}

@keyframes highlightPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 167, 38, 0);
    }
    25%, 75% {
        box-shadow: 0 0 0 10px rgba(255, 167, 38, 0.4);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(255, 167, 38, 0.2);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #chatbot-widget {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        right: 16px;
        bottom: 16px;
    }

    #chatbot-toggle {
        width: 56px;
        height: 56px;
        bottom: 16px;
        right: 16px;
    }

    .chatbot-body {
        padding: 16px;
    }

    .welcome-icon {
        font-size: 40px;
    }

    .welcome-message h3 {
        font-size: 18px;
    }

    .category-icon {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }
}

/* Authentication Modal */
.chatbot-auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chatbot-auth-modal.show {
    opacity: 1;
}

.auth-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.auth-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translate(-50%, -40%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

.auth-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 24px 16px;
    background: #2980B9;
    color: white;
}

.auth-modal-header i {
    font-size: 24px;
}

.auth-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.auth-modal-body {
    padding: 24px;
}

.auth-modal-body p {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 15px;
    line-height: 1.5;
}

.auth-modal-hint {
    font-size: 13px !important;
    color: #666 !important;
}

.auth-modal-actions {
    display: flex;
    gap: 12px;
    padding: 16px 24px 24px;
}

.auth-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-btn-primary {
    background: #2980B9;
    color: white;
}

.auth-btn-primary:hover {
    transform: translateY(-2px);
    background: #ff5e00;
    box-shadow: 0 4px 12px rgba(255, 94, 0, 0.4);
}

.auth-btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.auth-btn-secondary:hover {
    background: #e0e0e0;
}

@media (max-width: 480px) {
    .auth-modal-content {
        width: 95%;
        max-width: none;
    }

    .auth-modal-actions {
        flex-direction: column;
    }

    .auth-btn {
        width: 100%;
    }
}

/* Google reCAPTCHA Badge Positioning with Auto-Hide */
.grecaptcha-badge {
    left: 4px !important;
    right: auto !important;
    bottom: 4px !important;
    transition: transform 0.5s ease-in-out !important;
    transform: translateX(0) !important;
    cursor: pointer !important;
}

/* Hidden state - slide mostly off screen, leave small tip visible */
.grecaptcha-badge.hidden {
    transform: translateX(-90%) !important;
}

/* Show on hover over the visible tip */
.grecaptcha-badge.hidden:hover {
    transform: translateX(0) !important;
}
