/**
 * WP Risk Plugin Styles
 */
 
#wp-risk-data {
    margin: 20px 0;
    padding: 0;
    background-color: transparent;
    border: none;
    box-shadow: none;
}

#wp-risk-data * {
    box-sizing: border-box;
}


.risk-search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.risk-search-input {
    flex: 1;
    min-width: 250px;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.risk-search-button, .risk-reset-button, .risk-debug-button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.risk-search-button {
    background-color: #E4572E;
    color: white;
}

.risk-search-button:hover {
    background-color: #C03F1E;
}

.risk-search-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.search-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: search-spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

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


.risk-debug-button {
    background-color: #9e9e9e;
    color: white;
    margin-left: 10px;
}

.risk-debug-button:hover {
    background-color: #757575;
}

/* View Details Link */
.risk-view-details {
    display: inline-block;
    color: #E4572E;
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
}

.risk-view-details:hover {
    text-decoration: underline;
    color: #C03F1E;
}

/* Modal for document details */
#risk-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    overflow-y: auto;
    animation: fadeInModal 0.3s ease;
    opacity: 1; /* Force opacity */
}

#risk-modal.visible {
    display: block !important; /* Force display when visible class is applied */
    opacity: 1 !important;
}

.risk-modal-content {
    background-color: white;
    margin: 50px auto;
    width: 90%;
    max-width: 800px;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease-out;
    transform-origin: center top;
    will-change: transform, opacity;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modal content transition */
.risk-modal-content {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#risk-modal:not(.visible) .risk-modal-content {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
}

.risk-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.risk-modal-header h2 {
    margin: 0 !important;
    color: #333 !important;
    font-size: 20px !important;
    padding: 0 !important;
    border: none !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    line-height: 1.4 !important;
}

.risk-modal-close {
    position: absolute;
    right: 20px;
    top: 15px;
    color: #777;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    width: 30px;
    height: 30px;
    line-height: 28px;
    text-align: center;
    transition: color 0.2s ease;
    border-radius: 50%;
}

.risk-modal-close:hover {
    color: #333;
    background-color: rgba(0,0,0,0.05);
}

.risk-modal-close:focus {
    outline: 2px solid #E4572E;
    outline-offset: 2px;
}

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

.risk-modal-body h3 {
    margin-top: 15px;
    margin-bottom: 5px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Company Details */
.risk-company-details {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.risk-company-details p {
    margin: 5px 0;
    line-height: 1.4;
}

.risk-company-details .risk-field-label {
    font-weight: 600;
    color: #555;
    display: inline-block;
    min-width: 120px;
}

/* Announcement text */
.risk-announcement-container {
    background-color: #ffffff;
    padding: 15px 5px;
    margin-top: 15px;
    max-height: 300px;
    overflow-y: auto;
    border-top: 1px solid #eee;
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
    position: relative;
}

/* Add bottom fade effect to indicate scrollable content */
.risk-announcement-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(to top, rgba(255,255,255,1), rgba(255,255,255,0));
    pointer-events: none;
    z-index: 1;
    opacity: 0.8;
}

/* Scrollbar styling for WebKit (Chrome, Safari, etc.) */
.risk-announcement-container::-webkit-scrollbar {
    width: 8px;
}

.risk-announcement-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.risk-announcement-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.risk-announcement-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* AI Summary styling */
.risk-summary-container {
    background-color: #f8f9fa;
    border-left: 3px solid #E4572E;
    padding: 12px 16px;
    margin-top: 8px;
    border-radius: 0 4px 4px 0;
}

.risk-summary-container p {
    margin: 0;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

#risk-modal-summary-container h3 {
    margin: 15px 0 0 0;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    color: #333;
}

/* Announcement styling */
#risk-modal-announcement {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: #333;
    padding: 0 10px;
}

/* Modal animation */
@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Enhanced transition for modal opening/closing */
#risk-modal {
    transition: opacity 0.3s ease;
}

#risk-modal:not(.visible) {
    opacity: 0;
}

/* Maintain backward compatibility with overlay styles */
.risk-overlay {
    display: none;
}

.risk-details-content {
    padding: 20px;
}

.risk-details-table {
    width: 100%;
    border-collapse: collapse;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.risk-details-table th, 
.risk-details-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
    vertical-align: top;
}

.risk-details-table th {
    width: 30%;
    font-weight: 600;
    color: #555;
}

.risk-details-table tr:last-child th,
.risk-details-table tr:last-child td {
    border-bottom: none;
}

