/* Tabs */
.nav-tab-wrapper {
    margin-bottom: 20px;
}

/* Cards */
.card {
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 20px;
    margin-top: 20px;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.card h2 {
    margin-top: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

/* Form Rows */
.tuta-form-row {
    margin-bottom: 28px;
}

.tuta-form-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.tuta-form-row .description {
    margin-top: 0;
    margin-bottom: 8px;
    color: #666;
    font-style: normal;
    font-size: 13px;
    line-height: 1.5;
}

.tuta-form-row input[type="text"],
.tuta-form-row textarea {
    width: 100%;
    max-width: 100%;
}

.tuta-form-row .spinner {
    float: none;
    visibility: hidden;
    margin-left: 10px;
}

.tuta-form-row .spinner.is-active {
    visibility: visible;
}

/* Stats */
.tuta-products-stats {
    margin: 20px 0;
    display: flex;
    gap: 40px;
}

.stat-item {
    display: flex;
    gap: 10px;
    align-items: center;
}

.stat-label {
    font-weight: 600;
    color: #23282d;
}

.stat-value {
    color: #666;
}

/* Product Sync Sections */
.tuta-products-card h2 {
    margin-top: 0;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.tuta-intro-content {
    margin-bottom: 24px;
}

.tuta-intro-content p {
    font-size: 14px;
    line-height: 1.5;
    color: #555;
}

.tuta-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 4px;
}

.tuta-section h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 16px;
    color: #23282d;
}

.tuta-section p {
    color: #555;
    margin-bottom: 15px;
    font-size: 13px;
    line-height: 1.5;
}

.tuta-products-section {
    margin-bottom: 24px;
}

.tuta-pages-note {
    margin-top: 0;
    margin-bottom: 15px;
    font-style: italic;
    color: #555;
}

.tuta-sync-disclaimer {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.tuta-sync-disclaimer p {
    color: #555;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

/* Actions */
.tuta-products-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tuta-products-actions .spinner {
    float: none;
    visibility: hidden;
    margin: 0;
}

.tuta-products-actions .spinner.is-active {
    visibility: visible;
}

/* Notices */
.notice.inline {
    margin: 15px 0;
    padding: 10px 12px;
}

/* Agent Grid */
.tuta-agent-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin: 20px 0 40px 0;
}

.tuta-agent-grid .card {
    margin: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 30px;
    max-width: none; /* Override WordPress default max-width */
    width: 100%; /* Ensure the card takes full width */
}

/* Left section (Agent Configuration) */
.tuta-agent-grid .card .agent-settings-section {
    flex: 1; /* Retain if this section's parent card might become flex, otherwise it has little effect */
    width: 100%; /* Fill parent card */
    max-width: 100%; /* Ensure it can fill */
    min-width: 0; /* Remove restrictive min-width */
    padding-right: 0; /* Remove style implying a sidebar */
    border-right: none; /* Remove style implying a sidebar */
    margin-right: 0; /* Remove style implying a sidebar */
}

/* Right section (Chat) */
.tuta-agent-grid .card .test-chat-section {
    display: flex;
    flex-direction: column;
    flex: 1; /* Retain for internal flex layout of chat UI */
    width: 100%; /* Fill parent card */
    max-width: 100%; /* Ensure it can fill */
    min-width: 0; /* Remove restrictive min-width */
}

.tuta-agent-grid .card .test-chat-section h2 {
    margin-top: 0;
    margin-bottom: 15px;
    flex-shrink: 0;
    border-bottom: none;
}

/* Hide session ID */
#tuta-session-id {
    display: none;
}

/* Chat Interface */
.tuta-test-chat {
    display: flex;
    flex-direction: column;
    height: 600px;
    /* background: #f6f7f7; */ /* Removed as requested */
    border-radius: 6px;
    /* border: 1px solid #c3c4c7; */ /* Removed as requested */
    margin-top: 16px;
}

.tuta-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px 4px 0 0;
    min-height: 0;
    max-height: 500px; /* Fixed height instead of viewport-relative */
}

.tuta-chat-message {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    max-width: 80%;
    line-height: 1.5;
    word-wrap: break-word;
}

.tuta-chat-message:last-child {
    margin-bottom: 0;
}

.tuta-chat-message.user {
    background: #e3effd;
    margin-left: auto;
}

