/**
 * Frontend Styles for Premium Prompts Library
 */

/* Universal Box Sizing Fix */
.ppl-library-container,
.ppl-library-container *,
.ppl-library-container *::before,
.ppl-library-container *::after,
.ppl-tenant-admin-page,
.ppl-tenant-admin-page *,
.ppl-tenant-admin-page *::before,
.ppl-tenant-admin-page *::after {
    box-sizing: border-box !important;
}

/* Prevent horizontal overflow on main wrappers */
body.wp-admin .ppl-tenant-admin-page,
.ppl-tenant-admin-page,
.ppl-tenant-admin-content,
.ppl-library-container {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Ensure HTML and body don't cause horizontal scroll */
body.wp-admin {
    overflow-x: hidden !important;
}

/* Virtual Page Styles */
.ppl-virtual-page {
    width: 100%;
    max-width: 100%;
}

.ppl-virtual-page .site-main {
    width: 100%;
}

/* Navigation Menu Item Styles */
.menu-item-prompts-library {
    position: relative;
}

.ppl-menu-link {
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.ppl-menu-icon {
    font-size: 18px;
    line-height: 1;
}

.menu-item-prompts-library .ppl-menu-link:hover {
    color: #f65c4b !important;
}

/* Main Container */
.ppl-library-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden !important;
    box-sizing: border-box;
}

/* Ensure all direct children respect boundaries */
.ppl-library-container > * {
    box-sizing: border-box;
    max-width: 100%;
}

/* Header Section */
.ppl-library-header {
    width: 100%;
    max-width: 100%;
    padding: 60px 40px;
    text-align: center;
    color: #fff;
    overflow-x: hidden !important;
    box-sizing: border-box;
}

.ppl-header-content {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding: 0 20px;
}

.ppl-header-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
}

.ppl-header-logo img {
    max-width: 200px;
    height: auto;
    display: block;
}

.ppl-header-title {
    font-size: 48px;
    font-weight: 700;
    margin: 0 0 15px 0;
    line-height: 1.2;
    color: #ffffff !important;
}

.ppl-header-subtitle {
    font-size: 20px;
    margin: 0 0 40px 0;
    opacity: 0.95;
    font-weight: 400;
    color: #ffffff !important;
}