.risk-details-table tr:hover {
    background-color: #f9fbfe;
}

#risk-loading-status {
    margin: 10px 0;
    min-height: 30px;
}

.loading-notice {
    margin-bottom: 10px;
}

.risk-search-info {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.notice {
    background-color: #e8f4fd;
    color: #0c5460;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #bee5eb;
}

.loading {
    background-color: #fff9e6;
    color: #856404;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #ffeeba;
}

.success {
    background-color: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
}

.results-count {
    margin-bottom: 15px;
    font-size: 14px;
    color: #444;
}

.highlight {
    background-color: #fff3cd;
    padding: 2px 0;
    border-radius: 2px;
    font-weight: 500;
}

.debug-panel {
    background-color: #f8f9fa;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 20px 0;
}

.debug-panel h3 {
    margin-top: 0;
    color: #444;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.debug-panel h4 {
    margin-top: 20px;
    color: #555;
}

.debug-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 14px;
}

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

.debug-table th {
    background-color: #f0f0f0;
}

.debug-info {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 4px;
    margin-top: 20px;
    font-size: 14px;
}

.debug-info pre {
    background-color: #eee;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
}

.matched-field {
    background-color: #f9f9e8;
}

.search-field {
    background-color: #e8f1ff;
}

.test-search {
    background-color: #f5f5f5;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

/* Card Layout Styles */
.risk-cards-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.risk-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.risk-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
    border-color: #E4572E;
}

.risk-card-matched {
    border-color: #E4572E;
    border-width: 2px;
    box-shadow: 0 2px 12px rgba(228, 87, 46, 0.15);
}

.risk-card-matched:hover {
    box-shadow: 0 4px 20px rgba(228, 87, 46, 0.25);
}

.risk-card-content {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.risk-card-main {
    flex: 1;
}

.risk-card-company {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.risk-card-details {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.risk-card-separator {
    margin: 0 8px;
    color: #999;
}

.risk-card-value-matched {
    background-color: #fff3cd;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    color: #333;
}

.risk-card-action {
    flex-shrink: 0;
}

.risk-card-button {
    padding: 10px 20px;
    background-color: #E4572E;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.2s;
}

.risk-card-button:hover {
    background-color: #C03F1E;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(228, 87, 46, 0.3);
    color: white;
    text-decoration: none;
}


/* Legacy table styles - kept for backward compatibility */
.risk-data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.risk-data-table th, 
.risk-data-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

.risk-data-table th {
    background-color: #f8f8f8;
    font-weight: 600;
    color: #333;
}

.risk-data-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.risk-data-table tr:hover {
    background-color: #f1f7fd;
}

/* Responsive table styles */
.risk-data-table-wrapper {
    overflow-x: auto;
    margin-bottom: 20px;
}

@media screen and (max-width: 768px) {
    .risk-search-container {
        flex-direction: column;
    }
    
    .risk-search-input {
        width: 100%;
    }
    
    /* Card responsive styles */
    .risk-card {
        border-radius: 10px;
    }
    
    .risk-card-content {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
    }
    
    .risk-card-company {
        font-size: 16px;
        margin-bottom: 4px;
    }
    
    .risk-card-details {
        font-size: 13px;
    }
    
    .risk-card-separator {
        margin: 0 6px;
    }
    
    .risk-card-button {
        width: 100%;
        text-align: center;
    }
    
    .risk-card-action {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
    
    .risk-card-button {
        min-width: 100px;
    }
    
    
    .risk-data-table th,
    .risk-data-table td {
        padding: 8px;
        font-size: 14px;
    }
    
    .risk-modal-content {
        width: 95%;
        margin: 30px auto;
        max-height: 85vh;
    }
    
    .risk-modal-body {
        max-height: 70vh;
    }
    
    .risk-announcement-container {
        max-height: 200px;
    }
    
    .risk-field-label {
        min-width: 100px;
    }
}

.error {
    color: #721c24;
    padding: 15px;
    border: 1px solid #f5c6cb;
    background-color: #f8d7da;
    border-radius: 4px;
    margin: 20px 0;
}

#risk-data-container {
    position: relative;
    min-height: 100px;
}



/* Watchlist Styles */
#wpRiskWatchlistContainer {
    margin: 20px 0;
    padding: 15px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#wpRiskWatchlistForm {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#wpRiskWatchlistForm .form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 200px;
}

#wpRiskWatchlistForm label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

#wpRiskWatchlistForm input[type="text"] {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.2s;
}

#wpRiskWatchlistForm input[type="text"]:focus {
    outline: none;
    border-color: #E4572E;
    box-shadow: 0 0 0 2px rgba(228, 87, 46, 0.15);
}