.tuta-chat-message.agent {
    background: #fff;
    margin-right: auto;
    border: 1px solid #ddd;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Loading indicator */
.typing-indicator {
    display: none;
    background: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-bottom: 16px;
    width: fit-content;
}

.typing-indicator.active {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #90a4ae;
    border-radius: 50%;
    display: inline-block;
    animation: typing 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 typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Chat Input Area */
.tuta-chat-footer {
    flex-shrink: 0; /* Prevent footer from shrinking */
    padding: 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
}

.tuta-chat-input {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.tuta-chat-input textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    resize: vertical;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 14px;
    line-height: 1.4;
}

.tuta-chat-input button {
    align-self: flex-end;
    height: 44px;
    padding: 0 20px !important;
}

.tuta-chat-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Markdown Styles */
.tuta-chat-message p {
    margin: 0 0 1em;
}

.tuta-chat-message p:last-child {
    margin-bottom: 0;
}

.tuta-chat-message pre {
    background: #f4f4f4;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1em 0;
}

.tuta-chat-message code {
    background: #f4f4f4;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

.tuta-chat-message pre code {
    padding: 0;
    background: none;
}

.tuta-chat-message ul, 
.tuta-chat-message ol {
    margin: 1em 0;
    padding-left: 2em;
}

.tuta-chat-message blockquote {
    border-left: 4px solid #ddd;
    margin: 1em 0;
    padding-left: 1em;
    color: #666;
}

.tuta-chat-message h1,
.tuta-chat-message h2,
.tuta-chat-message h3,
.tuta-chat-message h4,
.tuta-chat-message h5,
.tuta-chat-message h6 {
    margin: 1em 0 0.5em;
    line-height: 1.2;
}

.tuta-chat-message a {
    color: #0073aa;
    text-decoration: underline;
}

.tuta-chat-message img {
    max-width: 100%;
    height: auto;
    margin: 1em 0;
}

/* Responsive adjustments for Agent Tab */
@media screen and (max-width: 1200px) {
    .tuta-agent-grid .card {
        flex-direction: column;
        padding: 24px;
    }
    
    .tuta-agent-grid .card .agent-settings-section,
    .tuta-agent-grid .card .test-chat-section {
        min-width: auto;
        max-width: 100%;
        width: 100%;
    }
    
    .tuta-agent-grid .card:first-child {
        padding-right: 16px;
    }
    
    .tuta-test-chat {
        min-height: 400px; /* Reduced height for stacked layout */
    }
    
    .tuta-chat-messages {
        max-height: 400px; /* Reduced max height for stacked layout */
    }
}

@media screen and (max-width: 782px) {
    .tuta-agent-grid .card {
        padding: 20px;
    }
    
    .tuta-chat-input {
        flex-direction: column;
        gap: 10px;
    }
    
    .tuta-chat-input button {
        align-self: stretch;
        width: 100%;
    }
    
    .tuta-chat-controls {
        flex-wrap: wrap;
    }
    
    .tuta-chat-controls button {
        flex: 1;
        text-align: center;
    }
    
    .tuta-test-chat {
        height: 80vh !important;
    }
    
    .tuta-chat-messages {
        max-height: calc(80vh - 120px) !important;
    }
}

/* Conversations Tab */
.tuta-filters {
    margin: 20px 0;
    padding: 15px;
    background: #fff;
    border: 1px solid #ccd0d4;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.tuta-filters select,
.tuta-filters input[type="date"] {
    margin-right: 10px;
    min-width: 150px;
}

.tuta-filters .button {
    margin-left: 10px;
    vertical-align: middle;
}

/* Conversations Table */
.wp-list-table td {
    vertical-align: middle;
}

.wp-list-table td:nth-child(3) {
    text-align: center;
}

.wp-list-table td:nth-child(4) {
    text-align: center;
    font-size: 18px;
}

/* Responsive adjustments */
@media screen and (max-width: 782px) {
    .tuta-filters select,
    .tuta-filters input[type="date"] {
        width: 100%;
        margin-bottom: 10px;
        margin-right: 0;
    }
    
    .tuta-filters .button {
        width: 100%;
        margin-left: 0;
    }
}

/* Plans Tab Styles - Enhanced */
.tuta-plans-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 15px;
}

.tuta-plans-header {
    text-align: center;
    margin-bottom: 40px;
}

.tuta-plans-header h2 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #23282d;
}

.tuta-plans-header p {
    font-size: 16px;
    color: #50575e;
    max-width: 700px;
    margin: 0 auto;
}

.tuta-billing-toggle {
    display: none !important;
}

.tuta-billing-toggle span {
    padding: 0 10px;
    transition: color 0.3s ease;
}

.tuta-billing-toggle span.active {
    color: #2271b1;
    font-weight: 600;
}

.tuta-billing-toggle .switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
    margin: 0 10px;
}

.tuta-billing-toggle .switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.tuta-billing-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.tuta-billing-toggle .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.tuta-billing-toggle input:checked + .slider {
    background-color: #2271b1;
}

.tuta-billing-toggle input:checked + .slider:before {
    transform: translateX(24px);
}

.savings-badge {
    background-color: #ff6b6b;
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tuta-plans-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    padding: 20px 0;
}

.tuta-plan-card {
    background-color: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 10px;
    padding: 30px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.tuta-plan-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-color: #c3c4c7;
}

.tuta-plan-card.current-plan {
    border: 2px solid #2271b1;
    box-shadow: 0 5px 15px rgba(34, 113, 177, 0.2);
}

.current-plan-label {
    position: absolute;
    top: 20px;
    right: -35px;
    background: #2271b1;
    color: white;
    padding: 5px 40px;
    font-size: 12px;
    font-weight: 600;
    transform: rotate(45deg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.plan-header {
    margin-bottom: 20px;
    padding-top: 10px;
}

.plan-header h3 {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 10px;
    color: #23282d;
}

.plan-header p {
    color: #50575e;
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

.plan-pricing {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f1;
}

.price-option {
    display: none;
    font-size: 16px;
    color: #50575e;
}

.price-option.active {
    display: block;
}

.price-amount {
    font-size: 32px;
    font-weight: 700;
    color: #23282d;
    margin-right: 5px;
}

.price-period {
    font-size: 14px;
    color: #757575;
}

.plan-features {
    margin-bottom: 25px;
    flex-grow: 1;
}

.plan-features h4 {
    font-size: 16px;
    margin: 0 0 15px;
    color: #23282d;
}

.plan-features ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.plan-features li {
    padding: 8px 0 8px 25px;
    position: relative;
    font-size: 14px;
    color: #50575e;
}

.plan-features li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #2271b1;
    font-weight: bold;
}

.plan-trial {
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    color: #50575e;
    font-style: italic;
}

.plan-extra-credits {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 3px solid #2271b1;
    font-size: 14px;
    /* Ensure visibility regardless of theme or CSS conflicts */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 100 !important;
}

.plan-extra-credits p {
    margin: 5px 0;
    line-height: 1.4;
}

.extra-credits-note {
    font-style: italic;
    color: #666;
    font-size: 13px;
}

.plan-actions {
    text-align: center;
}

.plan-actions .button {
    width: 100%;
    padding: 8px 12px;
    height: auto;
    font-size: 15px;
    font-weight: 500;
}

.plan-actions .button.button-primary {
    background-color: #2271b1;
    border-color: #2271b1;
    box-shadow: 0 2px 5px rgba(34, 113, 177, 0.3);
}

.plan-actions .button.button-primary:hover {
    background-color: #135e96;
    border-color: #135e96;
}

.plan-actions .button.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Loading state */
.tuta-loading {
    text-align: center;
    padding: 40px;
    grid-column: 1 / -1;
}

.tuta-loading .spinner {
    float: none;
    margin: 0 auto 10px;
    visibility: visible;
}

/* Responsive adjustments */
@media screen and (max-width: 1200px) {
    .tuta-plans-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
        row-gap: 90px;
    }
    
    .tuta-plan-card {
        margin-bottom: 20px;
    }
    
    .current-plan-label {
        right: -40px;
        padding: 5px 45px;
    }
}

@media screen and (max-width: 782px) {
    .tuta-plans-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
        gap: 12px !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    .tuta-plans-header h2 {
        font-size: 24px;
    }
    
    .tuta-plans-header p {
        font-size: 14px;
    }
    
    .plan-header h3 {
        font-size: 20px;
    }
    
    .price-amount {
        font-size: 28px;
    }
    
    /* Ensure the current plan ribbon doesn't overlap with content */
    .tuta-plan-card.current-plan {
        padding-top: 40px;
        margin-top: 20px;
    }
    
    .current-plan-label {
        top: 15px;
        right: -45px;
        padding: 5px 50px;
    }
    
    .tuta-plan-card {
        margin-bottom: 12px !important;
        margin-top: 4px !important;
    }
}

/* WordPress Admin Integration */
.tuta-plan-card .button-primary {
    background: #2271b1;
    border-color: #2271b1;
    color: white;
}

.tuta-plan-card .button-primary:hover {
    background: #135e96;
    border-color: #135e96;
}

.tuta-plan-card .button-primary.updating-message:before {
    margin: 0;
    padding: 0;
}

/* Markdown Styles - Enhanced */
.tuta-chat-message p {
    margin: 0 0 1em;
    line-height: 1.6;
}

.tuta-chat-message p:last-child {
    margin-bottom: 0;
}

.tuta-chat-message pre {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1em 0;
    border: 1px solid #e9ecef;
}

.tuta-chat-message code {
    background: #f8f9fa;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #e83e8c;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.tuta-chat-message pre code {
    padding: 0;
    background: none;
    color: #333;
    font-size: 0.95em;
}

.tuta-chat-message ul, 
.tuta-chat-message ol {
    margin: 1em 0;
    padding-left: 2em;
}

.tuta-chat-message li {
    margin-bottom: 0.5em;
}

.tuta-chat-message blockquote {
    border-left: 4px solid #2271b1;
    margin: 1em 0;
    padding: 0.5em 0 0.5em 1em;
    color: #555;
    background: rgba(34, 113, 177, 0.05);
    border-radius: 0 4px 4px 0;
}

.tuta-chat-message h1,
.tuta-chat-message h2,
.tuta-chat-message h3,
.tuta-chat-message h4,
.tuta-chat-message h5,
.tuta-chat-message h6 {
    margin: 1.2em 0 0.6em;
    line-height: 1.3;
    color: #23282d;
    font-weight: 600;
}

.tuta-chat-message h1 { font-size: 1.8em; }
.tuta-chat-message h2 { font-size: 1.6em; }
.tuta-chat-message h3 { font-size: 1.4em; }
.tuta-chat-message h4 { font-size: 1.2em; }
.tuta-chat-message h5 { font-size: 1.1em; }
.tuta-chat-message h6 { font-size: 1em; }

.tuta-chat-message a {
    color: #2271b1;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.tuta-chat-message a:hover {
    color: #135e96;
}

.tuta-chat-message img {
    max-width: 100%;
    height: auto;
    margin: 1em 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tuta-chat-message table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.tuta-chat-message table th,
.tuta-chat-message table td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.tuta-chat-message table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.tuta-chat-message table tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* WhatsApp Tab Styles */
.tuta-whatsapp-container {
    margin-top: 20px;
    width: 100%;
}

.tuta-whatsapp-header {
    margin-bottom: 20px;
}

.tuta-whatsapp-header h2 {
    margin-bottom: 10px;
    font-size: 24px;
    font-weight: 600;
    color: #23282d;
}

.tuta-whatsapp-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 25px;
    width: 100%;
    box-sizing: border-box;
    display: block;
}

.tuta-whatsapp-setup.card {
    margin-bottom: 30px;
    width: 100%;
    max-width: 100%;
}

/* Ensure content uses full width */
.tuta-content-section {
    width: 100%;
    max-width: 100%;
}

.tuta-content {
    width: 100%;
    max-width: 100%;
}

.tuta-whatsapp-status {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f0f6fc;
    border-radius: 8px;
    border-left: 4px solid #2271b1;
}

.tuta-whatsapp-status .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    margin-right: 15px;
    color: #00a32a;
}

.tuta-whatsapp-status h3 {
    margin: 0;
    font-size: 18px;
    color: #23282d;
}

.tuta-whatsapp-info {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.tuta-whatsapp-info p {
    margin: 0 0 15px 0;
    font-size: 14px;
    line-height: 1.5;
    color: #50575e;
}

.tuta-whatsapp-info p:last-child {
    margin-bottom: 0;
}

.tuta-whatsapp-actions {
    margin-top: 20px;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}

.tuta-whatsapp-actions h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #23282d;
}

.tuta-whatsapp-actions p {
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
    color: #50575e;
}

.tuta-whatsapp-actions button {
    margin-right: 15px;
    margin-top: 10px;
    padding: 8px 16px;
    height: auto;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tuta-whatsapp-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.tuta-whatsapp-setup {
    margin-bottom: 30px;
}

.tuta-whatsapp-setup p {
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.tuta-whatsapp-requirements {
    margin: 25px 0;
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}

.tuta-whatsapp-requirements h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #23282d;
}

.tuta-whatsapp-requirements p {
    margin-bottom: 10px;
}

.tuta-whatsapp-requirements ul {
    margin-left: 20px;
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #50575e;
}

.tuta-whatsapp-requirements li {
    margin-bottom: 8px;
}

.tuta-whatsapp-requirements li:last-child {
    margin-bottom: 0;
}

.tuta-whatsapp-onboard {
    margin: 25px 0;
    text-align: center;
}

.tuta-whatsapp-onboard button {
    padding: 10px 20px;
    height: auto;
    font-size: 15px;
    font-weight: 500;
    min-width: 200px;
    transition: all 0.2s ease;
}

.tuta-whatsapp-onboard button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tuta-whatsapp-unsupported {
    margin-top: 30px;
    background: #fff8e5;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #f0b849;
}

.tuta-whatsapp-unsupported h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #23282d;
}

.tuta-whatsapp-unsupported p {
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
    color: #50575e;
}

.tuta-whatsapp-unsupported ul {
    columns: 2;
    margin-left: 20px;
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #50575e;
}

.tuta-whatsapp-unsupported li {
    margin-bottom: 8px;
}

.tuta-whatsapp-result {
    margin-top: 20px;
    padding: 15px;
    border-radius: 5px;
    display: none;
    position: relative;
    animation: fadeInUp 0.4s ease-out;
}

.tuta-whatsapp-result .tuta-result-content {
    display: flex;
    align-items: flex-start;
}

.tuta-whatsapp-result .dashicons {
    margin-right: 15px;
    font-size: 22px;
    width: 22px;
    height: 22px;
}

.tuta-whatsapp-result p {
    margin: 0;
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
}

/* WhatsApp section */
.plan-whatsapp {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    background: #f0f7f4 !important;
    padding: 15px !important;
    border-radius: 4px !important;
    margin: 0 0 20px 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 100 !important;
    text-align: left !important;
}

.plan-whatsapp .whatsapp-logo-container {
    width: 100% !important;
    display: flex !important;
    justify-content: flex-start !important;
    margin-bottom: 10px !important;
}

.plan-whatsapp .whatsapp-logo {
    width: 150px !important;
    height: auto !important;
    display: block !important;
}

.plan-whatsapp .whatsapp-text {
    width: 100% !important;
    display: block !important;
    text-align: left !important;
}

.plan-whatsapp .whatsapp-text span {
    font-size: 14px !important;
    color: #333 !important;
    font-weight: 500 !important;
    display: inline-block !important;
}

.plan-pricing {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f1;
}

.price-option {
    display: none;
    font-size: 16px;
    color: #50575e;
}

.price-option.active {
    display: block;
}

.price-amount {
    font-size: 32px;
    font-weight: 700;
    color: #23282d;
    margin-right: 5px;
}

.price-period {
    font-size: 14px;
    color: #757575;
}

.plan-features {
    margin-bottom: 25px;
    flex-grow: 1;
}

.plan-features h4 {
    font-size: 16px;
    margin: 0 0 15px;
    color: #23282d;
}

.plan-features ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.plan-features li {
    padding: 8px 0 8px 25px;
    position: relative;
    font-size: 14px;
    color: #50575e;
}

.plan-features li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #2271b1;
    font-weight: bold;
}

