/* --- CONTAINER --- */
.indices-container {
    /* FIX: Changed height to min-height so it expands when cards wrap */
    min-height: 160px; 
    height: auto; 
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    flex-wrap: wrap; 
    gap: 15px;
    padding: 20px 0; /* Increased padding to prevent touching search bar */
    margin-bottom: 20px; /* Force space between this and the search bar */
}

/* --- INDIVIDUAL CARD --- */
.index-item {
    height: 140px;
    width: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Centers content vertically */
    border-radius: 15px;
    padding: 10px 0;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: transform 0.3s, box-shadow 0.3s;
    background-color: #1f1f1f;
}

/* Hover effect */
.index-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}


/* --- TOP ROW --- */

.top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;

}

/* Trend arrow */

.top-row img {
    width: 20px;
    height: 20px;

}


/* --- INDEX NAME --- */

.index-name {
    font-size: 18px;
    font-weight: 600;
    color: #1E2A78;

}

.price {
    font-size: 18px;
    font-weight: 500;
    color: black;
    padding: 5px 20px;
}


/* --- BOTTOM ROW --- */
.bottom-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 0 20px;
}



/* Change & % */

.changes p {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}



/* Positive trend */
.positive-ind {
    background-color: #e6f9e6; /* soft green */
    color: #1ecb4f;
    border-radius: 8px;
    padding: 3px 8px;
    display: flex;
    align-items: center;
    gap: 5px;

}

/* Negative trend */
.negative-ind {
    background-color: #ffe6e6; /* soft red */
    color: #ff4d4f;
    border-radius: 8px;
    padding: 3px 8px;
    display: flex;
    align-items: center;
    gap: 5px;

}

/* Smooth update effect */
.index-item {
    animation: fadeUpdate 0.5s ease;
}

.positive-ind {
    color: #16a34a; /* green */
}

.negative-ind {
    color: #dc2626; /* red */
}

.positive-ind .price,
.positive-ind .changes {
    color: #16a34a;
}

.negative-ind .price,
.negative-ind .changes {
    color: #dc2626;
}



@keyframes fadeUpdate {
    from { opacity: 0.7; transform: scale(0.98); }
    to   { opacity: 1; transform: scale(1); }
}

/* Responsive for smaller screens */

@media (max-width: 1200px) {
    .index-item {
        width: 220px;
    }
}



@media (max-width: 992px) {
    .index-item {
        width: 180px;
    }
    .price {
        font-size: 20px;
    }
    .changes p {
        font-size: 16px;
    }
}


/* --- MOBILE VIEW --- */
@media (max-width: 576px) {
    .indices-container {
        justify-content: center;
        gap: 15px;
        /* Increase padding on mobile to ensure separation */
        padding: 30px 10px; 
        height: auto; 
    }

    .index-item {
        /* On very small screens, 2 cards might still be too wide. 
           This ensures they stack or fit properly */
        width: calc(50% - 20px); 
        min-width: 150px;
        height: 130px;
    }
}