#wpRiskWatchlistForm button[type="submit"] {
    padding: 10px 30px;
    background-color: #E4572E;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

#wpRiskWatchlistForm button[type="submit"]:hover {
    background-color: #C03F1E;
}

#wpRiskWatchlistTable {
    margin-top: 20px;
}

#wpRiskWatchlistTable table {
    width: 100%;
    border-collapse: collapse;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

#wpRiskWatchlistTable th,
#wpRiskWatchlistTable td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

#wpRiskWatchlistTable th {
    background-color: #f8f8f8;
    font-weight: 600;
    color: #333;
}

#wpRiskWatchlistTable tr:nth-child(even) {
    background-color: #f9f9f9;
}

#wpRiskWatchlistTable tr:hover {
    background-color: #f1f7fd;
}

.wp-risk-watchlist-delete {
    color: #d9534f;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}

.wp-risk-watchlist-delete:hover {
    text-decoration: underline;
    color: #c9302c;
}

#wpRiskWatchlistSpinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,.1);
    border-radius: 50%;
    border-top-color: #333;
    animation: spin-watchlist 1s ease-in-out infinite;
}

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

.wp-risk-watchlist-message {
    padding: 12px 15px;
    margin: 15px 0;
    border-radius: 4px;
    font-size: 14px;
}

.wp-risk-watchlist-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.wp-risk-watchlist-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.optional-hint {
    font-size: 0.8em;
    color: #666;
    font-weight: normal;
}

/* Responsive styles for watchlist */
@media screen and (max-width: 768px) {
    #wpRiskWatchlistForm {
        flex-direction: column;
    }
    
    #wpRiskWatchlistForm .form-group {
        width: 100%;
    }
    
    #wpRiskWatchlistForm button[type="submit"] {
        width: 100%;
    }
    
    #wpRiskWatchlistTable th,
    #wpRiskWatchlistTable td {
        padding: 8px;
        font-size: 14px;
    }
}

/* Watchlist Assistant Styles */
#wpRiskWatchlistAssistantContainer {
    margin: 20px 0;
    padding: 15px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#wpRiskWatchlistAssistantForm {
    margin-bottom: 20px;
}

#wpRiskWatchlistAssistantTable {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

#wpRiskWatchlistAssistantTable th, 
#wpRiskWatchlistAssistantTable td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
}

#wpRiskWatchlistAssistantTable th {
    background-color: #f8f8f8;
    font-weight: 600;
    color: #333;
}

#wpRiskWatchlistAssistantTable th:nth-child(2) {
    text-align: center;
}

#wpRiskWatchlistAssistantTable input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#wpRiskWatchlistAssistantTable td.checkbox-cell {
    cursor: pointer;
    text-align: center;
}

#wpRiskWatchlistAssistantTable tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

#wpRiskWatchlistAssistantTable tbody tr:hover td {
    background-color: #f1f7fd;
    transition: background-color 0.2s ease;
}

#wpRiskWatchlistAssistantSpinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,.1);
    border-radius: 50%;
    border-top-color: #333;
    animation: spin-watchlist-assistant 1s ease-in-out infinite;
}

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

.wp-risk-watchlist-assistant-message {
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
}

.wp-risk-watchlist-assistant-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

#wpRiskWatchlistAssistantSubmit {
    padding: 12px 30px;
    background-color: #E4572E;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

#wpRiskWatchlistAssistantSubmit:hover {
    background-color: #C03F1E;
}

#wpRiskWatchlistAssistantSubmit:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Responsive styles for watchlist assistant */
@media screen and (max-width: 768px) {
    #wpRiskWatchlistAssistantContainer {
        padding: 10px;
    }
    
    #wpRiskWatchlistAssistantTable th,
    #wpRiskWatchlistAssistantTable td {
        padding: 8px;
        font-size: 14px;
    }
    
    #wpRiskWatchlistAssistantSubmit {
        width: 100%;
        padding: 15px;
        font-size: 16px;
    }
}

/* Liquidations Wizard Styles */
#wpRiskLiquidationsWizard {
    margin: 20px 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
}

#wp-risk-publication-dropdown {
    padding: 10px;
    font-size: 16px;
    margin-bottom: 24px;
    width: 100%;
    max-width: 400px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border-color 0.2s;
}

