/*
--- GST Rate Finder v6 ---
Author: BestWay Solution & Gemini
Description: Added a new section for key changes and special category cards.
*/

/* --- 1. Global Styles & Variables --- */
:root {
    --primary-blue: #0d47a1;
    --primary-dark: #141414;
    --accent-yellow: #ffd600;
    --bg-main: #f4f5f7;
    --bg-white: #ffffff;
    --text-dark: #212121;
    --text-light: #616161;
    --border-color: #e0e0e0;
    --increase-color: #d32f2f;
    --decrease-color: #388e3c;
    --no-change-color: #757575;
}
/* --- 0. Pre-loader Styles --- */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-white);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}
#loader-logo {
    width: 360px;
    height: auto;
    margin-bottom: 30px;
    transition: all 0.8s cubic-bezier(0.6, -0.28, 0.735, 0.045);
}
.loader-bar-container {
    width: 200px;
    height: 4px;
    background-color: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}
.loader-bar {
    width: 0;
    height: 100%;
    background-color: var(--primary-blue);
    border-radius: 2px;
    animation: loading 300ms ease-out forwards;
}
@keyframes loading {
    from { width: 0%; }
    to { width: 100%; }
}
#main-content {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in;
}
#main-content.visible {
    opacity: 1;
    visibility: visible;
}
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.6;
}
/* --- 2. Header & Navigation --- */
header {
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    padding: 5px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}
header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo-container { display: flex; align-items: center; text-decoration: none; }
.logo { height: 45px; margin-right: 12px; }
.company-name { font-size: 1.2rem; font-weight: 700; color: var(--primary-blue); }
header nav a { margin-left: 25px; text-decoration: none; color: var(--text-light); font-weight: 600; transition: color 0.2s ease; font-size: 0.95rem;}
header nav a:hover { color: var(--primary-blue); }
/* --- 3. Hero Search Section --- */
#search-section {
    text-align: center;
    padding: 60px 20px;
    position: relative;
    background-image: url(../images/hero1.png);
    background-size: cover;
    background-position: center;
}
#search-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(13, 71, 161, 0.9), rgba(0, 121, 107, 0.9));
    opacity: 68%;
    z-index: 1;
}
#search-section .container {
    position: relative;
    z-index: 2;
}
#search-section h1 { font-size: 3rem; color: var(--bg-white); margin-bottom: 10px; font-weight: 800; }
#search-section .subtitle { font-size: 1.1rem; color: rgba(255,255,255,0.8); margin-bottom: 30px; }
#search-section .subtitle strong { color: var(--accent-yellow); font-weight: 600; }
.search-wrapper { position: relative; max-width: 700px; margin: 0 auto; }
#search-bar { width: 100%; padding: 18px 25px; font-size: 1.1rem; border-radius: 50px; border: 1px solid transparent; box-shadow: 0 5px 25px rgba(0,0,0,0.15); box-sizing: border-box; }
#search-bar:focus { outline: none; border-color: var(--accent-yellow); }
.search-toggle { display: flex; justify-content: center; margin-bottom: 25px; background-color: rgba(0, 0, 0, 0.2); border-radius: 50px; padding: 5px; width: fit-content; margin-left: auto; margin-right: auto; }
.toggle-btn { padding: 10px 30px; border: none; background-color: transparent; color: rgba(255,255,255,0.7); font-weight: 600; border-radius: 50px; cursor: pointer; font-size: 1rem; transition: all 0.3s ease; }
.toggle-btn.active { background-color: var(--bg-white); color: var(--primary-blue); box-shadow: 0 2px 10px rgba(0,0,0,0.2); }