/* Chatbot Container */
.ppl-chatbot-container {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

/* Chatbot with Discussion History */
.ppl-chatbot-wrapper {
    display: flex;
    flex-direction: row;
    gap: 20px;
    min-height: 500px;
    align-items: flex-start;
}

.ppl-discussions-sidebar {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    max-height: 600px;
    border: 1px solid #e1e4e8;
}

.ppl-chatbot-main {
    flex: 1;
    min-width: 0;
    background: transparent;
}

/* Mobile: Stack vertically */
@media (max-width: 768px) {
    .ppl-chatbot-wrapper {
        flex-direction: column;
    }
    
    .ppl-discussions-sidebar {
        width: 100%;
        min-width: 100%;
        border-radius: 8px;
        max-height: 200px;
    }
    
    .ppl-chatbot-main {
        width: 100%;
        border-radius: 8px;
    }
}

/* Force proper layout for AI Engine discussions */
.ppl-discussions-sidebar .mwai-discussions {
    width: 100% !important;
}

.ppl-chatbot-wrapper > * {
    box-sizing: border-box;
}

/* Chatbot Text Readability Improvements - TEXT CONTENT ONLY */
/* Only target actual text elements, never containers with buttons */

/* Paragraphs */
.ppl-chatbot-main [class*="mwai"] p {
    text-align: left !important;
    line-height: 1.7 !important;
    margin-bottom: 1em !important;
}

.ppl-chatbot-main [class*="mwai"] p:last-child {
    margin-bottom: 0 !important;
}

/* Lists - improved spacing and hierarchy */
.ppl-chatbot-main [class*="mwai"] ul,
.ppl-chatbot-main [class*="mwai"] ol {
    text-align: left !important;
    padding-left: 25px !important;
    margin: 1em 0 !important;
}

.ppl-chatbot-main [class*="mwai"] ul li,
.ppl-chatbot-main [class*="mwai"] ol li {
    margin-bottom: 0.75em !important;
    line-height: 1.7 !important;
    text-align: left !important;
}

.ppl-chatbot-main [class*="mwai"] ul li:last-child,
.ppl-chatbot-main [class*="mwai"] ol li:last-child {
    margin-bottom: 0 !important;
}

/* Visual hierarchy for nested lists */
.ppl-chatbot-main [class*="mwai"] ul {
    list-style-type: disc !important;
}

.ppl-chatbot-main [class*="mwai"] ul ul {
    list-style-type: circle !important;
    margin: 0.5em 0 0.5em 0 !important;
    padding-left: 20px !important;
}

.ppl-chatbot-main [class*="mwai"] ul ul ul {
    list-style-type: square !important;
}

/* Headers */
.ppl-chatbot-main [class*="mwai"] h1,
.ppl-chatbot-main [class*="mwai"] h2,
.ppl-chatbot-main [class*="mwai"] h3,
.ppl-chatbot-main [class*="mwai"] h4,
.ppl-chatbot-main [class*="mwai"] h5,
.ppl-chatbot-main [class*="mwai"] h6 {
    text-align: left !important;
    margin-top: 1.25em !important;
    margin-bottom: 0.75em !important;
    line-height: 1.4 !important;
}

.ppl-chatbot-main [class*="mwai"] h1:first-child,
.ppl-chatbot-main [class*="mwai"] h2:first-child,
.ppl-chatbot-main [class*="mwai"] h3:first-child,
.ppl-chatbot-main [class*="mwai"] h4:first-child,
.ppl-chatbot-main [class*="mwai"] h5:first-child,
.ppl-chatbot-main [class*="mwai"] h6:first-child {
    margin-top: 0 !important;
}

/* Code blocks */
.ppl-chatbot-main [class*="mwai"] pre,
.ppl-chatbot-main [class*="mwai"] code {
    text-align: left !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
}

/* Blockquotes */
.ppl-chatbot-main [class*="mwai"] blockquote {
    text-align: left !important;
    margin: 1em 0 !important;
    padding-left: 1em !important;
    border-left: 3px solid #e1e4e8 !important;
}

/* Text content - not the whole reply container */
.ppl-chatbot-main .mwai-text {
    text-align: left !important;
}

/* Links - but not button links */
.ppl-chatbot-main [class*="mwai"] a:not([class*="button"]):not([class*="icon"]):not([role="button"]) {
    color: #f65c4b !important;
    text-decoration: underline !important;
}

.ppl-chatbot-main [class*="mwai"] a:not([class*="button"]):not([class*="icon"]):not([role="button"]):hover {
    color: #d84a3a !important;
}

/* Strong/bold and emphasis */
.ppl-chatbot-main [class*="mwai"] strong,
.ppl-chatbot-main [class*="mwai"] b {
    font-weight: 600 !important;
}

.ppl-chatbot-main [class*="mwai"] em,
.ppl-chatbot-main [class*="mwai"] i {
    font-style: italic !important;
}

/* Horizontal rules */
.ppl-chatbot-main [class*="mwai"] hr {
    margin: 1.5em 0 !important;
    border: none !important;
    border-top: 1px solid #e1e4e8 !important;
}

/* Tables */
.ppl-chatbot-main [class*="mwai"] table {
    text-align: left !important;
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 1em 0 !important;
}

.ppl-chatbot-main [class*="mwai"] table th,
.ppl-chatbot-main [class*="mwai"] table td {
    text-align: left !important;
    padding: 0.75em !important;
    border: 1px solid #e1e4e8 !important;
}

.ppl-chatbot-main [class*="mwai"] table th {
    background-color: #f8f9fa !important;
    font-weight: 600 !important;
}

/* Filters Section */
.ppl-filters-section {
    background: #f8f9fa;
    padding: 30px 40px;
    border-bottom: 1px solid #e1e4e8;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
    box-sizing: border-box;
}

.ppl-filters-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding: 0 20px;
}

/* Search Bar */
.ppl-search-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.ppl-search-input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    font-size: 16px;
    border: 2px solid #e1e4e8;
    border-radius: 8px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.ppl-search-input:focus {
    outline: none;
    border-color: #f65c4b;
    box-shadow: 0 0 0 3px rgba(246, 92, 75, 0.1);
}

.ppl-search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    pointer-events: none;
}

