/* deals_embed.css */
:root {
    --deals-primary: #297dee;
    --deals-text-dark: #1b1b1b;
    --deals-text-grey: #666;
    --deals-bg-light: #f9f9f9;
    --deals-border: #eaeaea;
    --deals-orange: #f97316;
}

.deals-main-container {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    overflow: hidden;
    min-height: 600px;
    font-family: 'Inter', sans-serif;
    width: 100%;
    margin: 0 auto;
}

/* --- Header --- */
.deals-controls-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--deals-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    background: #eaeaea;
}

.deals-controls-header h2 {
    font-family: 'Instrument Serif', serif;
    font-size: 28px;
    margin: 0;
    color: var(--deals-text-dark);
}

.deals-sector-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.deals-sector-label { 
    font-size: 0.85rem; 
    font-weight: 600; 
    color: #666; 
}

select.deals-sector-select {
    padding: 8px 12px;
    font-size: 0.9rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    background-color: #fff;
    cursor: pointer;
    min-width: 150px;
}

/* --- NEW: Advanced Search Bar Layout --- */
.deals-advanced-search {
    display: grid;
    grid-template-columns: 1fr; /* Default Mobile: 1 column */
    gap: 10px;
    padding: 15px 30px;
    background-color: #f8f9fa;
    border-bottom: 1px solid var(--deals-border);
}

.deals-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.deals-input-group label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
}

.deals-advanced-search input, 
.deals-advanced-search select {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.95rem;
    width: 100%;
    box-sizing: border-box;
    outline: none;
}

.deals-advanced-search input:focus,
.deals-advanced-search select:focus {
    border-color: var(--deals-primary);
}

.deals-search-actions {
    display: flex;
    align-items: flex-end;
}

#widget-search-btn {
    width: 100%;
    padding: 10px;
    background-color: var(--deals-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.2s;
}

#widget-search-btn:hover {
    background-color: #1a65c9;
}

/* --- Header Info & Social --- */
.deals-info-row {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 10px 30px;
    font-size: 0.85rem;
}

.dealdate { display: none; }
.deals-social-wrapper { display: none; }


