/* style.css */
:root {
    --primary: #059669;
    --primary-dark: #047857;
    --bg-light: #f9fafb;
    --bg-card: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Roboto', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.5;
}

/* Header & Nav */
.main-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.logo img {
    height: 40px;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--primary);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 60px 24px;
    text-align: center;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 32px;
}

/* Carousel Section */
.carousel-section {
    max-width: 1400px;
    margin: 32px auto 0;
    padding: 0 24px;
}

.carousel-title {
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: var(--text-main);
}

.carousel-3d-container {
    position: relative;
    width: 100%;
    height: 540px;
    perspective: 1000px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px 0;
}

.carousel-3d-track {
    position: relative;
    width: 380px;
    height: 420px;
    transform-style: preserve-3d;
}

.carousel-card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,1);
    padding: 24px;
    border: 1px solid rgba(209, 213, 219, 0.5);
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.6s ease;
    opacity: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.carousel-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0) 50%);
    pointer-events: none;
}

.carousel-card.active {
    opacity: 1;
    transform: translateX(0) translateZ(150px) rotateY(0);
    z-index: 10;
    pointer-events: auto;
    filter: blur(0);
    -webkit-box-reflect: below 15px linear-gradient(transparent, rgba(0,0,0,0.1));
}

.carousel-card.prev {
    opacity: 0.6;
    transform: translateX(-90%) translateZ(-150px) rotateY(40deg);
    z-index: 5;
    filter: blur(3px);
    cursor: pointer;
    pointer-events: auto;
}

.carousel-card.next {
    opacity: 0.6;
    transform: translateX(90%) translateZ(-150px) rotateY(-40deg);
    z-index: 5;
    filter: blur(3px);
    cursor: pointer;
    pointer-events: auto;
}

.carousel-card.prev2 {
    opacity: 0.2;
    transform: translateX(-150%) translateZ(-400px) rotateY(55deg);
    z-index: 4;
    filter: blur(6px);
}

.carousel-card.next2 {
    opacity: 0.2;
    transform: translateX(150%) translateZ(-400px) rotateY(-55deg);
    z-index: 4;
    filter: blur(6px);
}

/* Hide buttons on non-active cards */
.carousel-card:not(.active) .carousel-btn-group {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}


.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 1px solid var(--border);
    color: var(--primary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.carousel-nav-btn:hover {
    background: var(--primary);
    color: white;
}

.carousel-nav-btn.prev-btn { left: 20px; }
.carousel-nav-btn.next-btn { right: 20px; }

@media (max-width: 768px) {
    .carousel-card.prev { transform: translateX(-50%) translateZ(-150px) rotateY(20deg); }
    .carousel-card.next { transform: translateX(50%) translateZ(-150px) rotateY(-20deg); }
    .carousel-card.prev2 { transform: translateX(-80%) translateZ(-300px) rotateY(30deg); opacity: 0; }
    .carousel-card.next2 { transform: translateX(80%) translateZ(-300px) rotateY(-30deg); opacity: 0; }
}

.carousel-badge {
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--primary);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.carousel-card img {
    height: 160px;
    object-fit: contain;
    margin: 10px 0;
    transition: transform 0.3s ease;
}

.carousel-card.active img {
    transform: scale(1.05);
}

.carousel-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.carousel-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Search & Filters */
.controls-section {
    max-width: 1400px;
    margin: -24px auto 32px;
    padding: 0 24px;
    position: relative;
    z-index: 10;
}

.controls-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
}

.search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.filter-btn:hover {
    background: var(--bg-light);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Bento Grid */
.bento-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px 60px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.bento-card {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.bento-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}

.card-header {
    height: 180px;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.card-image {
    max-height: 100px;
    object-fit: contain;
}

.card-badges {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
}

.badge {
    background: rgba(255,255,255,0.9);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bank-badge { color: var(--primary-dark); }
.rating-badge { color: #d97706; }

.card-body {
    padding: 20px;
    flex: 1;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-main);
}

.card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.stat {
    display: flex;
    flex-direction: column;
    background: var(--bg-light);
    padding: 8px;
    border-radius: 8px;
}

.stat.highlight {
    grid-column: span 2;
    background: #fef3c7;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 600;
}

.card-features ul {
    list-style: none;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.card-features li {
    margin-bottom: 4px;
}

.card-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.apply-btn {
    background: var(--primary);
    color: white;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
}

.apply-btn:hover { background: var(--primary-dark); }
.apply-btn.large { grid-column: span 1; padding: 14px; font-size: 1.1rem; }

.card-footer .apply-btn {
    grid-column: span 2;
    font-size: 0.9rem;
    padding: 12px 10px;
}

.details-btn {
    background: var(--bg-light);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.details-btn:hover { background: #e5e7eb; }

.refer-btn {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.refer-btn:hover { background: #bfdbfe; }

/* AdSense Slots */
.adsense-leaderboard {
    max-width: 1000px;
    margin: 24px auto;
    text-align: center;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.in-feed-ad {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    min-height: 250px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal-container {
    background: var(--bg-card);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-details h3 {
    margin: 24px 0 12px;
    color: var(--primary);
}

.modal-details ul {
    padding-left: 20px;
    margin-bottom: 16px;
}

.modal-details li { margin-bottom: 8px; }

.benefits-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.benefits-tags .badge {
    background: #d1fae5;
    color: #065f46;
}

.modal-action {
    padding: 24px;
    border-top: 1px solid var(--border);
}

/* Footer */
.main-footer {
    background: white;
    padding: 40px 24px;
    text-align: center;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-links a:hover { color: var(--primary); }

@media (max-width: 768px) {
    .nav-links { display: none; }
    .hero h1 { font-size: 2rem; }
    .controls-card { padding: 16px; }
}

/* AdSense Auto-Collapse Rules to Prevent Blank Gaps */
.adsense-leaderboard,
.adsense-slot,
.adsense-slot.in-feed-ad {
    margin: 20px auto;
    width: 100%;
    max-width: 100%;
    text-align: center;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* If the slot has no content, hide it completely */
.adsense-leaderboard:empty,
.adsense-slot:empty,
.adsense-slot.in-feed-ad:empty {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* If the Google Ad Ins element is empty or has not been filled, collapse it */
.adsense-leaderboard ins:not([data-ad-status="filled"]),
.adsense-slot ins:not([data-ad-status="filled"]) {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Collapse parent container if it has a placeholder AdSense client ID or is unfilled */
.adsense-leaderboard:has(ins[data-ad-client="ca-pub-XXXXXXXXXXXXX"]),
.adsense-slot:has(ins[data-ad-client="ca-pub-XXXXXXXXXXXXX"]),
.adsense-leaderboard:has(ins:not([data-ad-status="filled"])),
.adsense-slot:has(ins:not([data-ad-status="filled"])) {
    display: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