/* Category Filters */
.ppl-category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.ppl-category-badge {
    padding: 8px 18px;
    border: none;
    border-radius: 20px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.ppl-category-badge:hover,
.ppl-category-badge.active {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Tag Filters */
.ppl-tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.ppl-tag-chip {
    padding: 6px 16px;
    border: 2px solid #e1e4e8;
    border-radius: 16px;
    background: #fff;
    color: #586069;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ppl-tag-chip:hover,
.ppl-tag-chip.active {
    border-color: #f65c4b;
    color: #f65c4b;
    background: #fff5f4;
}

/* Clear Filters */
.ppl-clear-filters {
    padding: 8px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    transition: opacity 0.3s ease;
}

.ppl-clear-filters:hover {
    opacity: 0.7;
}

/* Prompts Section */
.ppl-prompts-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 40px 60px;
    width: 100%;
    overflow-x: hidden !important;
    box-sizing: border-box;
}

/* Prompts Grid */
.ppl-prompts-grid {
    display: grid;
    gap: 30px;
    margin-bottom: 40px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
}

.ppl-grid-cols-1 {
    grid-template-columns: 1fr;
}

.ppl-grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.ppl-grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.ppl-grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Prompt Card */
.ppl-prompt-card {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.ppl-prompt-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.ppl-card-category {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 6px 14px;
    border-radius: 16px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.ppl-card-title {
    font-size: 20px;
    font-weight: 700;
    margin: 35px 0 12px 0;
    color: #0D0D2B;
    line-height: 1.3;
}

.ppl-card-description {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ppl-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.ppl-card-tag {
    padding: 4px 10px;
    background: #f1f3f5;
    border-radius: 12px;
    font-size: 11px;
    color: #586069;
    font-weight: 500;
}

/* Hide tags that are empty or just numbers (likely IDs shown by mistake) */
.ppl-card-tag:empty,
.ppl-tag-chip:empty {
    display: none !important;
}

/* Additional safeguard: hide tags/chips that look like pure numbers */
.ppl-card-tag[data-numeric="true"],
.ppl-tag-chip[data-numeric="true"] {
    display: none !important;
}

.ppl-card-actions {
    display: flex;
    gap: 10px;
}

/* Copy button styling */
.ppl-copy-card {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e1e4e8;
    border-radius: 8px;
    background: #fff;
    color: #0D0D2B;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ppl-copy-card:hover {
    border-color: #0D0D2B;
    background: #f8f9fa;
    transform: translateY(-2px);
}

/* Favorite heart icon */
.ppl-favorite-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ppl-favorite-icon:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ppl-favorite-icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: #666;
    stroke-width: 2;
    transition: all 0.3s ease;
}

.ppl-favorite-icon.favorited svg {
    fill: #ff6b6b;
    stroke: #ff6b6b;
}

.ppl-favorite-icon:hover svg {
    stroke: #ff6b6b;
}

.ppl-button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.ppl-button-primary {
    background: #f65c4b;
    color: #fff;
}

.ppl-button-primary:hover {
    background: #e54a39;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(246, 92, 75, 0.3);
}

.ppl-button-secondary {
    background: #fff;
    color: #0D0D2B;
    border: 2px solid #e1e4e8;
}

.ppl-button-secondary:hover {
    border-color: #0D0D2B;
    background: #f8f9fa;
}

/* Pagination */
.ppl-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.ppl-pagination button {
    padding: 10px 16px;
    border: 2px solid #e1e4e8;
    border-radius: 8px;
    background: #fff;
    color: #0D0D2B;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ppl-pagination button:hover:not(:disabled) {
    border-color: #f65c4b;
    color: #f65c4b;
}

.ppl-pagination button.active {
    background: #f65c4b;
    color: #fff;
    border-color: #f65c4b;
}

.ppl-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Modal */
.ppl-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}

.ppl-modal.active {
    display: flex;
}

.ppl-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.ppl-modal-content {
    position: relative;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

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

.ppl-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    background: #f1f3f5;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1;
}

.ppl-modal-close:hover {
    background: #e1e4e8;
    transform: rotate(90deg);
}

.ppl-modal-header {
    padding: 30px 70px 20px 30px; /* Extra padding on right for close button */
    border-bottom: 1px solid #e1e4e8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.ppl-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: #0D0D2B;
    margin: 0;
    flex: 1;
    padding-right: 15px; /* Extra spacing */
}

.ppl-modal-category-badge {
    padding: 6px 14px;
    border-radius: 16px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0; /* Prevent shrinking */
}

.ppl-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.ppl-modal-description {
    background: #E8F4FD;
    border-left: 4px solid #3498db;
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 25px;
    font-size: 15px;
    line-height: 1.6;
    color: #0D0D2B;
}

.ppl-modal-description p {
    margin: 0;
}

.ppl-modal-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #586069;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ppl-modal-prompt-text {
    background: #F5F7FA;
    padding: 25px;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.8;
    color: #0D0D2B;
}

/* Improved formatting for prompt text */
.ppl-modal-prompt-text p {
    margin: 0 0 15px 0;
}

.ppl-modal-prompt-text p:last-child {
    margin-bottom: 0;
}

.ppl-modal-prompt-text ul,
.ppl-modal-prompt-text ol {
    margin: 15px 0;
    padding-left: 30px;
}

.ppl-modal-prompt-text li {
    margin-bottom: 12px;
    line-height: 1.7;
    padding-left: 8px;
}

/* Better indentation for nested items */
.ppl-modal-prompt-text li li {
    margin-top: 8px;
    padding-left: 15px;
}

.ppl-modal-prompt-text strong {
    font-weight: 600;
    color: #0D0D2B;
}

.ppl-modal-prompt-text em {
    font-style: italic;
}

/* Highlight placeholders in square brackets */
.ppl-modal-prompt-text .ppl-placeholder,
.ppl-placeholder {
    background: #FFF4E6;
    border: 1px solid #FFB84D;
    color: #CC6600;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', Consolas, monospace;
    font-size: 14px;
    font-weight: 500;
    white-space: normal; /* Changed from nowrap to allow wrapping */
    word-wrap: break-word; /* Break long words if needed */
    display: inline; /* Keep inline but allow wrapping */
    line-height: 1.6;
}

/* Better spacing for brackets/placeholders */
.ppl-modal-prompt-text code,
.ppl-modal-prompt-text [class*="bracket"] {
    background: #e1e4e8;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.ppl-modal-footer {
    padding: 20px 30px 30px;
    display: flex;
    gap: 15px;
    border-top: 1px solid #e1e4e8;
}

.ppl-modal-footer .ppl-button {
    flex: 1;
}

/* Fields Modal Specific Styles */
.ppl-fields-modal-content {
    max-width: 600px;
}

.ppl-modal-subtitle {
    font-size: 14px;
    color: #666;
    margin: 5px 0 0 0;
    font-weight: 400;
}

.ppl-form-field {
    margin-bottom: 20px;
}

.ppl-form-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #0D0D2B;
    margin-bottom: 8px;
}

.ppl-form-field input[type="text"],
.ppl-form-field textarea,
.ppl-form-field select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e4e8;
    border-radius: 8px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.ppl-form-field input[type="text"]:focus,
.ppl-form-field textarea:focus,
.ppl-form-field select:focus {
    outline: none;
    border-color: #0D0D2B;
    box-shadow: 0 0 0 3px rgba(13, 13, 43, 0.1);
}

.ppl-form-field textarea {
    resize: vertical;
    min-height: 100px;
}

.ppl-required-note {
    font-size: 13px;
    color: #666;
    margin: 15px 0 0 0;
    font-style: italic;
}

/* Preview Modal Styles */
.ppl-preview-text {
    background: #F5F7FA;
    padding: 25px;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.8;
    color: #0D0D2B;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 50vh;
    overflow-y: auto;
}

/* Loading State */
.ppl-loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
}

