/**
 * 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); }
}


.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;
}

/* 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;
}

.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%;
    }
    
    .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: 15px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#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;
    font-size: 16px;
    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: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", 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: #4CAF50;
    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: #45a049;
}

#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;
}

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

/* Responsive styles for liquidations wizard */
@media screen and (max-width: 768px) {
    #wpRiskLiquidationsWizard {
        padding: 10px;
    }
    
    #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;
}

