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

#tlc-open-chat {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 9999;
    transition: all 0.3s ease;
}

#tlc-open-chat:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

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

#tlc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tlc-modal-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
}

.tlc-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 30px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.tlc-close:hover {
    color: #333;
}

.tlc-modal-content h2 {
    margin: 0 0 25px 0;
    color: #333;
    text-align: center;
}

.tlc-option {
    display: block;
    width: 100%;
    padding: 20px;
    margin: 15px 0;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tlc-option:hover {
    background: #e3f2fd;
    border-color: #2196F3;
    transform: scale(1.02);
}

/* ==================== CHAT WINDOW ==================== */

#tlc-chat,
#tlc-therapist-chat {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 400px;
    height: 500px; /* Changed from 600px */
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tlc-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

#tlc-timer {
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
}

#tlc-close-chat {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

#tlc-close-chat:hover {
    background: rgba(255, 255, 255, 0.3);
}

#tlc-end-session {
    margin-left: 10px;
    min-height: 36px;
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

#tlc-end-session:hover {
    background: rgba(255, 255, 255, 0.3);
}

#tlc-messages,
#tlc-therapist-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
}

.tlc-msg {
    margin: 10px 0;
    padding: 12px 16px;
    border-radius: 10px;
    max-width: 80%;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.4;
}

.tlc-msg-own {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    text-align: right;
    border-bottom-right-radius: 3px;
}

.tlc-msg-other {
    background: white;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 3px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.tlc-input-area {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    gap: 10px;
}

#tlc-input,
#tlc-therapist-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
}

#tlc-input:focus,
#tlc-therapist-input:focus {
    border-color: #667eea;
}

#tlc-send,
#tlc-therapist-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#tlc-send:hover,
#tlc-therapist-send:hover {
    transform: scale(1.05);
}

/* ==================== THERAPIST DASHBOARD ==================== */

.tlc-dashboard {
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
}

.tlc-dashboard h1 {
    color: #333;
    margin-bottom: 10px;
}

.tlc-dashboard p {
    color: #666;
    margin-bottom: 30px;
}

#tlc-sessions-list {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#tlc-sessions-list h2 {
    margin-top: 0;
    color: #333;
}

.tlc-session-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
}

.tlc-session-card h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.tlc-session-card p {
    margin: 5px 0;
    color: #666;
}

.tlc-join {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.tlc-join:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.tlc-dashboard #tlc-therapist-chat {
    position: relative;
    bottom: auto;
    right: auto;
    width: 100%;
    max-width: 100%;
    margin-top: 20px;
}

/* User Details Form */
#tlc-user-form input,
#tlc-user-form textarea {
    width: 100%;
    padding: 12px 16px;
    margin: 10px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

#tlc-user-form input:focus,
#tlc-user-form textarea:focus {
    outline: none;
    border-color: #667eea;
}

#tlc-user-form textarea {
    resize: vertical;
    min-height: 60px;
}

.tlc-continue-btn {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tlc-continue-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.tlc-back-btn {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: #f5f5f5;
    color: #666;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.tlc-back-btn:hover {
    background: #e0e0e0;
}

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

@media (max-width: 767px) {
    #tlc-open-chat {
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom));
        max-width: calc(100vw - 32px);
        min-height: 48px;
        padding: 12px 20px;
        border-radius: 24px;
        font-size: 15px;
        line-height: 1.2;
    }

    #tlc-open-chat:hover {
        transform: none;
    }

    #tlc-modal {
        align-items: flex-end;
        justify-content: stretch;
    }

    .tlc-modal-content {
        box-sizing: border-box;
        width: 100%;
        max-width: none;
        max-height: 90vh;
        max-height: 90dvh;
        margin: 0;
        padding: 28px 20px calc(20px + env(safe-area-inset-bottom));
        border-radius: 20px 20px 0 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .tlc-modal-content h2 {
        margin-bottom: 18px;
        padding: 0 32px;
        font-size: 22px;
    }

    .tlc-close {
        top: 12px;
        right: 16px;
        display: flex;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        font-size: 32px;
    }

    #tlc-user-form input,
    #tlc-user-form textarea,
    .tlc-option,
    .tlc-continue-btn,
    .tlc-back-btn {
        box-sizing: border-box;
        min-height: 48px;
        font-size: 16px;
    }

    #tlc-user-form input,
    #tlc-user-form textarea {
        padding: 13px 14px;
        margin: 7px 0;
    }

    .tlc-option {
        padding: 15px;
        margin: 10px 0;
    }

    #tlc-chat,
    #tlc-therapist-chat,
    .tlc-dashboard #tlc-therapist-chat {
        position: fixed;
        inset: 0;
        box-sizing: border-box;
        width: 100%;
        max-width: none;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        border-radius: 0;
        z-index: 10001;
        overflow: hidden;
    }

    .tlc-header {
        position: sticky;
        top: 0;
        z-index: 2;
        flex: 0 0 auto;
        min-width: 0;
        padding: max(12px, env(safe-area-inset-top)) 12px 12px;
        gap: 8px;
        font-size: 15px;
    }

    .tlc-header > span:first-child {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .tlc-header > div {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        gap: 6px;
        min-width: 0;
    }

    #tlc-timer,
    #tlc-therapist-timer {
        margin-right: 0 !important;
        padding: 5px 9px !important;
        font-size: 13px;
        white-space: nowrap;
    }

    #tlc-end-session,
    #tlc-close-chat {
        min-width: 44px;
        min-height: 40px;
        margin-left: 0;
        padding: 7px 10px;
        font-size: 13px;
        white-space: nowrap;
    }

    #tlc-messages,
    #tlc-therapist-messages {
        min-height: 0;
        padding: 12px;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .tlc-msg {
        max-width: 88%;
        margin: 7px 0;
        padding: 10px 12px;
        line-height: 1.45;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .tlc-msg-own {
        margin-left: auto;
    }

    .tlc-input-area {
        position: sticky;
        bottom: 0;
        z-index: 2;
        flex: 0 0 auto;
        align-items: center;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
        gap: 8px;
    }

    #tlc-input,
    #tlc-therapist-input {
        box-sizing: border-box;
        min-width: 0;
        min-height: 44px;
        padding: 10px 14px;
        font-size: 16px;
    }

    #tlc-send,
    #tlc-therapist-send {
        flex: 0 0 auto;
        min-width: 64px;
        min-height: 44px;
        padding: 10px 15px;
        font-size: 14px;
    }

    #tlc-send:hover,
    #tlc-therapist-send:hover {
        transform: none;
    }

    .tlc-dashboard {
        margin: 16px auto;
        padding: 10px;
    }

    .tlc-dashboard h1 {
        font-size: 26px;
    }

    #tlc-sessions-list {
        padding: 16px;
        border-radius: 12px;
    }

    .tlc-session-card {
        padding: 15px;
        margin: 12px 0;
    }

    .tlc-session-card p {
        margin: 7px 0;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .tlc-join {
        width: 100%;
        min-height: 44px;
    }
}
