/**
 * Public-facing stylesheets.
 *
 * All styles for the [waytin_chat] shortcode.
 *
 * @since      1.0.0
 * @package    Waytin_AI_Chat
 * @author     Edu Brazeal <info@edubrazeal.com>
 */

/* Reset focus styles */
.waytin-chat-wrapper button:focus,
.waytin-chat-wrapper input:focus,
.waytin-chat-wrapper textarea:focus,
.waytin-chat-wrapper a:focus {
    outline: none !important;
    box-shadow: none !important;
}

.waytin-chat-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    background-color: #1e1e2d;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: white;
}

.waytin-chat-header {
    border-bottom: solid 1.5px #93a4b0;
    border-bottom-left-radius: 9px;
    border-bottom-right-radius: 9px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background-color: #2a2a3d;
    flex-shrink: 0;
}

.waytin-chat-title {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
}

.waytin-logo {
    height: 30px;
    width: auto;
    animation: waytin-rotate 10s linear infinite;
}

@keyframes waytin-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.waytin-menu-btn, .waytin-new-chat-btn, .waytin-close-sidebar {
    background: none;
    border: none;
    color: #93a4b0;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.waytin-menu-btn:hover, .waytin-new-chat-btn:hover, .waytin-close-sidebar:hover {
    background-color: rgba(107, 138, 253, 0.1);
    color: #8ba5ff;
}

.waytin-new-chat-btn {
    color: #93a4b0;
}

.waytin-chat-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    width: 300px;
    height: 100%;
    background-color: #2a2a3d;
    border-right: 1.5px solid #93a4b0;
    border-top-right-radius: 15px;
    border-bottom-right-radius: 15px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

.waytin-chat-sidebar.open {
    transform: translateX(0);
}

.waytin-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #3b3b4f;
}

.waytin-sidebar-header h3 {
    margin: 0;
    font-size: 16px;
    color: #e2e8f0;
}

.waytin-chat-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.waytin-chat-history-item {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: #3b3b4f;
    transition: all 0.2s ease;
    position: relative;
}

.waytin-chat-history-item:hover {
    background-color: #44445c;
}

.waytin-chat-history-item::after {
    content: 'Delete';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #ff4d4d;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.waytin-chat-history-item.long-press::after {
    opacity: 1;
}

.waytin-no-chats {
    padding: 10px;
    color: #93a4b0;
    font-style: italic;
    font-size: 14px;
    text-align: center;
}

.waytin-profile-section {
    padding: 16px;
    border-top: 1px solid #3b3b4f;
    margin-top: auto;
}

.waytin-ad-container {
    margin-bottom: 16px;
    max-height: 90px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.waytin-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: #3b3b4f;
    border-radius: 8px;
    margin-bottom: 8px;
}

.waytin-user-avatar {
    flex-shrink: 0;
}

.waytin-user-avatar img {
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

.waytin-user-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.waytin-user-name {
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
}

.waytin-logout-btn {
    background: none;
    border: none;
    color: #93a4b0;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    text-align: left;
    transition: color 0.2s ease;
}

.waytin-logout-btn:hover {
    color: #ff6b6b;
}

.waytin-profile-link {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    color: white;
    border: 1.5px solid #00ba7b;
    transition: all 0.2s ease;
}

.waytin-profile-link:hover {
    background-color: rgba(107, 138, 253, 0.1);
}

.waytin-profile-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b8afd;
}