.ppl-loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Empty State */
.ppl-empty-state {
    text-align: center;
    padding: 80px 20px;
}

.ppl-empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.ppl-empty-state-text {
    font-size: 18px;
    color: #666;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .ppl-grid-cols-4 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Ensure no overflow on tablets */
    .ppl-library-container,
    .ppl-library-container > *,
    .ppl-tenant-admin-page,
    .ppl-tenant-admin-content {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }
}

@media (max-width: 768px) {
    .ppl-header-title {
        font-size: 32px;
    }
    
    .ppl-header-subtitle {
        font-size: 16px;
    }
    
    .ppl-header-logo {
        margin-bottom: 20px;
    }
    
    .ppl-header-logo img {
        max-width: 150px;
    }
    
    .ppl-library-header,
    .ppl-filters-section,
    .ppl-prompts-section {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .ppl-grid-cols-3,
    .ppl-grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ppl-prompts-grid {
        gap: 20px;
    }
    
    /* Mobile text readability */
    .ppl-chatbot-main [class*="mwai"] ul,
    .ppl-chatbot-main [class*="mwai"] ol {
        padding-left: 20px !important;
    }
    
    .ppl-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .ppl-modal-header,
    .ppl-modal-body,
    .ppl-modal-footer {
        padding: 20px;
    }
    
    /* Prevent overflow on mobile */
    .ppl-library-container,
    .ppl-library-container > *,
    .ppl-tenant-admin-page,
    .ppl-tenant-admin-content,
    .ppl-library-header,
    .ppl-filters-section,
    .ppl-prompts-section {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }
}

@media (max-width: 480px) {
    .ppl-header-title {
        font-size: 24px;
    }
    
    .ppl-header-logo img {
        max-width: 120px;
    }
    
    .ppl-grid-cols-2,
    .ppl-grid-cols-3,
    .ppl-grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    .ppl-card-actions {
        flex-direction: column;
    }
    
    .ppl-modal-footer {
        flex-direction: column;
    }
}

/* Pulse animation for Send button */
@keyframes ppl-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
        transform: scale(1);
    }
}

