/* --- ADD THIS AT THE TOP --- */
@keyframes gradientSwirl {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
/* --- END OF NEW --- */


/* This is the container for the widget */
.mapco-news-widget-container {
        /* width: 100%; */
        max-height: 1200px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        border: 2px solid #025bb5;
        border-radius: 8px;
        background-color: #f9f9f9;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
        /* margin-right: 10px; */
        padding: 0;
        margin: 0px;
}

/* This is the fixed header */
.mapco-widget-header {
    padding: 12px 20px;
    font-weight: bold;
    font-size: 1.7rem;
    color: #ffffff;
    background-color: #005bb5;
    border-bottom: 0px solid #eee;
    border-radius: 5px 5px 0px 0px;
    flex-shrink: 0;
    font-family: 'Instrument Serif';
}

/* This is now the scrollable content area */
.mapco-widget-content {
    padding: 5px 10px;
    flex-grow: 1;
    overflow-y: auto;
    background-color: #ffffff;
    border: 0px solid #d0cfcf;
    border-radius: 10px;
    border-top-right-radius: 0px;
    border-top-left-radius: 0px;
    
}

/* Loading animation styles */
.mapco-widget-content.mapco-loading {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #667eea 100%);
    animation: gradientSwirl 8s ease infinite;
    background-size: 400% 400%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mapco-widget-content.mapco-loading p {
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 20px;
    text-align: center;
}


/* Styles for the list */
.mapco-widget-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Two-column layout for each news item */
.mapco-news-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 5px;
    border-bottom: 1px solid #d9d9d9;
    background-color: #fffbf7;;
    padding: 4px 10px 4px 10px;
}
.mapco-news-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* --- MODIFIED STYLES FOR COLUMN 1 --- */

/* This is the wrapper for the company label */
.mapco-company-label {
    flex-basis: 150px;
    flex-shrink: 0;
    line-height: 1.5;
}

/* This styles the new logo */
.mapco-company-logo {
    width: 30px;
    height: 30px;
    border-radius: 4px; /* A slight corner radius */
    margin-right: 6px;
    vertical-align: middle; /* Aligns logo with text */
    object-fit: contain;
}

.mapco-company-link-placeholder {
    display: flex; 
    align-items: center;
    font-weight: bold;
    font-size: 0.8rem;
    color: #6c6c6c;
    text-decoration: none;
}

.mapco-company-link {
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 0.9rem;
    color: #297dee;
    text-decoration: underline;
}

.mapco-company-link:hover {
    text-decoration: underline;
}

/* --- END OF MODIFIED STYLES --- */


/* Column 2: Article Details */
.mapco-article-details {
    flex: 1;
}
.mapco-article-details a {
    font-size: 0.8rem;
    font-weight: 600;
    color: #297dee;
    text-decoration: none;
    display: block;
}
.mapco-article-details a:hover {
    text-decoration: underline;
}
.mapco-article-details .meta {
    font-size: 0.75rem;
    color: #a3a09a;
}

.mapco-headline-details > a {
    display: block;
    font-family: 'Instrument Serif';
    color: #1b1b1b;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.3rem;
}

.mapco-headline-details a:hover {
    text-decoration: underline;
}

/* --- Styles for the new 'Find Similar' Button --- */
.mapco-similar-button {
    display: inline-block;
    background-color: #218f00;
    color: #ffffff;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

/* --- Style for when you hover over the button --- */
.mapco-similar-button:hover {
    background-color: #e67e22; /* A slightly darker orange */
    color: #ffffff;            /* Keeps text white */
    text-decoration: none;
}

.mapco-actions-wrapper {
    /* (A) This makes the buttons inside go side-by-side */
    display: flex;
    flex-direction: row; 
    gap: 8px; /* Adds space *between* your buttons */
    
    /* (B) This pushes the *entire group* to the far right */
    margin-left: auto;
    
    /* (C) This prevents the buttons from shrinking on mobile */
    flex-shrink: 0;
}


.news-filter-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    padding: 10px;
    background-color: #3b9bff;
}

  .news-filter-toggle label {
    cursor: pointer;
  }
  .news-filter-toggle .switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
  }
  .news-filter-toggle .switch input { 
    opacity: 0;
    width: 0;
    height: 0;
  }
  .news-filter-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
  }
  .news-filter-toggle .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
  }
  .news-filter-toggle input:checked + .slider {
    background-color: #4CAF50; /* Green when on */
  }
  .news-filter-toggle input:checked + .slider:before {
    transform: translateX(20px);
  }