/* --- DESKTOP Specific Layouts (min-width: 768px) --- */
@media (min-width: 768px) {
    /* 5-Column Grid for Search Bar */
    .deals-advanced-search {
        /* Text(2fr) Country(1fr) Size(1fr) Subcat(1fr) Button(0.8fr) */
        grid-template-columns: 2fr 1fr 1fr 1fr 0.8fr; 
        align-items: end;
    }

    /* Show Header Extras */
    .deals-social-wrapper {
        display: flex; align-items: center; gap: 8px; font-size: 14px;
        color: white; background-color: #297dee; border-radius: 8px; padding: 7px 12px;
    }
    .deals-social-wrapper a { text-decoration: none; color: #ffffff; font-weight: 500; }
    
    .dealdate { 
        display: block; 
        color: gray; 
        font-style: italic; 
    }
}

/* --- MOBILE Specific Layouts (max-width: 767px) --- */
@media (max-width: 767px) {
    /* Hide the advanced filters (Country, Size, Subcat) */
    .deals-input-group:nth-of-type(2),
    .deals-input-group:nth-of-type(3),
    .deals-input-group:nth-of-type(4) {
        display: none;
    }

    /* Button takes full width */
    .deals-search-actions {
        margin-top: 5px;
    }
    
    /* Hide info row on very small screens if needed, or just adjust padding */
    .deals-info-row {
        flex-direction: column;
        gap: 10px;
        padding: 10px 15px;
    }
}


/* --- List Container --- */
#deals-list { padding: 0; }

.deal-item {
    display: grid;
    /* Desktop Columns: Name | Headline | Amount | Country | Category */
    grid-template-columns: minmax(90px, 160px) 1fr 10% 12% 12%;
    gap: 4px 20px; 
    padding: 16px 20px; 
    border-bottom: 1px solid var(--deals-border);
    align-items: start;
}

.deal-item:hover { background-color: #fcfcfc; }

/* Desktop Grid Placement */
.cell-name { 
    grid-column: 1; 
    font-weight: 700;
    font-size: 0.85rem; 
    color: var(--deals-text-dark);
    word-wrap: break-word;
    line-height: 1.3;
}
.cell-name a { color: var(--deals-primary); text-decoration: none; font-family: 'Instrument Serif'; font-size: 1.3rem;}
.cell-name a:hover { color: rgb(0, 0, 198); text-decoration: none; }

.cell-headline {
    grid-column: 2; 
    font-weight: 600;
    font-size: 0.85rem; 
    line-height: 1.4;
}
.cell-headline a { color: #373738; text-decoration: none; }
.cell-headline a:hover { text-decoration: underline; }

.cell-amount {
    grid-column: 3; 
    font-weight: 600;
    color: #129e3b;
    font-size: 0.75rem; 
    white-space: nowrap;
}

.cell-country {
    grid-column: 4; 
    font-size: 0.75rem; 
    color: #555;
}

.cell-category {
    grid-column: 5; 
    text-align: left;
}
.cat-badge {
    display: inline-block;
    font-size: 0.55rem;
    text-transform: uppercase;
    background: #4fc0e8;
    color: #ffffff;
    padding: 7px 7px;
    border-radius: 4px;
    white-space: normal;
    line-height: 1.2;
}

/* Row 2 */
.cell-date {
    grid-column: 1; 
    font-size: 0.65rem; 
    color: #888;
    margin-top: 4px;
}

.cell-summary {
    grid-column: 2 / -1; 
    font-size: 0.75rem; 
    color: #555;
    line-height: 1.5;
    margin-top: 4px;
}

/* Row 3 */
.cell-investors {
    grid-column: 2 / -1; 
    font-size: 0.8rem; 
    color: #129e3b;
    margin-top: 4px;
}
.investor-label {
    font-weight: 600;
    font-size: 0.55rem;
    text-transform: uppercase;
    color: #ffffff;
    margin-right: 5px;
    background: #49cfaf;
    border-radius: 3px;
    padding: 4px;
}

/* Row 4 (Careers) */
.cell-careers {
    grid-column: 2 / -1; 
    font-size: 0.8rem;
    margin-top: 4px;
}

.career-label {
    font-weight: 600;
    font-size: 0.55rem;
    text-transform: uppercase;
    color: #ffffff;
    margin-right: 5px;
    background: var(--deals-orange);
    border-radius: 3px;
    padding: 4px;
}

.cell-careers a {
    color: #fa7315;
    text-decoration: underline;
}

/* --- MOBILE DEAL ITEM (max-width: 768px) --- */
/* --- MOBILE DEAL ITEM (max-width: 768px) --- */
@media (max-width: 768px) {
    /* Hide desktop-only columns */
    .hide-on-mobile, .cell-date, .cell-summary, .cell-category { display: none !important; }
    
    .deal-item {
        display: grid;
        /* Columns: Name (50%) | Amount (20%) | Country (30%) */
        grid-template-columns: 50% 20% 30%;
        /* FIX 1: Change specific rows to 'auto' so the grid grows as needed */
        grid-template-rows: auto; 
        gap: 6px 0px; 
        padding: 12px 15px; 
    }

    /* --- Row 1: Top Bar --- */
    .cell-name {
        grid-column: 1; 
        grid-row: 1; /* Keep top bar items in Row 1 */
        font-size: 0.9rem;
        align-self: center; padding-right: 5px;
    }
    
    .cell-amount {
        grid-column: 2; 
        grid-row: 1;
        font-size: 0.85rem;
        align-self: center; text-align: right; padding-right: 5px; 
    }

    .cell-country {
        grid-column: 3; 
        grid-row: 1;
        font-size: 0.8rem;
        color: #888;
        align-self: center; text-align: right;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }

    /* --- Row 2: Headline --- */
    .cell-headline {
        grid-column: 1 / -1; /* Span full width */
        grid-row: auto;      /* FIX 2: Let it sit naturally below Row 1 */       
        font-size: 0.9rem; margin-top: 6px;
    }

    /* --- Row 3: Investors --- */
    .cell-investors {
        grid-column: 1 / -1; 
        grid-row: auto;      /* FIX 3: Remove 'grid-row: 3' to prevent collision */    
        padding-top: 4px; font-size: 0.75rem;
    }

    /* --- Row 4: Careers --- */
    .cell-careers {
        grid-column: 1 / -1; 
        grid-row: auto;      /* FIX 4: Remove 'grid-row: 3' so it stacks below Investors */    
        padding-top: 4px; font-size: 0.75rem;
    }
}

/* --- Pagination --- */
.deals-pagination {
    display: flex;
    justify-content: center;
    padding: 20px;
    gap: 6px;
}
.page-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    color: var(--deals-primary);
    font-size: 0.9rem;
}
.page-btn.active { background-color: var(--deals-primary); color: #fff; border-color: var(--deals-primary); }
.page-btn:disabled { color: #ccc; cursor: not-allowed; }
.loading-state { text-align: center; padding: 40px; color: #888; font-style: italic; font-size: 0.9rem; }