.waytin-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.waytin-message-container {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.waytin-message-container::-webkit-scrollbar {
    display: none;
}

.waytin-message {
    margin-bottom: 12px;
    display: flex;
}

.waytin-user-message {
    justify-content: flex-end;
}

.waytin-ai-message {
    justify-content: flex-start;
}

.waytin-message-bubble {
    max-width: 95%;
    padding: 5px 10px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.waytin-user-bubble {
    background-color: #3b3b4f;
    border-bottom-right-radius: 4px;
}

.waytin-ai-bubble {
    background-color: #44445c;
    border-bottom-left-radius: 4px;
}

.waytin-ai-bubble strong {
    font-weight: 600;
    color: #e2e8f0;
}

.waytin-ai-bubble em {
    font-style: italic;
    color: #cbd5e0;
}

.waytin-ai-bubble code {
    background-color: #2a2a3d;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #93c5fd;
}

.waytin-typing-indicator {
    background-color: #44445c;
    border-radius: 18px;
    padding: 12px 16px;
    max-width: 80%;
    display: inline-block;
}

.waytin-quick-replies {
    padding: 5px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.waytin-quick-replies-row {
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    display: flex;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.waytin-quick-reply-btn {
    border-radius: 9999px;
    padding: 6px 12px;
    font-size: 12px;
    background-color: #3b3b4f;
    color: white;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.waytin-quick-reply-btn:hover {
    background-color: #44445c;
}

.waytin-input-container {
    position: relative;
    padding-bottom: 30px;
    display: flex;
    justify-content: center;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.waytin-input-wrapper {
    position: relative;
    width: 95%;
    max-width: 800px;
}

.waytin-input-field {
    width: 100%;
    max-height: 180px;
    min-height: 110px;
    margin-bottom: -20px;
    padding: 5px 10px 10px 28px;
    border-radius: 25px;
    border: 1px solid #3b3b4f;
    background-color: #2a2a3d;
    color: white;
    font-size: 16px;
    outline: none;
    box-sizing: border-box;
    resize: none;
    font-family: inherit;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.5;
}

.waytin-input-field::placeholder {
    color: #9ca3af;
    position: absolute;
    top: 20%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    text-align: center;
    padding: 0 60px;
}

.waytin-icon-btn {
    position: absolute;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 1;
    transition: all 0.2s ease;
}

.waytin-attach-btn {
    left: 1px;
    bottom: 21px;
    color: #93a4b0;
}

.waytin-web-btn {
    left: 1px;
    bottom: -15px;
    color: #93a4b0;
}

.waytin-web-btn.active {
    color: #6b8afd;
}

.waytin-voice-btn {
    left: 1px;
    bottom: 60px;
    color: #93a4b0;
}

.waytin-send-btn {
    right: 5px;
    bottom: -7px;
    background: none;
    border: 2px solid #93a4b0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #93a4b0;
    transition: all 0.2s ease;
}

.waytin-send-btn:hover {
    border-color: #6b8afd;
    color: #6b8afd;
}

.waytin-disclaimer {
    margin-top: -20px;
    margin-bottom: -15px;
    text-align: center;
    font-size: 11px;
    color: #6b7280;
    padding: 8px 16px 30px;
    flex-shrink: 0;
}

.waytin-dot-flashing {
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: #9ca3af;
    color: #9ca3af;
    animation: waytin-dotFlashing 1s infinite linear alternate;
    animation-delay: 0.5s;
    display: inline-block;
    margin-left: 8px;
}

.waytin-dot-flashing::before, .waytin-dot-flashing::after {
    content: '';
    display: inline-block;
    position: absolute;
    top: 0;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: #9ca3af;
    color: #9ca3af;
}

.waytin-dot-flashing::before {
    left: -15px;
    animation: waytin-dotFlashing 1s infinite alternate;
    animation-delay: 0s;
}

.waytin-dot-flashing::after {
    left: 15px;
    animation: waytin-dotFlashing 1s infinite alternate;
    animation-delay: 1s;
}

@keyframes waytin-dotFlashing {
    0% {
        background-color: #9ca3af;
    }
    50%, 100% {
        background-color: rgba(156, 163, 175, 0.2);
    }
}

.waytin-hidden {
    display: none;
}

.waytin-uploaded-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 8px;
}

.waytin-image-preview-container {
    display: none;
    justify-content: center;
    padding: 8px;
    flex-shrink: 0;
}

.waytin-image-preview {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    border: 1px solid #3b3b4f;
    display: none;
}

.waytin-remove-image-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #3b3b4f;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    color: white;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.waytin-preview-wrapper {
    position: relative;
    margin: 8px;
}

@keyframes waytin-pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.waytin-voice-btn.recording {
    animation: waytin-pulse 1.5s infinite;
    color: red !important;
}

.waytin-search-results-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 12px;
}

.waytin-search-result-item {
    background-color: #2a2a3d;
    border-radius: 16px;
    padding: 16px;
    border: 1px solid #3b3b4f;
}

.waytin-search-result-header {
    font-size: 15px;
    font-weight: 600;
    color: #93a4b0;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.waytin-search-result-summary {
    font-size: 14px;
    line-height: 1.5;
    color: #d1d5db;
    margin-bottom: 12px;
}

.waytin-search-result-images {
    display: flex;
    margin-bottom: 12px;
    position: relative;
    height: 40px;
}

.waytin-search-result-image {
    width: 30px;
    height: 30px;
    border-radius: 30px;
    object-fit: cover;
    border: 2px solid #2a2a3d;
    position: absolute;
    transition: transform 0.2s ease;
}

.waytin-search-result-image:hover {
    transform: scale(1.2);
    z-index: 2;
}

.waytin-search-result-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 12px;
}

.waytin-search-result-domain {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #9ca3af;
}

.waytin-search-result-favicon {
    width: 14px;
    height: 14px;
    border-radius: 2px;
}

.waytin-search-result-link {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #93a4b0;
    text-decoration: none;
    transition: color 0.2s ease;
}

.waytin-search-result-link:hover {
    color: #cbd5e0;
}

.waytin-search-result-banter {
    font-size: 11px;
    color: #718096;
    font-style: italic;
    margin-left: 40px;
    padding-top: 8px;
}

.waytin-search-result-content {
    display: flex;
}

.waytin-search-result-text {
    flex: 1;
}

.waytin-search-result-image-container {
    width: 120px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: 16px;
}

.waytin-search-result-main-image {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    margin-bottom: 8px;
}

.waytin-link-icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.waytin-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.waytin-ai-bubble:hover .waytin-copy-btn {
    opacity: 1;
}

.waytin-limit-message {
    color: #d2b48c;
    font-style: italic;
}

.waytin-copy-btn .waytin-tooltip {
    position: absolute;
    top: -30px;
    right: 0;
    background: #44445c;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    white-space: nowrap;
}

.waytin-copy-btn:hover .waytin-tooltip {
    opacity: 1;
}

.waytin-auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.waytin-auth-overlay.active {
    display: flex;
}

.waytin-auth-modal {
    background-color: #2a2a3d;
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid #3b3b4f;
}

.waytin-auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.waytin-auth-header h2 {
    margin: 0;
    font-size: 24px;
    color: #e2e8f0;
    font-weight: 600;
}

.waytin-auth-body {
    width: 100%;
}

.waytin-auth-form {
    width: 100%;
}

.waytin-form-group {
    margin-bottom: 20px;
}

.waytin-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #cbd5e0;
    font-size: 14px;
    font-weight: 500;
}

.waytin-form-group input[type="text"],
.waytin-form-group input[type="email"],
.waytin-form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #3b3b4f;
    border-radius: 8px;
    background-color: #1e1e2d;
    color: white;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.waytin-form-group input[type="text"]:focus,
.waytin-form-group input[type="email"]:focus,
.waytin-form-group input[type="password"]:focus {
    outline: none;
    border-color: #6b8afd;
    background-color: #252538;
}

.waytin-form-group small {
    display: block;
    margin-top: 4px;
    color: #9ca3af;
    font-size: 12px;
}

.waytin-checkbox-group {
    display: flex;
    align-items: center;
}

.waytin-checkbox-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
}

.waytin-checkbox-group input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.waytin-form-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 12px;
    color: #fca5a5;
    font-size: 14px;
    margin-bottom: 16px;
    display: none;
}

.waytin-form-error.active {
    display: block;
}

.waytin-auth-submit-btn {
    width: 100%;
    padding: 12px 24px;
    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.2s ease;
    font-family: inherit;
}

.waytin-auth-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.waytin-auth-submit-btn:active {
    transform: translateY(0);
}

.waytin-auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.waytin-forgot-password {
    text-align: center;
    margin-top: 12px;
}

.waytin-forgot-password a {
    color: #9ca3af;
    font-size: 13px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.waytin-forgot-password a:hover {
    color: #6b8afd;
}

.waytin-auth-toggle {
    margin-top: 24px;
    text-align: center;
}

.waytin-toggle-form-btn {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.2s ease;
}

.waytin-toggle-form-btn:hover {
    color: #cbd5e0;
}

.waytin-toggle-form-btn strong {
    color: #6b8afd;
}

/* Fix for themes that constrain layout */
.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
    max-width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
}