.plan-trial {
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    color: #50575e;
    font-style: italic;
}

.plan-extra-credits {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 3px solid #2271b1;
    font-size: 14px;
    /* Ensure visibility regardless of theme or CSS conflicts */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 100 !important;
}

.plan-extra-credits p {
    margin: 5px 0;
    line-height: 1.4;
}

.extra-credits-note {
    font-style: italic;
    color: #666;
    font-size: 13px;
}

.plan-actions {
    text-align: center;
}

.plan-actions .button {
    width: 100%;
    padding: 8px 12px;
    height: auto;
    font-size: 15px;
    font-weight: 500;
}

.plan-actions .button.button-primary {
    background-color: #2271b1;
    border-color: #2271b1;
    box-shadow: 0 2px 5px rgba(34, 113, 177, 0.3);
}

.plan-actions .button.button-primary:hover {
    background-color: #135e96;
    border-color: #135e96;
}

.plan-actions .button.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Loading state */
.tuta-loading {
    text-align: center;
    padding: 40px;
    grid-column: 1 / -1;
}

.tuta-loading .spinner {
    float: none;
    margin: 0 auto 10px;
    visibility: visible;
}

/* Responsive adjustments */
@media screen and (max-width: 1200px) {
    .tuta-plans-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
        row-gap: 90px;
    }
    
    .tuta-plan-card {
        margin-bottom: 20px;
    }
    
    .current-plan-label {
        right: -40px;
        padding: 5px 45px;
    }
}