/* --- Styles for the "Expanded Funding Summary" link --- */
.mapco-expanded-summary-wrapper {
    margin-left: 0px;
    margin-top: 0px;
}

.mapco-expanded-summary-link {
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
}

.mapco-expanded-summary-link:hover {
    color: #0056b3; /* A slightly darker blue for the hover state */
}

.summary-text {
    margin-top:0px;
    margin-bottom:10px;
    line-height: 20px;
    color: #7f7f7f;
    display: block;
    /* font-size: 14px; */
}

/* ------------------------------------------------ */
/* --- NEW TABLE STYLES FOR DEAL SUMMARY VIEW --- */
/* ------------------------------------------------ */

.mapco-deals-table {
    width: 100%;
    border-collapse: collapse;
    /* font-size: 0.9rem; */
}

.mapco-deals-table thead th {
    background-color: #fb6e52;
    color: white;
    padding: 10px 8px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: bold;
}

.mapco-deals-table tbody tr {
    /* Ensure only the second row has the bottom border */
    border-bottom: none;
    background: white;
    font-size: 0.8rem;
}

/* Style for all cells */
.mapco-deals-table td {
    padding: 8px;
    vertical-align: top;
    border: none;
    color: black;
}

/* Style for the second row (meta/summary row) */
.mapco-deal-row-meta .meta-cell {
    background-color: #ffffff;
    border-bottom: 4px solid #d9d9d9;
    padding-top: 5px;
    padding-bottom: 20px;
    line-height: 1.4;
    color: #555;
}

/* Column styles in the main row */
.mapco-deal-row-main .company-cell {
    padding-left: 10px;
    font-weight: bold;
    font-family: 'Instrument Serif';
    font-size: 24px;
}

.mapco-deal-row-main .value-cell strong {
    color: #fb6e52;
    font-size: 1.05em;
    white-space: nowrap;
}

.mapco-deal-row-main .headline-cell a {
    font-weight: 600;
    color: #1b1b1b;
    text-decoration: none;
}
.mapco-deal-row-main .headline-cell a:hover {
    text-decoration: underline;
}

.mapco-deal-row-main .actions-cell {
    white-space: nowrap;
    display: flex; /* For buttons to sit side-by-side */
    gap: 5px;
}

/* Style for company link within the table */
.mapco-deals-table .mapco-company-link-table {
    text-decoration: none;
    color: #027bff;
}

/* Meta Separator style */
.mapco-deal-row-meta .meta-separator {
    color: #bbb;
    margin: 0 5px;
}

/* ------------------------------------------------ */
/* --- MOBILE RESPONSIVENESS FIX FOR TABLE --- */
/* ------------------------------------------------ */

@media (max-width: 600px) {
    
    /* 1. Hide non-essential columns and headers */
    .hide-on-mobile {
        display: none !important;
    }
    
    .mapco-deals-table thead {
        display: none; /* Hide table headers entirely */
    }

    /* 2. Make table cells stack */
    .mapco-deals-table, 
    .mapco-deals-table tbody, 
    .mapco-deals-table tr {
        display: block;
        width: 100%;
    }
    
    .mapco-deals-table tr {
        margin-bottom: 0px;
        border-bottom: 1px solid #d9d9d9;
    }

    /* Main row cells should take full width */
    .mapco-deal-row-main td {
        display: block; 
        width: 100%;
        padding: 5px 10px;
        box-sizing: border-box;
    }
    
    /* Fix: Company logo and name must remain side-by-side */
    .mapco-deal-row-main .company-cell,
    .mapco-deals-table .mapco-company-link-table,
    .mapco-deals-table .mapco-company-link-placeholder {
        display: flex !important;
        align-items: center;
        text-decoration: none;
    }
    
    /* Action buttons should move to the right or stack */
    .mapco-deal-row-main .actions-cell {
        display: flex;
        justify-content: flex-end; /* Push buttons to the right */
        gap: 8px;
        padding-top: 0;
    }

    /* 3. Style the meta row to wrap naturally */
    .mapco-deal-row-meta td {
        display: block;
        width: 100%;
        white-space: normal; /* Allow text to wrap naturally */
        padding: 5px 10px 10px 10px;
        border-top: none; 
    }
    
    /* Ensure summary text is not hidden */
    .mapco-deal-row-meta .summary-text {
        display: block;
        margin-top: 0;
        margin-bottom: 5px;
    }

    /* Ensure separators wrap nicely */
    .mapco-deal-row-meta .meta-separator {
        display: inline-block;
        margin: 0 5px;
    }
}