/* --- 4. Data Display & Key Changes Section --- */
#data-display-section, #key-changes-section { padding: 50px 0; }
.display-header { text-align: center; margin-bottom: 40px; }
.display-header h2 { font-size: 2.5rem; font-weight: 800; color: var(--primary-dark); margin-bottom: 10px; }
.display-header p { max-width: 600px; margin: 0 auto; }
.display-header button { background: var(--accent-yellow); border: none; color: var(--primary-dark); padding: 10px 20px; border-radius: 8px; cursor: pointer; font-weight: 600; transition: all 0.2s ease; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.display-header button:hover { background-color: #ffc400; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
/* Category Grid */
#category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; padding: 0 5%; }
.category-card { background-color: var(--bg-white); border-radius: 12px; padding: 25px; text-align: center; font-weight: 600; color: var(--primary-blue); cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border: 1px solid var(--border-color);justify-content: center; align-items: center; display: flex;}
.category-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); background-color: var(--primary-blue); color: var(--bg-white); }
/* Styles for special category types */
.category-card.category-card-nil { background-color: #eceff1; color: #37474f; border-color: #cfd8dc; }
.category-card.category-card-exempt { background-color: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
.category-card.category-card-cess { background-color: #fff8e1; color: #e65100; border-color: #ffcc80; }
.category-card.category-card-info { background-color: #e3f2fd; color: #1565c0; border-color: #90caf9; }


/* NEW: Accordion Styles */
.accordion { max-width: 800px; margin: 0 auto; }
.accordion details {
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.2s ease-out;
}
.accordion details[open] { border-color: var(--primary-blue); }
.accordion summary {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1.2rem;
    cursor: pointer;
    list-style: none; /* Remove default marker */
    position: relative;
}
.accordion summary::after { /* Custom arrow */
    content: '▼';
    position: absolute;
    right: 1.2rem;
    font-size: 0.8em;
    transition: transform 0.2s ease-out;
}
.accordion details[open] summary::after { transform: rotate(180deg); }
.accordion .accordion-content {
    padding: 0 1.2rem 1.2rem 1.2rem;
    border-top: 1px solid var(--border-color);
}
.accordion .accordion-content p { margin: 0; }


/* --- 5. Item Card Design --- */
.item-list-grid { display: grid; grid-template-columns: 1fr; gap: 15px; padding: 0 5%; }
.item-card {
    display: grid;
    grid-template-columns: 1fr auto auto; 
    gap: 20px;
    align-items: center;
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease-in-out;
}
.item-card:hover { transform: scale(1.02); box-shadow: 0 8px 30px rgba(0,0,0,0.1); }
.item-card-info { grid-column: 1; }
.item-card-rates { grid-column: 2; }
.rate-badge { grid-column: 3; }
.item-card-info .item-name { font-size: 1.1rem; font-weight: 600; color: var(--primary-dark); margin: 0 0 4px 0; overflow-wrap: break-word; }
.item-card-info .item-code { font-size: 0.85rem; color: var(--text-light); }
.item-category-tag {
    display: inline-block;
    margin-top: 8px;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: var(--bg-main);
    color: var(--text-light);
    border-radius: 20px;
    border: 1px solid var(--border-color);
}
.item-ratetype-tag {
    display: inline-block;
    margin-top: 8px;
    margin-left: 5px; /* Adds space next to the category tag */
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #fff8e1; /* Same as cess category card */
    color: #e65100;
    border-radius: 20px;
    border: 1px solid #ffcc80;
}
.item-card-rates { display: flex; align-items: center; gap: 12px; background-color: var(--bg-main); padding: 8px 16px; border-radius: 8px; }
.item-card-rates .rate { font-size: 1.4rem; font-weight: 700; }
.item-card-rates .rate-old { color: var(--text-light); }
.item-card-rates .rate-new { color: var(--primary-blue); }
.item-card-rates .rate-arrow { font-size: 1.2rem; color: var(--text-light); }
.rate-badge { padding: 4px 10px; border-radius: 20px; font-size: 0.9rem; font-weight: 600; color: #fff; min-width: 90px; text-align: center; }
.rate-badge.increase { background-color: var(--increase-color); }
.rate-badge.decrease { background-color: var(--decrease-color); }
.rate-badge.no-change { background-color: var(--no-change-color); }
.item-notes, .item-condition { grid-column: 1 / -1; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-color); font-size: 0.9em; color: var(--text-light); }
.item-card-rates.variable-rate { flex-direction: column; align-items: flex-start; gap: 5px; }
.item-card-rates.variable-rate .rate-arrow { display: none; }
.item-card-rates.variable-rate .rate { font-size: 0.95rem; font-weight: 500; line-height: 1.4; }
.truncated-text { cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-decoration-color: var(--primary-blue); color: var(--primary-blue); }
.truncated-text:hover { color: #0b3a8d; }

/* --- 6. Brand Promotion & Footer --- */
#brand-promo { background-color: var(--bg-white); padding: 80px 0; border-top: 1px solid var(--border-color); }
#brand-promo h2, #brand-promo .section-subtitle { text-align: center; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; }
.product-card { background-color: var(--bg-main); border: 1px solid var(--border-color); border-radius: 12px; padding: 2.5rem 2rem; display: flex; flex-direction: column; transition: all 0.3s ease; }
.product-card:hover { transform: translateY(-8px); box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.product-title { font-size: 1.5rem; font-weight: 600; color: var(--primary-dark); margin-bottom: 1rem; }
.product-description { flex-grow: 1; margin-bottom: 2rem; }
.product-cta { display: inline-block; background-color: var(--primary-blue); color: var(--bg-white); padding: 12px 24px; border-radius: 8px; text-decoration: none; font-weight: 500; text-align: center; transition: background-color 0.2s ease; }
.product-cta:hover { background-color: #0b3a8d; }
footer { text-align: center; padding: 40px 20px; background-color: var(--primary-dark); color: #a0aec0; }
.footer-tagline { font-size: 0.9em; margin-top: 10px; }
footer strong { color: var(--bg-white); }
.footer-disclaimer { font-size: 0.9em; color: #a0aec0; max-width: 1200px; margin: 0 auto 20px auto; }
.footer-link { color: var(--bg-white); text-decoration: underline; }
.footer-link:hover { color: var(--accent-yellow); }
.fade-in-section { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.fade-in-section.is-visible { opacity: 1; transform: translateY(0); }
.visit-counter { margin-top: 20px; padding-top: 20px; border-top: 1px solid #4a5568; font-size: 0.9em; color: #a0aec0; }
#visit-counter { font-weight: bold; color: var(--bg-white); }
.modal { display: none; position: fixed; z-index: 1001; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); align-items: center; justify-content: center; }
.modal.visible { display: flex; }
.modal-content { background-color: #fff; margin: auto; padding: 30px; border: 1px solid #888; width: 80%; max-width: 600px; border-radius: 12px; position: relative; box-shadow: 0 5px 25px rgba(0,0,0,0.2); animation: fadeInModal 0.3s ease-out; }
@keyframes fadeInModal { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.close-button { color: #aaa; position: absolute; top: 10px; right: 20px; font-size: 28px; font-weight: bold; cursor: pointer; }
.close-button:hover, .close-button:focus { color: black; }
#modal-title { margin-top: 0; color: var(--primary-blue); }
#modal-text { line-height: 1.7; }
#modal-text ul { padding-left: 20px; }
#modal-text li { margin-bottom: 10px; }
/* Style for HSN/SAC codes inside the tariff list modal */
#modal-text ul li span {
    font-weight: 600;
    color: var(--primary-blue);
}
/* --- Additions for Grouped Search Results --- */
.result-group-container {
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    overflow: hidden; /* Ensures child borders don't poke out */
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
    
}

.item-card.primary-result {
    border: none;
    box-shadow: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    margin-bottom: 0;
    
}
/* 2. Apply the hover effect to the whole result group */
.result-group-container:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

/* 3. Disable the original hover on the inner card to prevent a double-effect */
.result-group-container:hover .item-card.primary-result {
    transform: none;
    box-shadow: none;
}

/* --- NEW: Style for the link inside an item-card --- */
.view-item-tariffs-link {
    grid-column: 1 / -1; /* Make it span the full width */
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-style: dotted;
    color: var(--primary-blue);
    cursor: pointer;
    text-align: right;
    margin-top: 8px;
}
.view-item-tariffs-link:hover {
    color: #0b3a8d;
}
.tariff-examples-list {
    padding: 15px 20px;
    background-color: var(--bg-main);
}

.examples-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 10px 0;
}

.tariff-examples-list ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.tariff-examples-list li {
    font-size: 0.9rem;
    color: var(--text-light);
    padding: 6px 0;
    border-bottom: 1px dashed #e0e0e0;
}

.tariff-examples-list li:last-child {
    border-bottom: none;
}

.tariff-examples-list li span {
    font-weight: 500;
    color: var(--primary-blue);
    display: inline-block;
    width: 110px; /* Aligns descriptions */
}

/* --- UPDATED Styles for Pagination --- */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 40px;
    flex-wrap: wrap; /* Allows wrapping on small screens */
}

.pagination-btn {
    background-color: #fff;
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    margin: 0 4px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 0.9em;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #fff;
}

.pagination-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* NEW: Style for the currently active page number */
.pagination-btn.active {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
    color: #fff;
    cursor: default;
}

/* NEW: Style for the ellipsis (...) */
.pagination-ellipsis {
    padding: 0 8px;
    font-weight: 600;
    color: var(--text-light);
}

/* Remove the old page indicator style if it exists */
.page-indicator {
    display: none;
}

/* --- Style for 'Show More' link in search results --- */
.show-more-examples {
    display: block;
    padding: 10px 0 5px 0;
    text-align: center;
    font-weight: 600;
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 0.9em;
    cursor: pointer;
    background-color: var(--bg-main);
}
.show-more-examples:hover {
    text-decoration: underline;
}

/* --- Style for highlighting search matches --- */
/* --- DEFINITIVE FIX for highlight style override --- */
.highlight {
    display: inline !important;
    background-color: var(--accent-yellow) !important;
    color: var(--primary-dark) !important;
    font-weight: normal !important;
    padding: 1px 1px !important;
    border-radius: 3px !important;
}
/* --- 7. Responsive Design --- */
@media (max-width: 768px) {
    #search-section h1 { font-size: 2.2rem; }
    .company-name { font-size: 1rem; }
    header nav a:nth-child(1), header nav a:nth-child(2) { display: none; }
    header nav a { margin-left: auto; padding: 8px 12px; background-color: var(--primary-blue); color: var(--bg-white); border-radius: 6px; }
    header nav a:hover { color: var(--primary-blue); background-color: var(--border-color); }
    .item-card { grid-template-columns: 1fr; gap: 15px; text-align: left; }
    .item-card-info, .item-card-rates, .rate-badge { grid-column: 1 / -1; }
    .item-card-rates { justify-content: center; }
    .rate-badge { margin: 0 auto; }
}