/**
 * PAN Communications custom styling for AI Search Block
 */

/* Import additional styles for chart interactivity */
@import url('style-pan-additions.css');

/* Main container */
.ai-search-block {
    margin: 30px 0;
    width: 100%;
    box-sizing: border-box;
}

/* Chart grid layout */
.ai-search-charts {
    display: grid;
    gap: 25px;
    grid-template-columns: 1fr;
    grid-auto-columns: 1fr;
    width: 100%;
}

/* Responsive layouts */
@media (min-width: 768px) {
    .ai-search-charts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .ai-search-charts {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Chart container styling */
.ai-search-chart-container {
    border: none;
    border-radius: 15px;
    padding: 20px;
    background-color: #fff;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 250px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transform: translateZ(0);
    contain: layout style;
}

/* Hover effect */
.ai-search-chart-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(36, 53, 80, 0.15);
}

/* Chart titles */
.ai-search-chart-title {
    text-align: center;
    margin-bottom: 20px;
    font-weight: 600;
    color: #243550;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Action buttons */
.chart-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.ai-search-download-btn {
    background-color: #243550;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.ai-search-download-btn:hover {
    background: linear-gradient(90deg, #9E005D 0%, #FF9F00 100%);
    background-size: 200% 200%;
    animation: gradient-hover 2s ease infinite;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 2px 6px rgba(0, 0, 0, 0.3);
}

.ai-search-download-btn:active {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 6px 5px rgba(0, 0, 0, 0.4);
}

/* Modal styling */
.ai-search-modal {
    display: none;
    position: fixed !important;
    z-index: 999999 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    overflow: auto;
    background-color: rgba(0,0,0,0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: background-color 0.4s ease, backdrop-filter 0.4s ease;
    margin: 0 !important;
    padding: 0 !important;
}

.ai-search-modal.active {
    background-color: rgba(36, 53, 80, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.ai-search-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 30px;
    border-radius: 15px;
    width: 80%;
    max-width: 800px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    transform: scale(0.7);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                opacity 0.35s ease,
                margin 0.35s ease;
}

.ai-search-modal.active .ai-search-modal-content {
    transform: scale(1);
    opacity: 1;
    margin: 5% auto;
}

.ai-search-modal-close {
    color: #243550;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    transform-origin: center;
}

.ai-search-modal-close:hover,
.ai-search-modal-close:focus {
    color: #FF9F00;
    text-decoration: none;
    transform: rotate(90deg);
}

.ai-search-modal-chart-container {
    margin-top: 25px;
    height: 400px;
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
}

.ai-search-timeline-chart {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    opacity: 0;
    transition: opacity 0.5s ease 0.2s;
}

.ai-search-modal.active .ai-search-timeline-chart {
    opacity: 1;
}

#ai-industry-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

/* Industry filter styling */
.ai-search-industry-filter,
.ai-industry-filter {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #e7ecf5;
}

.ai-search-industry-filter label,
.ai-industry-filter label {
    margin-right: 15px;
    font-weight: 600;
    min-width: 120px;
    color: #243550;
}

.ai-search-industry-filter select,
.ai-industry-filter select {
    padding: 10px 15px;
    border: 1px solid #ADC0D7;
    border-radius: 30px;
    flex-grow: 1;
    max-width: 300px;
    background-color: white;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23243550' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 35px;
    transition: all 0.2s ease;
    font-size: 15px;
    color: #243550;
}

/* Override chart colors to match brand */
.ai-search-chart {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateZ(0);
    backface-visibility: hidden;
    contain: strict;
}

/* Modal title styling */
.ai-search-modal-content h3 {
    color: #243550;
    margin-top: 0;
    font-size: 22px;
    margin-bottom: 20px;
    padding-right: 30px;
}

/* Search terms container styling */
.ai-search-terms-container {
    background-color: #f8f8fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 3px 10px rgba(36, 53, 80, 0.1);
    border-left: 4px solid #FF9F00;
}

.ai-search-terms-container h4 {
    color: #243550;
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 16px;
}

.ai-search-terms-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-term-count {
    color: #243550;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 14px;
    border-bottom: 1px solid #e5e8ed;
    padding-bottom: 8px;
}

.search-term-filter {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e8ed;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #243550;
    background-color: white;
    transition: border-color 0.2s ease;
}

.search-term-filter:focus {
    outline: none;
    border-color: #FF9F00;
    box-shadow: 0 0 0 2px rgba(255, 159, 0, 0.2);
}

.search-terms-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
    margin-bottom: 15px;
}

.ai-search-term-tag {
    background-color: #243550;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    display: inline-block;
    transition: all 0.2s ease;
}

.ai-search-term-tag:hover {
    background: linear-gradient(90deg, #9E005D 0%, #FF9F00 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.search-terms-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e5e8ed;
    padding-top: 15px;
}

.pagination-info {
    font-size: 14px;
    color: #243550;
}

.search-terms-pagination button {
    background-color: #243550;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-terms-pagination button:disabled {
    background-color: #c8ccd2;
    cursor: not-allowed;
}

.search-terms-pagination button:not(:disabled):hover {
    background-color: #FF9F00;
}

/* Custom scrollbar for terms container */
.search-terms-grid::-webkit-scrollbar {
    width: 8px;
}

.search-terms-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.search-terms-grid::-webkit-scrollbar-thumb {
    background: #ADC0D7;
    border-radius: 4px;
}

.search-terms-grid::-webkit-scrollbar-thumb:hover {
    background: #243550;
}

/* Improve the modal title */
.ai-search-modal-title {
    margin-bottom: 20px;
    color: #243550;
    font-size: 22px;
    border-bottom: 2px solid #FF9F00;
    padding-bottom: 10px;
}

/* Search Terms Modal */
.ai-search-terms-modal {
    display: none;
    position: fixed !important;
    z-index: 999999 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    overflow: auto;
    background-color: rgba(0,0,0,0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: background-color 0.4s ease, backdrop-filter 0.4s ease;
    margin: 0 !important;
    padding: 0 !important;
}

.ai-search-terms-modal.active {
    background-color: rgba(36, 53, 80, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.ai-search-terms-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 900px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    transform: scale(0.7);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                opacity 0.35s ease,
                margin 0.35s ease;
}

.ai-search-terms-modal.active .ai-search-terms-modal-content {
    transform: scale(1);
    opacity: 1;
    margin: 5% auto;
}

.ai-search-terms-modal-close {
    color: #243550;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    transform-origin: center;
}

.ai-search-terms-modal-close:hover,
.ai-search-terms-modal-close:focus {
    color: #FF9F00;
    text-decoration: none;
    transform: rotate(90deg);
}

.ai-search-terms-modal-title {
    margin-bottom: 20px;
    color: #243550;
    font-size: 22px;
    border-bottom: 2px solid #FF9F00;
    padding-bottom: 10px;
}

/* True/False columns layout */
.ai-search-terms-columns {
    display: flex;
    gap: 25px;
    width: 100%;
}

.ai-search-terms-column {
    flex: 1;
    border-radius: 12px;
    padding: 20px;
    background-color: #f8f8fa;
    box-shadow: 0 3px 10px rgba(36, 53, 80, 0.1);
}

.ai-search-terms-column h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e8ed;
}

.true-terms {
    border-left: 4px solid #FF9F00; /* PAN Orange for True */
}

.true-terms h4 {
    color: #FF9F00;
}

.false-terms {
    border-left: 4px solid #243550; /* PAN Navy for False */
}

.false-terms h4 {
    color: #243550;
}

/* Terms lists */
.terms-count {
    font-weight: 600;
    font-size: 14px;
    color: #5a6a7e;
    margin-bottom: 10px;
}

.terms-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
}

.terms-list li {
    padding: 8px 12px;
    margin-bottom: 6px;
    background-color: white;
    border-radius: 6px;
    font-size: 14px;
    color: #243550;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.true-terms .terms-list li:hover {
    background-color: rgba(255, 159, 0, 0.1);
    border-left: 3px solid #FF9F00;
    padding-left: 15px;
}

.false-terms .terms-list li:hover {
    background-color: rgba(36, 53, 80, 0.1);
    border-left: 3px solid #243550;
    padding-left: 15px;
}

.empty-terms-message {
    color: #8e9bab;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* Custom scrollbar for terms lists */
.terms-list::-webkit-scrollbar {
    width: 6px;
}

.terms-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.terms-list::-webkit-scrollbar-thumb {
    background: #c8ccd2;
    border-radius: 3px;
}

.true-terms .terms-list::-webkit-scrollbar-thumb:hover {
    background: #FF9F00;
}

.false-terms .terms-list::-webkit-scrollbar-thumb:hover {
    background: #243550;
}

/* Responsive layout */
@media (max-width: 768px) {
    .ai-search-terms-columns {
        flex-direction: column;
    }
    
    .ai-search-terms-column {
        margin-bottom: 20px;
    }
    
    .terms-list {
        max-height: 200px;
    }
}

/* Make chart legend items appear clickable */
.ai-search-chart-container canvas {
    cursor: pointer;
}

/* Disable pointer events for charts with insufficient data */
.ai-search-chart-container.ai-search-chart-disabled {
    pointer-events: none;
    opacity: 0.7;
}

.ai-search-chart-container.ai-search-chart-disabled canvas {
    cursor: not-allowed;
}

.ai-search-chart-container.ai-search-chart-disabled .chart-wrapper {
    pointer-events: none;
}

/* Instructions styling */
.ai-search-chart-container .chart-instructions {
    font-size: 12px;
    color: #000000;
    text-align: center;
    margin-top: 5px;
    font-style: italic;
}

/* Legend toggle styling */
.ai-search-chart-container .chartjs-legend {
    display: flex !important;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.ai-search-chart-container .chartjs-legend ul {
    display: flex !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 15px;
}

.ai-search-chart-container .chartjs-legend li {
    display: flex !important;
    align-items: center;
    padding: 6px 12px !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border: 2px solid transparent !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.ai-search-chart-container .chartjs-legend li:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
    border-color: #FF9F00 !important;
}

.ai-search-chart-container .chartjs-legend li.hidden {
    opacity: 0.5 !important;
    background: rgba(224, 224, 224, 0.5) !important;
}

.ai-search-chart-container .chartjs-legend li span {
    margin-left: 8px !important;
}
