/* =========================================
   1. GLOBAL VARIABLES & RESET
   ========================================= */
:root {
    --bg-main: #0b141b;          /* Dark Background */
    --bg-card: #1c2b36;          /* Card Background */
    --bg-header: #132029;        /* Header Background */
    --accent-cyan: #00c2ff;      /* Primary Blue/Cyan */
    --text-white: #ffffff;
    --text-gray: #94a3b8;
    --border-color: #2d3d4a;
    --font-family: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-white);
    font-family: var(--font-family);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* =========================================
   2. HEADER & SEARCH BAR
   ========================================= */
.main-header {
    background-color: var(--bg-header);
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 35px;
    display: block;
}

.search-container {
    flex: 0.5;
    display: flex;
    background: #0f171e;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px 12px;
}

.search-container input {
    background: transparent;
    border: none;
    color: white;
    width: 100%;
    outline: none;
    padding: 5px;
}

.search-btn {
    background: transparent;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
}

/* =========================================
   3. NEWEST COUPONS (FEATURED SLIDER)
   ========================================= */
.section-newest {
    margin: 40px 0;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 25px;
    font-weight: 700;
}

.featured-slider {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.featured-card {
    min-width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    padding: 15px;
    gap: 15px;
}

.featured-img-box {
    width: 80px;
    height: 80px;
    background: #0f171e;
    border-radius: 12px;
    flex-shrink: 0;
    overflow: hidden;
}

.featured-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-content h3 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.featured-content p {
    color: var(--text-gray);
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.featured-content .btn-cyan {
    padding: 8px 15px;
    font-size: 0.85rem;
}

/* =========================================
   4. ALL COUPONS GRID (FIXES THE MESSY LOOK)
   ========================================= */
.coupons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    min-height: 400px; /* Prevents layout collapse while loading */
}

.coupon-card {
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* IMAGE PROTECTION: This fixes the overlap problem */
.card-banner {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; /* Mandatory aspect ratio */
    background: #0f171e;  /* Box shows even if img is broken */
}

.banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rating-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: #fbbf24;
    z-index: 2;
}

.brand-icon-wrapper {
    position: absolute;
    bottom: -25px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 12px;
    border: 4px solid var(--bg-card);
    padding: 5px;
    z-index: 3;
}

.brand-icon-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* CARD DETAILS */
.card-details {
    padding: 40px 20px 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-details h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.brand-name {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.offer-badge {
    background: rgba(0, 194, 255, 0.05);
    border: 2px dashed #2d3d4a;
    color: var(--accent-cyan);
    padding: 10px;
    text-align: center;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.stock-info {
    background: rgba(0, 194, 255, 0.1);
    color: var(--accent-cyan);
    text-align: center;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.8rem;
    margin-bottom: 15px;
}

/* =========================================
   5. COMMON COMPONENTS & BUTTONS
   ========================================= */
.btn-cyan {
    background: var(--accent-cyan);
    color: #000;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: 0.2s;
    text-decoration: none;
    display: block;
    text-align: center;
}

.btn-cyan:hover {
    background: #00a8dd;
    transform: translateY(-2px);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 50px 0;
}

.page-num, .page-arrow {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
}

.page-num.active {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
}

/* FOOTER */
.main-footer {
    padding: 60px 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-logo {
    height: 35px;
    margin-bottom: 20px;
}

.footer-desc {
    color: var(--text-gray);
    font-size: 0.9rem;
    max-width: 600px;
    margin: 0 auto 25px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.social-links img {
    width: 32px;
    opacity: 0.8;
}

/* LOADING STATES */
.loading-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 100px;
    color: var(--text-gray);
    font-style: italic;
}