#wp-risk-publication-dropdown:focus {
    outline: none;
    border-color: #E4572E;
    box-shadow: 0 0 0 2px rgba(228, 87, 46, 0.15);
}

#wp-risk-liq-display-btn,
#wp-risk-liq-excel-btn {
    padding: 10px 20px;
    margin-right: 8px;
    background-color: #E4572E;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

#wp-risk-liq-display-btn:hover,
#wp-risk-liq-excel-btn:hover {
    background-color: #C03F1E;
}

#wp-risk-liq-results table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-family: 'Poppins', sans-serif;
}

#wp-risk-liq-results table th,
#wp-risk-liq-results table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

#wp-risk-liq-results table th {
    background-color: #f8f8f8;
    font-weight: 600;
    color: #333;
}

#wp-risk-liq-results table tr:nth-child(even) {
    background-color: #f9f9f9;
}

#wp-risk-liq-results table tr:hover {
    background-color: #f1f7fd;
}

.wp-risk-liq-view-btn {
    padding: 6px 12px;
    background-color: #E4572E;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.wp-risk-liq-view-btn:hover {
    background-color: #C03F1E;
}

#wp-risk-liq-overlay {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    overflow-y: auto;
    animation: fadeInModal 0.3s ease;
}

#wp-risk-liq-close-overlay:hover {
    background-color: #C03F1E !important;
}

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

/* Responsive styles for liquidations wizard */
@media screen and (max-width: 768px) {
    #wpRiskLiquidationsWizard {
        padding: 0;
    }
    
    #wp-risk-publication-dropdown {
        max-width: 100%;
    }
    
    #wp-risk-liq-display-btn,
    #wp-risk-liq-excel-btn {
        width: 100%;
        margin-bottom: 8px;
        margin-right: 0;
    }
    
    #wp-risk-liq-results table th,
    #wp-risk-liq-results table td {
        padding: 8px;
        font-size: 14px;
    }
}

/* PDF Download Button */
.risk-pdf-download-btn {
    padding: 8px 16px;
    background-color: #E4572E;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.risk-pdf-download-btn:hover {
    background-color: #A13615;
}

/* CR Link Styling */
.risk-cr-link {
    color: #E4572E;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.risk-cr-link:hover {
    color: #A13615;
    text-decoration: underline;
}

/* ============================================================================
   CHATBOT STYLES
   ============================================================================ */

#wpRiskChatbot {
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
    height: 600px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    margin: 20px 0;
}

#wpRiskChatbot * {
    box-sizing: border-box;
}

/* Header */
#wpRiskChatbotHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #E4572E;
    color: white;
    flex-shrink: 0;
}

.chatbot-header-title {
    font-weight: 600;
    font-size: 16px;
}

#wpRiskChatbotClear {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.4);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
}

#wpRiskChatbotClear:hover {
    background: rgba(255,255,255,0.3);
}

/* Messages area */
#wpRiskChatbotMessages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message bubbles */
.chatbot-message {
    max-width: 80%;
    animation: chatbot-fadeIn 0.2s ease-out;
}

@keyframes chatbot-fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.chatbot-message-user {
    align-self: flex-end;
}

.chatbot-message-bot {
    align-self: flex-start;
}

.chatbot-message-user .chatbot-message-content {
    background: #E4572E;
    color: white;
    padding: 10px 16px;
    border-radius: 16px 16px 4px 16px;
    font-size: 14px;
    line-height: 1.5;
}

.chatbot-message-bot .chatbot-message-content {
    background: white;
    color: #333;
    padding: 10px 16px;
    border-radius: 16px 16px 16px 4px;
    border: 1px solid #eee;
    font-size: 14px;
    line-height: 1.5;
}

.chatbot-message-bot .chatbot-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.chatbot-message-bot .chatbot-message-content li {
    margin-bottom: 4px;
}

.chatbot-message-bot .chatbot-message-content strong {
    font-weight: 600;
}

