/**
 * Admin styles for A1AI Chatbot
 *
 * @package    A1AI
 * @subpackage A1AI/admin/css
 */

/* Admin Common Styles */
.a1ai-wrap {
    margin: 20px 20px 0 0;
}

.a1ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.a1ai-container {
    background: #fff;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    padding: 20px;
}

.a1ai-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    margin-bottom: 20px;
    padding: 15px;
}

.a1ai-card h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Dashboard specific styles */
.a1ai-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-gap: 20px;
}

.a1ai-stats-card {
    padding: 15px;
    border-radius: 3px;
    background: #f9f9f9;
}

.a1ai-stats-number {
    font-size: 24px;
    font-weight: bold;
    margin: 10px 0;
}

/* Settings form styles */
.a1ai-settings-form .form-table th {
    width: 200px;
    padding: 15px 10px;
}

.a1ai-api-key-field {
    width: 350px;
}

/* Chatbot management styles */
.a1ai-chatbots-list {
    margin-top: 20px;
}

.a1ai-chatbot-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.a1ai-chatbot-name {
    font-weight: 600;
}

.a1ai-chatbot-actions {
    display: flex;
    gap: 10px;
}

/* Form field styles */
.a1ai-form-field {
    margin-bottom: 15px;
}

.a1ai-form-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.a1ai-form-field input[type="text"],
.a1ai-form-field input[type="number"],
.a1ai-form-field textarea,
.a1ai-form-field select {
    width: 100%;
    max-width: 400px;
}

.a1ai-form-field textarea {
    min-height: 100px;
}

/* Tabs navigation */
.a1ai-tabs-nav {
    display: flex;
    border-bottom: 1px solid #ccc;
    margin-bottom: 20px;
}

/* Tab content */
.a1ai-tab-content {
    display: none;
}

.a1ai-tab-content.active {
    display: block;
}

/* Show first tab by default */
.a1ai-tab-content#tab-chatbots {
    display: block;
}

.a1ai-tabs-nav a {
    padding: 10px 15px;
    margin-right: 5px;
    text-decoration: none;
    color: #555;
    border: 1px solid transparent;
    border-bottom: none;
}

.a1ai-tabs-nav a.active {
    border-color: #ccc;
    background: #fff;
    border-bottom-color: #fff;
    margin-bottom: -1px;
    color: #000;
}

