/* companion.css - IFS Companion chat styles */

.companion-page {
    display: flex;
    height: calc(100vh - 70px);
    overflow: hidden;
    background: #f8f9fa;
}

/* ==================== SIDEBAR ==================== */

.companion-sidebar {
    width: 280px;
    min-width: 280px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.new-session-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--primary, #0073e6);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.new-session-btn:hover {
    background: var(--primary-dark, #005bb5);
}

.sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.session-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.15s;
}

.session-item:hover {
    background: #f0f4ff;
}

.session-item.active {
    background: #e8f0fe;
    border-left: 3px solid var(--primary, #0073e6);
}

.session-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-item-date {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

/* ==================== SIDEBAR PROFILE LINK ==================== */

.sidebar-profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-top: auto;
    border-top: 1px solid #e0e0e0;
    color: #444;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.sidebar-profile-link:hover {
    background: #f0f4ff;
    color: #6366f1;
}

.sidebar-profile-link > i:first-child {
    color: #6366f1;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-profile-arrow {
    margin-left: auto;
    font-size: 11px;
    color: #bbb;
}

/* ==================== MAIN CHAT AREA ==================== */

.companion-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.chat-header {
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.chat-header-subtitle {
    font-size: 12px;
    color: #888;
}

.disclaimer-bar {
    padding: 8px 24px;
    background: #fff8e6;
    border-bottom: 1px solid #f0e0b0;
    font-size: 12px;
    color: #856404;
    text-align: center;
}

/* ==================== MESSAGES ==================== */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    max-width: 80%;
    animation: messageIn 0.3s ease-out;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.55;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.user .message-bubble {
    background: var(--primary, #0073e6);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px;
}

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

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    40% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Welcome state */
.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
    color: #666;
}

.chat-welcome h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 8px;
}

.chat-welcome p {
    font-size: 15px;
    max-width: 400px;
    line-height: 1.6;
    margin-bottom: 16px;
}

/* ==================== INPUT BAR ==================== */

.chat-input-bar {
    padding: 16px 24px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    transition: opacity 0.3s, background 0.3s;
}

.chat-input-bar.archived {
    background: #fdfdfd;
    opacity: 0.8;
}

.chat-input-bar.archived .chat-input {
    background: #fafafa;
    cursor: default;
    color: #888;
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
}

.chat-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.chat-input:focus {
    border-color: var(--primary, #0073e6);
}

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

.mic-btn,
.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn {
    background: var(--primary, #0073e6);
    color: #fff;
}

.send-btn:hover {
    background: var(--primary-dark, #005bb5);
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.mic-btn {
    background: #f0f0f0;
    color: #666;
}

.mic-btn:hover {
    background: #e0e0e0;
}

.mic-btn.listening {
    background: #fee;
    color: #dc3545;
    animation: micPulse 1.5s infinite;
}

@keyframes micPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.3);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(220, 53, 69, 0);
    }
}

.voice-status {
    font-size: 12px;
    color: #dc3545;
    text-align: center;
    padding: 4px 0 0;
}

.interim-text {
    font-size: 13px;
    color: #999;
    font-style: italic;
    padding: 2px 16px;
}

/* ==================== AUTH GATE ==================== */

.auth-gate {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.auth-gate h2 {
    font-size: 24px;
    margin-bottom: 12px;
}

.auth-gate p {
    color: #666;
    margin-bottom: 24px;
    max-width: 400px;
}

.auth-gate-btn {
    padding: 12px 32px;
    background: var(--primary, #0073e6);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-gate-btn:hover {
    background: var(--primary-dark, #005bb5);
}

/* Auth gate pricing section */
.auth-gate-pricing {
    margin-top: 32px;
    width: 100%;
    max-width: 340px;
}

.auth-gate-free {
    font-size: 13px;
    color: #888;
    margin-bottom: 16px;
    letter-spacing: 0.02em;
}

.auth-gate-plan {
    background: #f8f9ff;
    border: 1px solid #e0e4ff;
    border-radius: 12px;
    padding: 20px 24px;
    text-align: left;
}

.auth-gate-plan-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary, #0073e6);
}

.auth-gate-plan-price small {
    font-size: 14px;
    font-weight: 400;
    color: #888;
}

.auth-gate-plan ul {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
}

.auth-gate-plan ul li {
    font-size: 14px;
    color: #444;
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-gate-plan ul li i {
    color: #28a745;
    font-size: 12px;
}

/* ==================== UPGRADE BANNER ==================== */

.upgrade-banner {
    margin: 8px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-radius: 10px;
    color: #fff;
}

.upgrade-banner-text {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.upgrade-banner-btn {
    width: 100%;
    padding: 8px 12px;
    background: #fff;
    color: #4f46e5;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.upgrade-banner-btn:hover {
    opacity: 0.9;
}


/* ==================== SUBSCRIPTION MODAL ==================== */

.subscription-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}


.subscription-modal {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    text-align: center;
}

.subscription-modal h3 {
    font-size: 22px;
    margin-bottom: 8px;
}

.subscription-modal .price {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary, #0073e6);
    margin: 16px 0;
}

.subscription-modal .price span {
    font-size: 16px;
    font-weight: 400;
    color: #888;
}

.subscription-modal ul {
    text-align: left;
    list-style: none;
    padding: 0;
    margin: 16px 0 24px;
}

.subscription-modal ul li {
    padding: 8px 0;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.subscription-modal ul li i {
    color: #28a745;
}

.subscribe-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary, #0073e6);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.subscribe-btn:hover {
    background: var(--primary-dark, #005bb5);
}

.subscription-modal .close-btn {
    margin-top: 12px;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 14px;
}

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

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #333;
    padding: 4px;
}

@media (max-width: 768px) {
    .companion-sidebar {
        position: fixed;
        top: 70px;
        left: -300px;
        width: 280px;
        height: calc(100vh - 70px);
        z-index: 100;
        transition: left 0.3s ease;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    }

    .companion-sidebar.open {
        left: 0;
    }

    .sidebar-toggle {
        display: flex;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        top: 70px;
        background: rgba(0, 0, 0, 0.3);
        z-index: 99;
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .message {
        max-width: 90%;
    }

    .chat-input-bar {
        padding: 12px 16px;
    }

    .mic-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}