@media screen and (max-width: 782px) {
    .tuta-plans-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
        gap: 60px;
    }
    
    .tuta-plans-header h2 {
        font-size: 24px;
    }
    
    .tuta-plans-header p {
        font-size: 14px;
    }
    
    .plan-header h3 {
        font-size: 20px;
    }
    
    .price-amount {
        font-size: 28px;
    }
    
    /* Ensure the current plan ribbon doesn't overlap with content */
    .tuta-plan-card.current-plan {
        padding-top: 40px;
        margin-top: 20px;
    }
    
    .current-plan-label {
        top: 15px;
        right: -45px;
        padding: 5px 50px;
    }
    
    .tuta-plan-card {
        margin-bottom: 60px !important;
    }
}

/* WordPress Admin Integration */
.tuta-plan-card .button-primary {
    background: #2271b1;
    border-color: #2271b1;
    color: white;
}

.tuta-plan-card .button-primary:hover {
    background: #135e96;
    border-color: #135e96;
}

.tuta-plan-card .button-primary.updating-message:before {
    margin: 0;
    padding: 0;
}

/* Markdown Styles - Enhanced */
.tuta-chat-message p {
    margin: 0 0 1em;
    line-height: 1.6;
}

.tuta-chat-message p:last-child {
    margin-bottom: 0;
}

.tuta-chat-message pre {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1em 0;
    border: 1px solid #e9ecef;
}

