/**
 * Mobile Fixes & Chat Enhancements
 * Shortlist sidebar, centered text, and responsive improvements
 */

/* ============================================
   SHORTLIST FLOATING - MOBILE TOGGLE SIDEBAR
   ============================================ */

@media (max-width: 768px) {
    .sffc-shortlist-floating {
        display: block !important;
        position: fixed !important;
        right: -320px !important; /* Hidden by default */
        top: 0 !important;
        bottom: 0 !important;
        width: 300px !important;
        max-width: 85vw !important;
        background: white !important;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15) !important;
        border-left: 1px solid rgba(0, 0, 0, 0.08) !important;
        z-index: 1000 !important;
        transition: right 0.3s cubic-bezier(0.23, 1, 0.32, 1) !important;
        transform: none !important;
        border-radius: 0 !important;
    }
    
    /* Active/Open State */
    .sffc-shortlist-floating.active {
        right: 0 !important;
    }
    
    /* Toggle Button - REPLACED BY APPLICATION TRACKER WIDGET */
    .sffc-shortlist-toggle {
        display: none !important; /* Hidden - using application tracker widget instead */
    }
    
    .shortlist-toggle {
        display: none !important; /* Hidden - using application tracker widget instead */
    }
    
    /* Overlay when sidebar is open */
    .sffc-shortlist-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sffc-shortlist-overlay.active {
        display: block;
        opacity: 1;
    }
    
    /* Close button in sidebar */
    .sffc-shortlist-close {
        position: absolute;
        top: 16px;
        right: 16px;
        width: 32px;
        height: 32px;
        background: transparent;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sffc-shortlist-close svg {
        width: 20px;
        height: 20px;
        color: var(--vogue-gray);
    }
}

/* Desktop - Keep original styling */
@media (min-width: 769px) {
    .sffc-shortlist-toggle {
        display: none !important;
    }
    
    .sffc-shortlist-overlay {
        display: none !important;
    }
}

/* ============================================
   CENTERED CHAT TEXT
   ============================================ */

/* Center the entire conversation */
.sffc-senna-conversation,
.senna-messages {
    text-align: center !important;
    max-width: 800px !important;
    margin: 0 auto !important;
}

/* Center message content but keep cards left-aligned */
.senna-message {
    text-align: center !important;
    margin: 0 auto 24px !important;
    max-width: 90% !important;
}

.senna-message .message-text {
    text-align: center !important;
    margin: 0 auto !important;
}

/* Keep user messages centered */
.sffc-message-user {
    text-align: center !important;
}

.sffc-message-user .message-text {
    text-align: center !important;
    display: inline-block !important;
    margin: 0 auto !important;
}

/* Keep job cards and option cards left-aligned */
.job-cards-in-chat,
.job-cards-container {
    text-align: left !important;
}

.job-card-vogue {
    text-align: left !important;
}

.option-cards {
    text-align: left !important;
    display: flex !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 16px !important;
    margin: 20px auto !important;
}

.option-card {
    text-align: left !important;
    min-width: 180px !important;
}

/* Center guidance sections */
.senna-guidance {
    text-align: left !important;
    max-width: 600px !important;
    margin: 0 auto !important;
    background: var(--vogue-light-gray);
    padding: 24px;
    border-radius: 12px;
}

.senna-guidance h4 {
    text-align: center !important;
    margin-bottom: 16px;
}

/* Center avatars */
.senna-avatar {
    margin: 0 auto 12px !important;
}

/* ============================================
   FIX RISK FILTER DISPLAY
   ============================================ */

/* Ensure job cards container is visible */
.job-cards-in-chat {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 24px auto !important;
    max-width: 100% !important;
}

/* Animation for job cards appearing */
@keyframes jobCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.job-cards-in-chat .job-card-vogue {
    animation: jobCardFadeIn 0.5s ease forwards;
    animation-delay: calc(var(--index) * 0.1s);
}

/* Debug: Make sure messages container doesn't hide overflow */
#senna-messages {
    overflow: visible !important;
}

/* ============================================
   MOBILE RESPONSIVE IMPROVEMENTS
   ============================================ */

@media (max-width: 480px) {
    /* Smaller text on mobile */
    .senna-message .message-text {
        font-size: 16px !important;
        line-height: 1.6 !important;
    }
    
    /* Stack option cards vertically on small screens */
    .option-cards {
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .option-card {
        width: 100% !important;
        max-width: 280px !important;
    }
    
    /* Adjust job cards for mobile */
    .job-cards-in-chat {
        padding: 0 8px !important;
    }
    
    .job-card-vogue {
        padding: 16px !important;
    }
}