/* Conversation Settings Styles */
.a1ai-section {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

.a1ai-section h3 {
    margin-top: 0;
    color: #23282d;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    font-size: 16px;
}

.a1ai-section p {
    margin-bottom: 15px;
    color: #666;
}

/* Messages and Notices */
.a1ai-notice {
    padding: 10px 15px;
    margin: 15px 0;
    border-left: 4px solid #00a0d2;
    background: #f7f7f7;
}

.a1ai-notice.a1ai-notice-warning {
    border-color: #ffb900;
}

.a1ai-notice.a1ai-notice-error {
    border-color: #dc3232;
}

.a1ai-notice.a1ai-notice-success {
    border-color: #46b450;
}

/* Modal styles */
.a1ai-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a1ai-modal-content {
    background-color: #fff;
    border-radius: 8px;
    max-width: 800px;
    max-height: 80vh;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.a1ai-modal-header {
    padding: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.a1ai-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.a1ai-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a1ai-modal-close:hover {
    color: #000;
}

.a1ai-modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Conversations side-by-side layout */
.a1ai-conversations-container {
    display: flex;
    gap: 20px;
    height: 600px;
}

.a1ai-conversations-table {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overflow-x: auto;
}

.a1ai-conversations-table table {
    width: 100%;
}

.a1ai-conversations-table tbody {
    display: table-row-group;
}

.a1ai-conversation-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.a1ai-conversation-row:hover {
    background-color: #f9f9f9;
}

.a1ai-conversation-row.selected {
    background-color: #e7f3ff;
}

/* Conversation preview panel */
.a1ai-conversation-preview {
    width: 400px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.a1ai-preview-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    background: #f9f9f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.a1ai-preview-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.a1ai-preview-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a1ai-preview-close:hover {
    color: #000;
}

.a1ai-preview-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.a1ai-preview-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-style: italic;
}

.a1ai-preview-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.a1ai-preview-info {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}

.a1ai-preview-meta {
    margin-bottom: 10px;
}

.a1ai-preview-meta span {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #666;
}

.a1ai-preview-meta .a1ai-preview-chatbot {
    font-weight: 600;
    color: #333;
}

.a1ai-preview-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
}

/* Conversation messages styling */
.a1ai-conversation-message {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 6px;
}

.a1ai-conversation-message.user {
    background-color: #f0f8ff;
    border-left: 4px solid #0073aa;
}

.a1ai-conversation-message.assistant {
    background-color: #f9f9f9;
    border-left: 4px solid #46b450;
}

.a1ai-conversation-message.system {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
}

.a1ai-conversation-message .role {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 5px;
    color: #666;
}

.a1ai-conversation-message .content {
    margin-bottom: 5px;
    line-height: 1.4;
}

.a1ai-conversation-message .time {
    font-size: 11px;
    color: #999;
}

/* Responsive design */
@media screen and (max-width: 768px) {
    .a1ai-dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .a1ai-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .a1ai-chatbot-item {
        flex-direction: column;
        gap: 10px;
    }
    
    .a1ai-chatbot-actions {
        justify-content: flex-start;
    }
    
    .a1ai-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .a1ai-modal-body {
        max-height: 70vh;
    }
    
    /* Conversations responsive layout */
    .a1ai-conversations-container {
        flex-direction: column;
        height: auto;
        gap: 15px;
    }
    
    .a1ai-conversations-table {
        height: 400px;
    }
    
    .a1ai-conversation-preview {
        width: 100%;
        height: 400px;
    }
} 

/* Upgrades, Add-Ons & Services Tab Styles */
.a1ai-upgrades-section {
    margin-bottom: 32px;
    animation: a1ai-fadein 0.8s;
}
.a1ai-upgrades-columns {
    display: flex;
    gap: 32px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.a1ai-upgrade-card {
    flex: 1 1 260px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e0e7ff 100%);
    border: 2px solid #4f8cff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(79,140,255,0.08);
    padding: 24px 20px 20px 20px;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}
.a1ai-upgrade-card:hover {
    transform: translateY(-6px) scale(1.03);
    box-shadow: 0 8px 32px rgba(79,140,255,0.18);
    z-index: 2;
}
.a1ai-upgrade-card h4 {
    margin-top: 0;
    color: #2a3d6a;
    font-size: 1.2em;
    margin-bottom: 10px;
}
.a1ai-upgrade-card ul {
    margin: 0 0 16px 0;
    padding-left: 18px;
}
.a1ai-upgrade-card li {
    margin-bottom: 6px;
    font-size: 1em;
}
.a1ai-upgrade-link {
    font-weight: 600;
    font-size: 1em;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(79,140,255,0.10);
    transition: background 0.2s, color 0.2s;
}
.a1ai-upgrade-card.a1ai-upgrade-standard {
    border-color: #4f8cff;
}
.a1ai-upgrade-card.a1ai-upgrade-enterprise {
    border-color: #ffb347;
    background: linear-gradient(135deg, #fff7e0 0%, #ffe7b0 100%);
}
.a1ai-upgrade-card.a1ai-upgrade-enterprise .a1ai-upgrade-link {
    background: #ffb347;
    color: #fff;
}
.a1ai-upgrades-title {
    font-size: 1.5em;
    margin-bottom: 18px;
    color: #2a3d6a;
    letter-spacing: 0.5px;
}
.a1ai-addons-section, .a1ai-services-section {
    margin-bottom: 32px;
    background: #f8fafd;
    border-left: 4px solid #4f8cff;
    padding: 18px 22px 12px 22px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(79,140,255,0.04);
    animation: a1ai-fadein 1.2s;
}
.a1ai-addons-section h3, .a1ai-services-section h3 {
    margin-top: 0;
    color: #2a3d6a;
}
.a1ai-addons-link, .a1ai-services-link {
    margin-top: 10px;
    display: inline-block;
    font-weight: 600;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(79,140,255,0.10);
    transition: background 0.2s, color 0.2s;
}
@media (max-width: 900px) {
    .a1ai-upgrades-columns {
        flex-direction: column;
        gap: 18px;
    }
}
@keyframes a1ai-fadein {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: none; }
} 

/* Upgrades Tab Flashy Enhancements */
.a1ai-upgrades-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(circle at 80% 20%, #e0e7ff 0%, transparent 60%),
                radial-gradient(circle at 20% 80%, #ffe7b0 0%, transparent 70%);
    opacity: 0.25;
    animation: a1ai-bg-move 8s linear infinite alternate;
}
@keyframes a1ai-bg-move {
    0% { background-position: 80% 20%, 20% 80%; }
    100% { background-position: 60% 40%, 40% 60%; }
}
.a1ai-tab-content#tab-upgrades { position: relative; overflow: hidden; }

.a1ai-icon {
    display: inline-block;
    vertical-align: middle;
    margin-right: 7px;
    font-size: 1.2em;
    color: #4f8cff;
}
.a1ai-icon-stars::before { content: '\2605\2605'; color: #ffb347; }
.a1ai-icon-rocket::before { content: '\1F680'; color: #4f8cff; }
.a1ai-icon-puzzle::before { content: '\1F9E9'; color: #6c63ff; }
.a1ai-icon-cog::before { content: '\2699'; color: #2a3d6a; }
.a1ai-icon-arrow::before { content: '\2192'; color: inherit; }

.a1ai-badge {
    position: absolute;
    top: 18px;
    right: 18px;
    background: #ffb347;
    color: #fff;
    font-size: 0.85em;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(255,179,71,0.10);
    z-index: 2;
    letter-spacing: 0.5px;
    animation: a1ai-badge-pop 1.2s;
}
.a1ai-badge-popular { background: #4f8cff; }
.a1ai-badge-value { background: #ffb347; }
@keyframes a1ai-badge-pop {
    0% { transform: scale(0.7); opacity: 0; }
    60% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}
.a1ai-glow {
    box-shadow: 0 0 24px 4px #ffb34755, 0 4px 24px rgba(79,140,255,0.08);
    border-width: 3px;
    animation: a1ai-glow-pulse 2.5s infinite alternate;
}
@keyframes a1ai-glow-pulse {
    0% { box-shadow: 0 0 24px 4px #ffb34755, 0 4px 24px rgba(79,140,255,0.08); }
    100% { box-shadow: 0 0 36px 10px #ffb34799, 0 8px 32px rgba(79,140,255,0.18); }
}
.a1ai-section-divider {
    border: none;
    border-top: 2px dashed #e0e7ff;
    margin: 36px 0 32px 0;
    width: 100%;
    opacity: 0.7;
}
.a1ai-btn-flash {
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s, background 0.2s;
}
.a1ai-btn-flash::after {
    content: '';
    position: absolute;
    left: -75%;
    top: 0;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.7) 100%);
    transform: skewX(-20deg);
    transition: left 0.4s;
    pointer-events: none;
}
.a1ai-btn-flash:hover::after {
    left: 120%;
    transition: left 0.4s;
}
.a1ai-btn-flash:hover, .a1ai-upgrade-link:hover {
    box-shadow: 0 4px 16px #4f8cff33;
    background: #e0e7ff;
    color: #2a3d6a;
} 

/* A1AI Assistant Styles */
.a1ai-assistant-card {
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

.a1ai-assistant-container {
    max-width: 100%;
    margin: 0 auto;
    padding-bottom: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.a1ai-assistant-messages {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e1e1e1;
    flex: 1;
}

.a1ai-assistant-message {
    display: flex;
    margin-bottom: 15px;
    align-items: flex-start;
    gap: 12px;
}

.a1ai-assistant-message:last-child {
    margin-bottom: 0;
}

.a1ai-assistant-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a1ai-assistant-avatar img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
}

.a1ai-assistant-content {
    flex: 1;
    background: #fff;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    max-width: 80%;
}

.a1ai-assistant-content p {
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.a1ai-assistant-content p:last-child {
    margin-bottom: 0;
}

.a1ai-assistant-user .a1ai-assistant-content {
    background: #0073aa;
    color: #fff;
    margin-left: auto;
}

.a1ai-assistant-user .a1ai-assistant-avatar {
    order: 2;
}

.a1ai-assistant-user .a1ai-assistant-content {
    order: 1;
}

.a1ai-assistant-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.a1ai-assistant-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
}

.a1ai-assistant-input button {
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

.a1ai-assistant-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    margin-bottom: 0;
    padding-bottom: 10px;
}

.a1ai-assistant-quick-btn {
    padding: 8px 16px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    margin-bottom: 5px;
}

.a1ai-assistant-quick-btn:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.a1ai-assistant-quick-btn:active {
    transform: translateY(1px);
}

/* Responsive adjustments for quick actions */
@media (max-width: 768px) {
    .a1ai-assistant-quick-actions {
        gap: 8px;
        margin-top: 15px;
    }
    
    .a1ai-assistant-quick-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Typing indicator styles */
#typing-indicator .a1ai-assistant-content {
    background: #f0f0f0;
    color: #666;
    font-style: italic;
}

/* Contact form styles */
.a1ai-contact-form input,
.a1ai-contact-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.a1ai-contact-form button {
    width: 100%;
    padding: 10px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.a1ai-contact-form button:hover {
    background: #005a87;
} 

/* Logo container and fallback styles */
.a1ai-logo-container {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a1ai-logo-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: 4px;
    color: #666;
}

/* Ensure logo image is properly sized */
.a1ai-logo-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

/* Message pair styles for adjust functionality */
.a1ai-message-pair {
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 15px;
    background: #fafafa;
}

.a1ai-message-pair-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e1e1e1;
}

.a1ai-message-pair-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* Adjust button styles */
.a1ai-adjust-button {
    background: #2271b1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
    font-family: inherit;
}

.a1ai-adjust-button:hover {
    background: #135e96;
    color: white;
}

.a1ai-adjust-button:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.a1ai-adjust-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Adjust actions container */
.a1ai-adjust-actions {
    border-top: 1px solid #e1e1e1;
    padding-top: 15px;
    margin-top: 15px;
}

/* Enhanced conversation message styles for paired display */
.a1ai-message-pair .a1ai-conversation-message {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #ddd;
}

.a1ai-message-pair .a1ai-conversation-message.user {
    background: #f0f8ff;
    border-left-color: #2271b1;
}

.a1ai-message-pair .a1ai-conversation-message.assistant {
    background: #f9f9f9;
    border-left-color: #46b450;
}

.a1ai-message-pair .a1ai-conversation-message:last-of-type {
    margin-bottom: 0;
}

/* Message role styling in pairs */
.a1ai-message-pair .role {
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: capitalize;
    font-size: 12px;
    color: #666;
}

/* Message content in pairs */
.a1ai-message-pair .content {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Message time in pairs */
.a1ai-message-pair .time {
    font-size: 11px;
    color: #888;
}

/* Clickable links in admin conversation preview */
.a1ai-conversation-message .content a {
    color: #0073aa;
    text-decoration: underline;
    word-break: break-all;
    transition: color 0.2s ease;
}

.a1ai-conversation-message .content a:hover {
    color: #005177;
    text-decoration: none;
}

.a1ai-conversation-message .content a:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Internal links styling in admin */
.a1ai-link-internal {
    color: #0073aa !important;
    font-weight: 500;
}

.a1ai-link-internal:hover {
    color: #005177 !important;
    text-decoration: underline !important;
}

/* External links styling in admin */
.a1ai-link-external {
    color: #0073aa !important;
    font-weight: 500;
    position: relative;
}

.a1ai-link-external:hover {
    color: #005177 !important;
    text-decoration: underline !important;
}

.a1ai-link-external::after {
    content: " ↗";
    font-size: 0.8em;
    opacity: 0.7;
    margin-left: 2px;
}