.tuta-chat-message code {
    background: #f8f9fa;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #e83e8c;
    font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.tuta-chat-message pre code {
    padding: 0;
    background: none;
    color: #333;
    font-size: 0.95em;
}

.tuta-chat-message ul, 
.tuta-chat-message ol {
    margin: 1em 0;
    padding-left: 2em;
}

.tuta-chat-message li {
    margin-bottom: 0.5em;
}

.tuta-chat-message blockquote {
    border-left: 4px solid #2271b1;
    margin: 1em 0;
    padding: 0.5em 0 0.5em 1em;
    color: #555;
    background: rgba(34, 113, 177, 0.05);
    border-radius: 0 4px 4px 0;
}

.tuta-chat-message h1,
.tuta-chat-message h2,
.tuta-chat-message h3,
.tuta-chat-message h4,
.tuta-chat-message h5,
.tuta-chat-message h6 {
    margin: 1.2em 0 0.6em;
    line-height: 1.3;
    color: #23282d;
    font-weight: 600;
}

.tuta-chat-message h1 { font-size: 1.8em; }
.tuta-chat-message h2 { font-size: 1.6em; }
.tuta-chat-message h3 { font-size: 1.4em; }
.tuta-chat-message h4 { font-size: 1.2em; }
.tuta-chat-message h5 { font-size: 1.1em; }
.tuta-chat-message h6 { font-size: 1em; }

.tuta-chat-message a {
    color: #2271b1;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.tuta-chat-message a:hover {
    color: #135e96;
}

.tuta-chat-message img {
    max-width: 100%;
    height: auto;
    margin: 1em 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tuta-chat-message table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

.tuta-chat-message table th,
.tuta-chat-message table td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.tuta-chat-message table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.tuta-chat-message table tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Loading Spinner */
.tuta-loading-spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    margin-right: 15px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 3px solid #2271b1;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Countdown Timer */
.tuta-countdown {
    margin-top: 10px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

.tuta-countdown span {
    font-weight: bold;
    color: #2271b1;
}

/* Button Active Effect */
.tuta-button-active {
    transform: scale(0.97) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

/* Animation for notifications */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Styles for the plan upgrade section */
.tuta-whatsapp-upgrade {
    text-align: center;
    padding: 30px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.tuta-whatsapp-upgrade:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.tuta-whatsapp-unavailable {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.tuta-whatsapp-unavailable .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    color: #6c757d;
    margin-bottom: 15px;
}

.tuta-whatsapp-unavailable h3 {
    margin: 0 0 15px 0;
    color: #23282d;
    font-size: 18px;
}

.tuta-whatsapp-upgrade p {
    margin-bottom: 15px;
    color: #50575e;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    font-size: 14px;
    line-height: 1.6;
}

.tuta-whatsapp-upgrade .button {
    margin-top: 15px;
    font-weight: 500;
    padding: 8px 20px;
    height: auto;
    font-size: 15px;
    min-width: 200px;
    transition: all 0.2s ease;
}

.tuta-whatsapp-upgrade .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@media screen and (max-width: 782px) {
    .tuta-whatsapp-unsupported ul {
        columns: 1;
    }
    
    .tuta-whatsapp-actions button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
}

/* General Notices */
.tuta-notice {
    margin: 20px 0;
    padding: 15px 20px;
    border-radius: 5px;
    border-left: 4px solid;
}

.tuta-notice h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.tuta-notice p {
    margin-bottom: 10px;
}

.tuta-notice p:last-child {
    margin-bottom: 0;
}

.tuta-notice-info {
    background-color: #e5f5fa;
    border-color: #00a0d2;
}

.tuta-notice-warning {
    background-color: #fef8ee;
    border-color: #ffb900;
}

.tuta-notice-success {
    background-color: #ecf7ed;
    border-color: #46b450;
}

.tuta-notice-error {
    background-color: #fef1f1;
    border-color: #dc3232;
}

/* PayProGlobal Checkout Styles */
.ppg-checkout-modal {
    display: none;
    position: fixed;
    z-index: 99999999; /* Increased z-index to be above WordPress admin bar */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.7); /* Semi-transparent background */
    border: 0px none transparent;
}

.ppg-checkout-modal.ppg-show {
    display: block;
}

.ppg-btn-close {
    position: fixed;
    top: 20px;
    right: 35px;
    background: rgb(0 0 0 / 35%);
    height: 50px;
    width: 50px;
    border-radius: 100%;
    cursor: pointer;
    z-index: 100000000; /* Increased z-index to be above iframe */
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    line-height: 50px;
    text-align: center;
}

.ppg-btn-close.ppg-show {
    display: flex;
}

.ppg-btn-close img {
    width: 25px;
    height: 25px;
}

.ppg-iframe {
    border: 0px none transparent;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    position: absolute;
    top: 0;
    left: 0;
    padding-top: 32px; /* Add padding-top to account for WordPress admin bar */
    box-sizing: border-box;
}

.ppg-loader {
    position: fixed;
    top: calc(50% - 20px);
    left: calc(50% - 20px);
    margin: auto;
    border: 8px solid rgba(255, 255, 255, 0.3); /* Lighter border to be visible on dark background */
    border-radius: 50%;
    border-top: 8px solid #3498db; /* Blue color for spinner */
    width: 40px;
    height: 40px;
    -webkit-animation: spin 1s linear infinite;
    animation: spin 1s linear infinite;
    z-index: 10000;
    /* No background added to the loader itself */
}

@-webkit-keyframes spin {
    0% { -webkit-transform: rotate(0deg); }
    100% { -webkit-transform: rotate(360deg); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Media query for mobile devices */
@media screen and (max-width: 782px) {
    .ppg-iframe {
        padding-top: 46px; /* WordPress admin bar is taller on mobile */
    }
}

/* Media query for even smaller screens */
@media screen and (max-width: 600px) {
    .ppg-iframe {
        padding-top: 0; /* Admin bar might auto-hide on very small screens */
    }
}

/* Add spacing to the top button */
.tuta-plan-card > .plan-actions {
    margin-bottom: 20px;
}

/* Loader styles */
.tuta-loader-container {
    position: fixed;
    z-index: 100000; 
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    justify-content: center;
    align-items: center;
    /* No background or overlay here */
}

.tuta-loader {
    border: 5px solid #f3f3f3;
    border-radius: 50%;
    border-top: 5px solid #0073aa;
    width: 50px;
    height: 50px;
    animation: tuta-spin 1s linear infinite;
}

@keyframes tuta-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tuta Dashboard Styles */
.tuta-dashboard-overview {
    margin-top: 20px;
}

.tuta-dashboard-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 782px) {
    .tuta-dashboard-row {
        flex-direction: column;
    }
}

.tuta-dashboard-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 20px;
    flex: 1;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    position: relative; /* Ensure proper positioning context */
}

.tuta-dashboard-card h3 {
    margin-top: 0;
    display: flex;
    align-items: center;
    font-size: 16px;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.tuta-dashboard-card h3 .dashicons {
    margin-right: 8px;
    color: #2271b1;
}

.tuta-card-actions {
    position: relative;
    bottom: auto;
    right: auto;
    text-align: center;
    margin-top: auto;
    padding-top: 15px;
}

.tuta-card-actions .button {
    width: 100%; /* Make buttons full width */
    text-align: center;
    margin-bottom: 0;
}

/* Sync Status Card */
.tuta-sync-info p {
    margin: 8px 0;
}

.tuta-sync-explanation {
    margin-top: 15px !important;
    padding: 10px;
    background: #f8f9fa;
    border-left: 4px solid #2271b1;
    color: #505050;
    font-size: 13px;
    line-height: 1.5;
}

/* Conversations Card */
.tuta-usage-counter {
    padding: 10px 0;
}

.tuta-counter-main {
    display: flex;
    justify-content: center;
    align-items: baseline;
    margin-bottom: 15px;
}

.tuta-counter-value {
    font-size: 42px;
    font-weight: bold;
    color: #2271b1;
    line-height: 1;
    text-align: center;
    display: block;
    width: 100%;
}

.tuta-counter-limit {
    font-size: 20px;
    color: #757575;
}

.tuta-usage-progress {
    margin: 15px 0;
}

.tuta-progress-bar {
    height: 10px;
    background: #e9e9e9;
    border-radius: 5px;
    overflow: hidden;
    margin: 15px 0 10px 0;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.tuta-progress-fill {
    height: 100%;
    background: linear-gradient(to right, #2271b1, #4f94d4);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.tuta-chats-remaining {
    font-size: 13px;
    color: #505050;
    text-align: right;
    margin-top: 5px;
    font-weight: normal;
}

.tuta-conversation-breakdown {
    margin-top: 15px;
    padding-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tuta-channel.tuta-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f2f7fc;
    border-radius: 6px;
    margin-bottom: 10px;
    border: none;
}

.tuta-channel-label {
    font-weight: 600;
    color: #505050;
    font-size: 16px;
}

.tuta-channel-value {
    font-weight: bold;
    color: #2271b1;
    font-size: 16px;
}

/* Revenue Card */
.tuta-revenue-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tuta-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.tuta-stat-label {
    font-weight: 600;
    color: #505050;
}

.tuta-stat-value {
    font-weight: bold;
    color: #2271b1;
    font-size: 16px;
}

/* Agent Card */
.tuta-agent-info p {
    margin: 8px 0;
}

.tuta-agent-explanation {
    margin-top: 15px !important;
    padding: 10px;
    background: #f8f9fa;
    border-left: 4px solid #2271b1;
    color: #505050;
    font-size: 13px;
    line-height: 1.5;
}

/* Keep existing styles below */
.tuta-connection-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.tuta-connection-header h3 {
    margin: 0 0 0 8px;
}

.tuta-connection-status {
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.tuta-connection-status:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.tuta-connection-status p {
    margin: 8px 0;
    font-size: 14px;
}

.tuta-connection-status .button-small {
    margin-left: 10px;
}

.tuta-connection-success {
    background-color: #f0f6fc;
    border-left: 5px solid #2271b1;
}

.tuta-connection-success .dashicons-yes-alt {
    color: #00a32a;
    font-size: 24px;
}

.tuta-connection-error {
    background-color: #fcf0f1;
    border-left: 5px solid #d63638;
}

.tuta-connection-error .dashicons-no {
    color: #d63638;
    font-size: 24px;
}

.tuta-usage-counter {
    font-size: 28px;
    font-weight: 600;
    color: #2271b1;
    margin: 12px 0;
    text-align: center;
}

.tuta-counter-limit {
    font-size: 18px;
    color: #8c8f94;
}

.tuta-chats-remaining {
    font-size: 14px;
    color: #555;
    text-align: center;
    margin-top: 8px;
    background: #f0f8ff;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #e6f0ff;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.tuta-chats-remaining strong {
    color: #2271b1;
    font-weight: 700;
}

.tuta-sync-info p {
    margin: 5px 0;
}

.tuta-revenue-stats {
    margin: 12px 0;
}

.tuta-stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #f0f0f1;
}

.tuta-stat:last-child {
    border-bottom: none;
}

.tuta-stat-label {
    font-weight: 500;
}

.tuta-stat-value {
    font-weight: 600;
    color: #2271b1;
}

.tuta-card-actions {
    position: relative;
    bottom: auto;
    right: auto;
    text-align: center;
    margin-top: auto;
    padding-top: 15px;
}

/* Responsive adjustments */
@media (max-width: 782px) {
    .tuta-dashboard-row {
        flex-direction: column;
    }
    
    .tuta-dashboard-card {
        width: 100%;
    }
}

.tuta-counter-main {
    display: flex;
    justify-content: center;
    align-items: baseline;
    margin-bottom: 15px;
}

/* Fix for channel stats in the conversation card */
.tuta-usage-counter .tuta-channel.tuta-stat {
    background-color: #f5f9fc;
    padding: 12px 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px;
}

.tuta-usage-counter .tuta-channel-label {
    font-size: 16px;
    font-weight: 600;
    color: #505050;
}

.tuta-usage-counter .tuta-channel-value {
    font-size: 16px;
    font-weight: bold;
    color: #2271b1;
}

/* Progress bar and counter specific styles */
.tuta-dashboard-card .tuta-counter-value {
    color: #2271b1;
    font-size: 42px;
    font-weight: bold;
    text-align: center;
    line-height: 1.2;
    margin-bottom: 10px;
}

.tuta-dashboard-card .tuta-counter-main {
    display: block;
    text-align: center;
    margin-bottom: 20px;
}

.tuta-dashboard-card .tuta-chats-remaining {
    color: #505050;
    text-align: right;
    font-size: 13px;
}

/* Override any conflicting styles */
.tuta-conversation-breakdown {
    margin-top: 20px;
    border-top: none;
}

.tuta-progress-bar {
    margin: 5px 0 10px 0;
    height: 10px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Toggle Switch */
.tuta-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-top: 5px;
}

.tuta-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.tuta-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.tuta-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .tuta-slider {
    background-color: #2196F3;
}

input:focus + .tuta-slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .tuta-slider:before {
    transform: translateX(26px);
}

/* Settings Cards */
.tuta-settings-card {
    max-width: 800px;
    margin-bottom: 25px;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tuta-settings-card h2 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    font-size: 18px;
}

.tuta-settings-card p {
    color: #555;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

/* Tab intro text */
.tuta-tab-intro {
    max-width: 800px;
    font-size: 14px;
    color: #555;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Settings description text */
.setting-description {
    margin: 0 0 8px 0 !important;
    color: #666;
    font-size: 13px;
    line-height: 1.5;
}

/* Web Chat Layout */
.tuta-chat-layout {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

.tuta-chat-settings {
    flex: 1;
    min-width: 440px;
    max-width: 600px;
}

.tuta-chat-preview-wrapper {
    flex: 1;
    min-width: 440px;
}

.tuta-chat-preview-header {
    margin-bottom: 15px;
}

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

.tuta-chat-preview-header p {
    margin: 0;
    color: #555;
    font-size: 14px;
}

/* Website Mockup Styles */
.tuta-site-mockup {
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    background: #fff;
    height: 650px;
    position: relative;
}

.tuta-mockup-header {
    background: #f0f0f0;
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tuta-mockup-url {
    background: white;
    border-radius: 15px;
    padding: 5px 15px;
    color: #555;
    font-size: 13px;
    width: 60%;
    text-align: center;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tuta-mockup-controls {
    display: flex;
    gap: 5px;
}

.tuta-mockup-controls span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: block;
}

.tuta-mockup-controls span:nth-child(1) {
    background: #ff5f57;
}

.tuta-mockup-controls span:nth-child(2) {
    background: #ffbd2e;
}

.tuta-mockup-controls span:nth-child(3) {
    background: #28c941;
}

.tuta-mockup-content {
    position: relative;
    height: calc(100% - 40px);
    overflow: hidden;
    background: #f9f9f9;
}

/* Placeholder website content */
.tuta-mockup-placeholder {
    padding: 20px;
    opacity: 0.7;
}

.tuta-placeholder-header {
    height: 40px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 30px;
}

.tuta-placeholder-blocks {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.tuta-placeholder-block {
    height: 20px;
    background: #e0e0e0;
    border-radius: 4px;
}

.tuta-placeholder-block:nth-child(2) {
    width: 85%;
}

.tuta-placeholder-block:nth-child(3) {
    width: 65%;
}

.tuta-placeholder-image {
    height: 200px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 30px;
}

/* Chat preview container positioning */
#tuta-chat-preview-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Update chat bubble styles to appear properly in the mockup */
#tuta-chat-preview-container .tuta-chat-widget {
    position: absolute;
    bottom: 20px;
    z-index: 10;
}

#tuta-chat-preview-container .tuta-chat-widget.right {
    right: 20px;
}

#tuta-chat-preview-container .tuta-chat-widget.left {
    left: 20px;
}

/* Responsive styles */
@media screen and (max-width: 1200px) {
    .tuta-chat-layout {
        flex-direction: column;
        gap: 20px;
    }
    
    .tuta-chat-settings, 
    .tuta-chat-preview-wrapper {
        max-width: 100%;
        width: 100%;
    }
    
    .tuta-site-mockup {
        height: 550px;
    }
}

.tuta-full-width {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

/* Responsive Layout Adjustments */
@media screen and (max-width: 782px) {
    .tuta-whatsapp-container {
        padding: 0;
    }
    
    .tuta-whatsapp-content {
        padding: 15px;
    }
    
    .tuta-whatsapp-setup.card {
        padding: 15px;
    }
    
    .tuta-whatsapp-unsupported ul {
        columns: 1;
    }
    
    .tuta-whatsapp-actions button {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
}

/* Ensure content doesn't overflow on mobile */
.tuta-whatsapp-setup.card * {
    max-width: 100%;
    word-wrap: break-word;
}

/* Conversation Modal Styles */
.tuta-modal {
    display: none !important;
    position: fixed !important;
    z-index: 100000 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: auto !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
}

.tuta-modal[style*="display: block"] {
    display: block !important;
}

.tuta-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 25px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: fadeInModal 0.3s ease-out;
    position: relative !important; /* Ensure close icon anchors inside */
}

@keyframes fadeInModal {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tuta-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 20px;
    top: 15px;
    cursor: pointer;
    transition: color 0.2s;
}

.tuta-modal-close:hover,
.tuta-modal-close:focus {
    color: #2271b1;
    text-decoration: none;
}

.tuta-modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    font-size: 20px;
    padding-right: 30px; /* Space for close button */
}

/* Conversation Meta Information */
.tuta-conversation-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.tuta-conv-meta {
    display: flex;
    gap: 15px;
    align-items: center;
}

.tuta-conv-channel {
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 13px;
}

.tuta-conv-channel.whatsapp {
    background-color: #dcf8c6;
    color: #075e54;
}

.tuta-conv-channel.web {
    background-color: #e3effd;
    color: #2271b1;
}

.tuta-conv-channel.test {
    background-color: #f0f0f0;
    color: #666;
}

.tuta-conv-date {
    color: #666;
    font-size: 13px;
}

.tuta-conv-purchase {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.tuta-conv-purchase.has-purchase {
    background-color: #e7f5e9;
    color: #338a3e;
}

.tuta-conv-purchase.no-purchase {
    background-color: #f9f9f9;
    color: #666;
}

/* Messages Loading State */
.tuta-messages-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: #666;
}

.tuta-messages-loading .spinner {
    float: none;
    margin: 0 0 15px 0;
    visibility: visible;
}

.tuta-messages-loading p {
    margin-top: 10px;
    font-style: italic;
}

/* Improved Table Styles */
.wrap .tab-content .wp-list-table {
    border-collapse: collapse;
    margin-top: 15px;
}

.wrap .tab-content .wp-list-table th {
    font-weight: 600;
    color: #23282d;
    padding: 10px;
}

.wrap .tab-content .wp-list-table td {
    padding: 12px 10px;
    vertical-align: middle;
}

.wrap .tab-content .wp-list-table tr:hover {
    background-color: #f7f7f7;
}

.tuta-view-conversation {
    min-width: 100px;
    text-align: center;
}

/* Common Card Styles (Aesthetics) */
.wrap .tab-content > .card, /* Direct child cards of tab content (e.g., Conversations main, Train AI outer) */
.tuta-agent-grid .card {    /* The single inner card of Train AI grid that becomes flex container */
    padding: 24px;
    background: #fff;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    border: 1px solid #ccd0d4;
    box-sizing: border-box;
    position: relative;
    border-radius: 0;
}

/* Full width and default margin for main cards directly under tab-content */
.wrap .tab-content > .card {
    width: 100%;
    min-width: unset;
    max-width: none;
    margin: 20px 0;
}

/* Layout for Agent Tab Container */
.tuta-agent-grid {
    margin: 0; /* The outer .wrap .tab-content > .card provides margin */
    width: 100%; /* Fill the outer card */
}

/* The single card INSIDE .tuta-agent-grid - This card creates the 2-column flex layout */
.tuta-agent-grid .card {
    margin: 0; /* Reset margin if inherited */
    padding: 30px; /* Specific padding for this card, as per original styles hint */
    height: fit-content;
    display: flex; 
    flex-direction: row;
    gap: 24px; 
    width: 100%; 
}

/* Left section (Agent Configuration) - Flex item */
.tuta-agent-grid .card .agent-settings-section {
    flex: 1; 
    /* Consider adding back border/padding for separation if needed, e.g.: */
    /* padding-right: 15px; */
    /* border-right: 1px solid #eee; */
}

/* Right section (Chat) - Flex item */
.tuta-agent-grid .card .test-chat-section {
    flex: 1; 
    display: flex; /* Internal layout: for chat messages and input */
    flex-direction: column;
}

/* Hide session ID */
#tuta-session-id {
    display: none;
}

/* Chat Interface */
.tuta-test-chat {
    display: flex;
    flex-direction: column;
    height: 600px;
    /* background: #f6f7f7; */ /* Removed as requested */
    border-radius: 6px;
    /* border: 1px solid #c3c4c7; */ /* Removed as requested */
    margin-top: 16px;
}

.tuta-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #fff;
    border-radius: 6px 6px 0 0;
}

.tuta-chat-footer {
    padding: 16px;
    background: #f6f7f7;
    border-top: 1px solid #c3c4c7;
    border-radius: 0 0 6px 6px;
}

.tuta-chat-input {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.tuta-chat-input textarea {
    flex: 1;
    min-height: 60px;
    padding: 8px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    resize: vertical;
}

.tuta-chat-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.typing-indicator {
    display: none;
    padding: 12px;
    background: #f0f0f1;
    border-radius: 6px;
    margin-bottom: 12px;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #646970;
    border-radius: 50%;
    margin: 0 2px;
    animation: typing 1s infinite;
}

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

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

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* Table and Filters */
.tuta-filters {
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.tuta-filters select,
.tuta-filters input {
    min-width: 200px;
}

.tuta-filters button {
    min-width: 100px;
}

.wp-list-table {
    width: 100%;
    border-spacing: 0;
    border-collapse: collapse;
}

.wp-list-table th,
.wp-list-table td {
    padding: 12px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #ccd0d4;
}

.wp-list-table th {
    font-weight: 600;
    line-height: 1.3em;
    color: #1d2327;
}

/* Markdown content styling */
.tuta-message-content img {
    max-width: 75%;
    height: auto;
    border-radius: 4px;
}

.tuta-message-content pre {
    background: #f0f0f1;
    /* Add other pre styles from your original CSS if any */
}

/* Icon Styles for Conversation Status */
.tuta-icon-success {
    color: green;
}

.tuta-icon-disabled {
    color: #ccc;
}

/* Styles for Tuta AI column in WooCommerce Orders List */
.column-tuta_generated,
.woocommerce-orders-table .column-tuta_generated { /* HPOS compatibility */
    width: 80px; /* Adjusted from 60px (debug) and 80px (previous) */
    text-align: center !important; /* Ensure centering, from debug_columns */
}

.column-tuta_generated .tuta-ai-badge {
    font-size: 18px !important; /* From inline style & debug_columns */
    display: inline-block !important; /* From inline style & debug_columns */
    line-height: 1 !important; /* From debug_columns */
    vertical-align: middle;
}

.column-tuta_generated .tuta-view-conversation {
    /* padding: 0 6px !important; (from existing generic .tuta-view-conversation) */
    /* height: 24px !important; (from existing generic .tuta-view-conversation) */
    /* line-height: 22px !important; (from existing generic .tuta-view-conversation) */
    /* vertical-align: middle; (from existing generic .tuta-view-conversation) */
    cursor: pointer !important; /* From inline style */
    background-color: #f0f0f1 !important; /* From inline style */
    border: 1px solid #c3c4c7 !important; /* From inline style */
    margin-left: 4px; /* Add a small margin if badge and button are side-by-side */
}

.column-tuta_generated .tuta-view-conversation .dashicons {
    /* vertical-align: text-bottom; (from existing generic .tuta-view-conversation .dashicons) */
    font-size: 16px; /* From inline style */
    width: 16px; /* From inline style */
    height: 16px; /* From inline style */
    margin-top: 0; /* Reset margin-top if using flex/vertical-align on button */
    vertical-align: middle; /* Align better with button text */
}

/* Modal styles for order list view conversation - These were moved from class-tuta-admin-woocommerce.php */
/* ... ensure these styles are below or correctly merged ... */
/* .tuta-modal { ... } */
/* .tuta-modal-content { ... } */
/* etc. */

/* Credit Usage Display in Admin */
.tuta-progress-loading {
    text-align: center;
    padding: 10px;
}

.tuta-progress-loading .spinner.is-active {
    float: none;
    margin: 0 5px 0 0;
    vertical-align: middle; /* Good practice for spinners */
}

.tuta-progress-bar-container {
    margin-bottom: 5px;
}

.tuta-progress-bar {
    height: 10px;
    background: #e9e9e9;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

/* .tuta-progress-fill width is set dynamically via inline style */

.tuta-credits-summary {
    text-align: center;
    font-size: 13px;
    margin-bottom: 10px;
}

.tuta-credits-summary em {
    display: block;
    /* text-align: center; Inherited */
    font-size: 12px;
    color: #555;
}

.tuta-credit-detail-text {
    text-align: center;
    font-size: 12px;
    color: #555;
    margin-top: 5px;
}

/* WhatsApp Tab Styles */
.tuta-whatsapp-loading-view {
    text-align: center;
    padding: 20px;
}

.tuta-whatsapp-loading-view .spinner.is-active {
    float: none;
    margin-right: 8px;
    vertical-align: middle;
}

#tuta-whatsapp-status-indicator-nc,
#tuta-whatsapp-status-indicator-c {
    margin-bottom: 15px; /* from inline style on -nc */
    font-weight: bold; /* from inline style */
}

#tuta-whatsapp-details-nc {
    margin-bottom: 15px; /* from inline style */
}

#tuta-whatsapp-messages {
    margin-top: 20px; /* from inline style */
}

/* Error message style (JS generated) */
.tuta-error-message {
    text-align: center;
    color: red;
    padding: 10px; /* Added padding for consistency */
}

.tuta-button-description {
    margin-top: 10px;
}

/* Styles for conversation messages within the modal specifically */
.tuta-modal .tuta-message {
    display: flex;
    margin-bottom: 12px;
    max-width: 80%; /* Bubbles don't take full width */
    word-break: break-word; /* Ensure long words break */
}

.tuta-modal .tuta-message .tuta-message-content {
    padding: 10px 15px;
    border-radius: 18px; /* Bubble shape */
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.tuta-modal .tuta-message .tuta-message-time {
    font-size: 0.75em; /* 12px if base is 16px */
    color: #6c757d; /* Subdued color for time */
    margin-top: 5px;
    padding: 0 5px; /* Give a bit of space */
}

/* Human (User) messages in modal */
.tuta-modal .tuta-message.human {
    margin-left: auto; /* Align to the right */
    flex-direction: column; /* Stack content and time */
    align-items: flex-end; /* Align items to the end (right) */
}

.tuta-modal .tuta-message.human .tuta-message-content {
    background-color: #007bff; /* Primary blue */
    color: white;
    border-bottom-right-radius: 5px; /* Slightly less rounded on one corner */
}

.tuta-modal .tuta-message.human .tuta-message-time {
    text-align: right;
}

/* AI (Assistant) messages in modal */
.tuta-modal .tuta-message.ai {
    margin-right: auto; /* Align to the left */
    flex-direction: column; /* Stack content and time */
    align-items: flex-start; /* Align items to the start (left) */
}

.tuta-modal .tuta-message.ai .tuta-message-content {
    background-color: #e9ecef; /* Light grey */
    color: #212529; /* Dark text */
    border-bottom-left-radius: 5px; /* Slightly less rounded on one corner */
}

.tuta-modal .tuta-message.ai .tuta-message-time {
    text-align: left;
}