.ppl-pulse-button {
    animation: ppl-pulse 1.5s infinite !important;
    position: relative !important;
    z-index: 9999 !important;
}

/* ============================================
   AI SUGGESTIONS FEATURE (Frontend)
   ============================================ */

/* AI Suggestion Button in Form Fields */
.ppl-ai-suggest-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 8px 16px;
    background: #fff;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.ppl-ai-suggest-btn:hover {
    background: #667eea;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ppl-ai-suggest-btn:active {
    transform: translateY(0);
}

.ppl-ai-suggest-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ppl-ai-icon {
    font-size: 16px;
    line-height: 1;
}

.ppl-ai-loading {
    display: inline-block;
    animation: ppl-ai-spin 1s infinite linear;
}

@keyframes ppl-ai-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(359deg); }
}

/* AI Suggestions Modal */
.ppl-ai-suggestions-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ppl-ai-suggestions-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
    animation: ppl-ai-fade-in 0.2s ease-out;
}

.ppl-ai-suggestions-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: ppl-ai-slide-up 0.3s ease-out;
}

@keyframes ppl-ai-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ppl-ai-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* AI Modal Header */
.ppl-ai-suggestions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #ddd;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.ppl-ai-suggestions-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.ppl-ai-close-modal {
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 4px;
}

.ppl-ai-close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* AI Modal Body */
.ppl-ai-suggestions-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.ppl-ai-suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    margin-bottom: 12px;
    background: #f9f9f9;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    transition: all 0.2s;
}

.ppl-ai-suggestion-item:hover {
    background: #f0f6fc;
    border-color: #667eea;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.ppl-ai-suggestion-text {
    flex: 1;
    line-height: 1.6;
    color: #333;
    font-size: 14px;
}

.ppl-ai-suggestion-item .ppl-use-suggestion {
    flex-shrink: 0;
    white-space: nowrap;
    background: #667eea;
    border-color: #667eea;
    color: white;
    font-weight: 500;
    padding: 8px 16px;
    transition: all 0.2s;
}

.ppl-ai-suggestion-item .ppl-use-suggestion:hover {
    background: #5568d3;
    border-color: #5568d3;
    transform: scale(1.05);
}

.ppl-ai-suggestion-item .ppl-use-suggestion:active {
    transform: scale(0.98);
}

/* AI Modal Footer */
.ppl-ai-suggestions-footer {
    padding: 16px 24px;
    border-top: 1px solid #ddd;
    text-align: right;
    background: #f9f9f9;
    border-radius: 0 0 12px 12px;
}

.ppl-ai-suggestions-footer .ppl-ai-close-modal {
    color: #666;
    background: white;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    width: auto;
    height: auto;
}

.ppl-ai-suggestions-footer .ppl-ai-close-modal:hover {
    background: #f5f5f5;
    border-color: #999;
    color: #333;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ppl-ai-suggestions-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .ppl-ai-suggestion-item {
        flex-direction: column;
        gap: 12px;
    }
    
    .ppl-ai-suggestion-item .ppl-use-suggestion {
        width: 100%;
    }
    
    .ppl-ai-suggest-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ========================================
   AI SUGGESTIONS V2.0 STYLES
   ======================================== */

/* AI Suggestion Button - Base */
.ppl-ai-suggest-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-top: 10px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.ppl-ai-suggest-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.ppl-ai-suggest-btn:disabled {
    background: linear-gradient(135deg, #e0e0e0 0%, #bdbdbd 100%);
    color: #9e9e9e;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

.ppl-ai-suggest-btn .ppl-ai-icon {
    font-size: 18px;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

.ppl-ai-suggest-btn:disabled .ppl-ai-icon {
    animation: none;
    opacity: 0.5;
}

/* Tooltip for Disabled Buttons */
.ppl-ai-suggest-btn:disabled {
    position: relative;
}

.ppl-field-help {
    display: block;
    margin-top: 5px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* Loading Spinner */
.spinner-border {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

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