/* Action buttons (copy, export) */
.chatbot-message-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.chatbot-action-copy,
.chatbot-action-export {
    background: none;
    border: 1px solid #ddd;
    color: #888;
    font-size: 12px;
    font-family: 'Poppins', sans-serif;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-action-copy:hover,
.chatbot-action-export:hover {
    border-color: #E4572E;
    color: #E4572E;
}

/* Source cards */
.chatbot-sources {
    margin-top: 8px;
}

.chatbot-sources-toggle {
    background: none;
    border: 1px solid #ddd;
    color: #E4572E;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-sources-toggle:hover {
    background: #fef2ef;
}

.chatbot-sources-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chatbot-source-card {
    background: white;
    border: 1px solid #eee;
    border-left: 3px solid #E4572E;
    border-radius: 4px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.4;
}

.chatbot-source-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.chatbot-source-name {
    font-weight: 600;
    color: #333;
}

.chatbot-watchlist-badge {
    background: #d4edda;
    color: #155724;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.chatbot-source-type {
    display: inline-block;
    background: #f0f0f0;
    color: #555;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 3px;
    margin-right: 6px;
}

.chatbot-source-date,
.chatbot-source-cr {
    color: #888;
    font-size: 12px;
    margin-right: 10px;
}

.chatbot-source-summary {
    color: #555;
    font-size: 12px;
    margin: 6px 0 4px 0;
    line-height: 1.4;
}

.chatbot-source-pdf {
    color: #E4572E;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
}

.chatbot-source-pdf:hover {
    text-decoration: underline;
}

/* Typing indicator */
.chatbot-typing-indicator {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px 16px 16px 4px;
    border: 1px solid #eee;
    width: fit-content;
}

.chatbot-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #ccc;
    border-radius: 50%;
    animation: chatbot-bounce 1.4s infinite;
}

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

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

@keyframes chatbot-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* Prompt chips */
.chatbot-prompt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.chatbot-chip {
    background: white;
    border: 1px solid #E4572E;
    color: #E4572E;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-chip:hover {
    background: #E4572E;
    color: white;
}

/* Input area */
#wpRiskChatbotInputArea {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid #ddd;
    background: white;
    gap: 8px;
    flex-shrink: 0;
}

#wpRiskChatbotInput {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

#wpRiskChatbotInput:focus {
    border-color: #E4572E;
}

#wpRiskChatbotSend {
    padding: 10px 20px;
    background: #E4572E;
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: background-color 0.2s;
}

#wpRiskChatbotSend:hover {
    background: #C03F1E;
}

.chatbot-send-disabled {
    opacity: 0.6;
    cursor: not-allowed !important;
}

/* Mobile responsive */
@media (max-width: 600px) {
    #wpRiskChatbot {
        height: calc(100vh - 200px);
        min-height: 400px;
        border-radius: 0;
        margin: 0 -15px;
    }

    .chatbot-message {
        max-width: 90%;
    }

    #wpRiskChatbotMessages {
        padding: 12px;
    }

    .chatbot-prompt-chips {
        flex-direction: column;
    }

    .chatbot-chip {
        text-align: center;
    }

    #wpRiskChatbotInput {
        font-size: 16px; /* Prevent iOS zoom on focus */
    }
}


/* AI Company Report (disclosures-only, on filtered-by-CR results view) */
.risk-report-section {
    margin: 16px 0 24px 0;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.risk-report-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.risk-report-range {
    padding: 7px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #333;
    min-width: 180px;
    cursor: pointer;
}
.risk-report-range:focus { outline: none; border-color: #E4572E; }
.risk-report-generate {
    background-color: #E4572E;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 7px 16px;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}
.risk-report-generate:hover { background-color: #c94521; }
.risk-report-generate:disabled { background-color: #d6a193; cursor: not-allowed; }
.risk-report-status {
    margin-top: 12px;
    font-size: 14px;
    color: #444;
}
.risk-report-error { color: #b91c1c; }
.risk-report-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(228, 87, 46, 0.25);
    border-top-color: #E4572E;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    vertical-align: -2px;
    margin-right: 6px;
}
.risk-report-output {
    margin-top: 14px;
    background-color: #f8f9fa;
    border-left: 3px solid #E4572E;
    padding: 14px 18px;
    border-radius: 0 4px 4px 0;
    font-size: 14px;
    line-height: 1.65;
    color: #222;
}
.risk-report-output h3, .risk-report-output h4 {
    margin: 14px 0 6px 0;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    color: #222;
}
.risk-report-output h3:first-child, .risk-report-output h4:first-child { margin-top: 0; }
.risk-report-output p { margin: 0 0 8px 0; }
.risk-report-output ul { margin: 4px 0 10px 22px; padding: 0; }
.risk-report-output li { margin: 0 0 4px 0; }
.risk-report-cached-notice {
    margin-top: 12px;
    color: #888;
    font-size: 12px;
    font-style: italic;
}