.tables-section {
    flex: 1;
  }

  .table-container {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    height: 400px;
  }

  .table-header {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
  }

  table {
    width: 100%;
    border-collapse: collapse;
    
  }

  th, td {
    padding: 8px;
    text-align: left;
    font-size: 14px;
    border-bottom: 1px solid #e2e8f0;
  }

  .positive { color: #10b981; background-color: transparent; }
  .negative { color: #ef4444; background-color: transparent; }


  .tab-content{
    display: none;
    
  }
  .data-grid{
    overflow: scroll;
    height: 320px;
  }
  .data-grid::-webkit-scrollbar {
    width: 8px;
  }
  .tab-content.active{
    display: block;
  }



  .tab-button{
    padding: 8px 20px;
    border: 1px solid ;
    
    color: var(--white-color);
    border-radius: 15px;
    background-color: var(--white);
    
  }
  .section-buttons {
    display: flex
;
    align-items: center;
    justify-content: space-evenly;
    
    padding-bottom: 10px;
    padding-top: 10px;
    margin-bottom: 10px;
  }
 
  button.active{
    
    background-color: var(--secondary);
    border: 1px solid ;
  }
  .section-buttons  button{
  border: none;
  background-color: transparent;
  border-bottom: 1px solid;
 }
 .section-buttons  button.active{
  border: none;
  color: var(--primary);
    border-bottom: 1px solid;
 }

.section-buttons {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  padding-bottom: 10px;
  padding-top: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}

.section-buttons button {
  flex: 1;
  text-align: center;
  border: none;
  background-color: transparent;
  border-bottom: 2px solid transparent;
  padding: 8px;
  font-weight: 500;
  color: var(--text-color, #333);
  transition: border-bottom 0.3s, color 0.3s;
}

/* 🔵 Active button with blue border */
.section-buttons button.active {
  border-bottom: 2px solid var(--primary, #2563eb); /* blue-600 fallback */
  color: var(--primary, #2563eb);
}
.data-table thead tr th{
  background-color: #F3F4F6;
  margin-right: 10px;
}



























/* --- SEARCH SECTION --- */
.search-container {
    width: 50%;
    margin: 40px auto 60px auto; /* Added 60px margin-bottom for space below */
    display: flex;
    justify-content: center;
}

/* Necessary for the pop-up to align with the bar */
.search-wrapper {
    position: relative;
    width: 100%;
}

#search-form {
    height: 48px;
    width: 100%;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    padding: 0 18px;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    position: relative;
    z-index: 20; /* Keep bar above results shadow */
}

/* --- AUTOCOMPLETE POP-UP --- */
.search-results-box {
    position: absolute;
    top: 55px; /* Sits right below the search bar */
    left: 0;
    width: 100%;
    background: white;
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 100; /* High z-index to float over indices/news */
    display: none; /* Hidden by default - show it when typing via JS */
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
}

/* Individual result row */
.result-item {
    padding: 12px 20px;
    font-size: 15px;
    color: #333;
    cursor: pointer;
    border-bottom: 1px solid #f9f9f9;
}

.result-item:hover {
    background-color: #f1f4ff;
    color: #1E2A78;
}

/* Styling for the icon & box same as your previous code... */
.search-icon { display: flex; align-items: center; margin-right: 12px; }
.search-box { flex: 1; border: none; outline: none; background: transparent; font-size: 16px; }

#search-form:focus-within {
    border-color: #1E2A78;
    box-shadow: 0 4px 15px rgba(30, 42, 120, 0.2);
}

/* --- MOBILE VIEW --- */
@media (max-width: 768px) {
    .search-container {
        width: 90%;
        margin: 20px auto 40px auto; /* Slightly less space on mobile */
    }
    
    .search-results-box {
        top: 50px;
    }
}























/* --- MAIN WRAPPER --- */
.market-news-gl {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 94%;
    margin: 40px auto;
    gap: 24px;
}

/* --- COMMON CARD STYLING --- */
.market-news, .market-gl {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    height: 550px; /* Unified height for symmetry */
    width: 49%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- LATEST NEWS SECTION --- */
.market-news-heading {
    font-size: 20px;
    font-weight: 700;
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
}

.market-news-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 24px;
}

.news-entity {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #f8f8f8;
}

.market-news-left {
    width: 100px;
    height: 70px;
    flex-shrink: 0;
}

.market-news-left img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.market-news-right-heading {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 5px;
    color: #1a1a1a;
}

.market-news-right-content {
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

/* --- GAINERS & LOSERS (TABLES) SECTION --- */
.table-header {
    padding: 15px 20px;
    background: #fafafa;
}

.table-header h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

/* Top Level Tabs (Near, Next, Far) */
.tab-buttons {
    display: flex;
    gap: 10px;
}

.tab-button {
    padding: 6px 15px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: 0.3s;
}

.tab-button.active {
    background: var(--primary, #2563eb);
    color: white;
    border-color: var(--primary, #2563eb);
}

/* Sub-level Buttons (Price/OI Gainers) */
.section-buttons {
    display: flex;
    overflow-x: auto; /* Scrollable buttons on small screens */
    border-bottom: 1px solid #eee;
}

.section-button {
    flex: 1;
    padding: 12px 5px;
    border: none;
    background: transparent;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.section-button.active {
    color: var(--primary, #2563eb);
    border-bottom: 2px solid var(--primary, #2563eb);
}

/* Scrollable Data Grid */
.data-grid {
    height: 320px;       /* Set the height you want */
    overflow-y: auto;    /* Enable vertical scroll */
    overflow-x: auto;    /* Enable horizontal scroll for small screens */
    border: 1px solid #e2e8f0;
}
/* Hide inactive tab contents */
.tab-content {
    display: none;
    flex-direction: column;
    height: 100%;
}

.tab-content.active {
    display: flex;
}

/* --- MOBILE VIEW (RESPONSIVE) --- */
@media (max-width: 1024px) {
    .market-news-gl {
        flex-direction: column;
        align-items: center;
    }

    .market-news, .market-gl {
        width: 100%;
        height: 500px;
    }
}

@media (max-width: 480px) {
    .market-news-left {
        width: 70px; /* Smaller image on tiny phones */
    }
    
    .section-button {
        font-size: 11px; /* Fit more buttons */
    }
    
    .market-news-right-heading {
        font-size: 14px;
    }
}









/* --- CONTAINER --- */
.mutual-fund-wrapper {
    width: 80%;
    margin: 40px auto; /* Added margin for spacing */
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.mutual-fund-wrapper > label {
    font-size: 24px;
    font-weight: 600;
    line-height: 32px;
    display: block; /* Ensures label stays on its own line */
    margin-bottom: 15px;
}

.mf-title {
    text-align: center;
    font-size: 32px;
    font-weight: 600;
    line-height: 48px;
    padding-bottom: 10px;
}

/* 1. Create a wrapper in your HTML to hold the select (Optional but Recommended) */
/* Or use this CSS to force centering in the existing wrapper */

.mutual-fund-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center; /* This centers everything inside the wrapper */
}

select {
    width: 100%;
    max-width: 300px; /* Prevents it from being too wide on desktop */
    height: 45px;
    padding: 0 16px;
    font-size: 16px;
    margin: 10px 0 25px 0; /* Space above and below */
    border-radius: 25px;
    border: 2px solid var(--primary);
    background-color: #ffffff;
    cursor: pointer;
    
    /* This centers the text and the dropdown arrow */
    text-align: center;
    text-align-last: center; 
    
    /* Appearance cleanup */
    appearance: none; /* Removes default browser styling */
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%232563eb%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 18px;
}

select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.mutual-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: var(--normal-size);
    box-shadow: var(--shadow-color);
    border-radius: 8px;
    overflow: hidden;
}
.mutual-fund-wrapper {
    position: relative;
}

.login-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    text-align: center;
    flex-direction: column;
}

.blur-table {
    filter: blur(4px);
    pointer-events: none;
}

.login-overlay .login-text {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 20px;
}

.prev-login {
    display: inline-block;
    padding: 10px 60px; /* Reduced from 90px to fit mobile better */
    background-color: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 16px;
    font-weight: 600;
    transition: background 0.3s ease, transform 0.2s;
}

.prev-login:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

/* --- MOBILE VIEW --- */
@media (max-width: 768px) {
    .mutual-fund-wrapper {
        width: 95%; /* Take more width on small screens */
        padding: 15px;
    }

    .mf-title {
        font-size: 24px;
        line-height: 32px;
    }

    .login-overlay {
        width: 85%;
        padding: 1.5rem 1rem;
        min-width: unset;
    }

    .prev-login {
        padding: 10px 0;
        width: 100%; /* Button takes full width of overlay on mobile */
    }
}


















