:root {
    --primary: #e53935;
    --primary-dark: #c62828;
    --secondary: #1565c0;
    --bg: #f5f5f5;
    --bg-white: #ffffff;
    --bg-alt: #fafafa;
    --text: #212121;
    --text-light: #757575;
    --text-muted: #9e9e9e;
    --border: #e0e0e0;
    --success: #43a047;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
}

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

.hidden { display: none !important; }

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

a { color: var(--secondary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Navbar */
.navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}

.logo-icon { font-size: 1.5rem; }

.nav-search {
    flex: 1;
    max-width: 400px;
    display: flex;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color .2s;
}

.nav-search:focus-within { border-color: var(--primary); }

.nav-search input {
    flex: 1;
    padding: 8px 12px;
    border: none;
    outline: none;
    font-size: .95rem;
}

.nav-search button {
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
}

.nav-search button:hover { background: var(--primary-dark); }

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

.nav-links a {
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
}

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

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text);
}

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

.hero h1 { font-size: 2.2rem; margin-bottom: 8px; }
.hero-sub { font-size: 1.1rem; opacity: .9; margin-bottom: 30px; }

.hero-search {
    max-width: 550px;
    margin: 0 auto 25px;
    display: flex;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.hero-search input {
    flex: 1;
    padding: 14px 20px;
    border: none;
    outline: none;
    font-size: 1rem;
}

.hero-search button {
    padding: 14px 28px;
    background: var(--text);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
}

.hero-search button:hover { background: #333; }

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: .95rem;
    opacity: .9;
}

.hero-stats strong { display: block; font-size: 1.4rem; }

/* Sections */
.section { padding: 50px 0; }
.section-alt { background: var(--bg-white); }

.section-title {
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--text);
}

.section-cta { text-align: center; margin-top: 30px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    transition: all .2s;
    border: none;
    text-decoration: none;
}

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

.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover { background: var(--primary); color: white; text-decoration: none; }

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 15px;
    background: var(--bg-white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all .2s;
    text-decoration: none;
    color: var(--text);
}

.category-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    text-decoration: none;
}

.category-card i {
    font-size: 1.8rem;
    color: var(--primary);
}

.category-card span { font-weight: 500; font-size: .9rem; text-align: center; }

.category-grid-large { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.category-card-large {
    padding: 30px 20px;
}

.category-card-large h3 { font-size: 1rem; }

/* Shop Grid */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 15px;
}

.shop-grid-large { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.shop-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 25px 15px;
    background: var(--bg-white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all .2s;
    text-decoration: none;
    color: var(--text);
}

.shop-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    text-decoration: none;
}

.shop-card img,
.shop-favicon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 8px;
}

.shop-card h3 { font-size: .95rem; text-align: center; }

.shop-count {
    font-size: .8rem;
    color: var(--text-light);
    background: var(--bg);
    padding: 3px 10px;
    border-radius: 20px;
}

.shop-placeholder {
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 8px;
}

/* Page Header */
.page-header {
    background: var(--bg-white);
    padding: 30px 0;
    border-bottom: 1px solid var(--border);
}

.page-header h1 { font-size: 1.6rem; margin-bottom: 5px; }
.page-header p { color: var(--text-light); }

.breadcrumb {
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.breadcrumb a { color: var(--text-light); }

.shop-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.shop-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px;
    background: white;
}

.shop-meta { color: var(--text-light); }

/* Voucher Cards */
.voucher-list { display: flex; flex-direction: column; gap: 12px; }

.voucher-card {
    display: flex;
    align-items: center;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all .2s;
    border-left: 4px solid var(--primary);
}

.voucher-card:hover {
    box-shadow: var(--shadow-hover);
}

.voucher-card.expired {
    border-left-color: var(--text-muted);
}

.voucher-card.upcoming {
    border-left-color: #ff9800;
}

.voucher-left {
    padding: 20px;
    min-width: 100px;
    text-align: center;
    border-right: 1px dashed var(--border);
}

.discount-amount {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.voucher-card.expired .discount-amount { color: var(--text-muted); }
.voucher-card.upcoming .discount-amount { color: #ff9800; }

.voucher-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.voucher-badge-expired { background: #ffebee; color: #c62828; }
.voucher-badge-upcoming { background: #fff3e0; color: #e65100; }

.discount-label {
    font-size: .75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.voucher-center {
    flex: 1;
    padding: 15px 20px;
    min-width: 0;
}

.voucher-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.4;
}

.voucher-desc {
    font-size: .85rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.voucher-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: .8rem;
}

.voucher-shop {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    color: var(--secondary);
}

.voucher-favicon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    object-fit: contain;
    flex-shrink: 0;
}

.voucher-date {
    color: var(--text-muted);
}

.voucher-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 20px;
    min-width: 160px;
}

/* Code Reveal */
.code-reveal {
    padding: 6px 16px;
    background: repeating-linear-gradient(90deg, var(--border) 0, var(--border) 6px, transparent 6px, transparent 10px);
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 700;
    font-size: .85rem;
    text-align: center;
    min-width: 130px;
    transition: all .2s;
    position: relative;
}

.code-reveal:hover {
    background: #fff3f3;
}

.code-reveal.revealed {
    background: #e8f5e9;
    border-color: var(--success);
    cursor: default;
}

.code-hidden { color: var(--primary); }

.code-value {
    color: var(--success);
    font-family: monospace;
    font-size: 1rem;
    letter-spacing: 1px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: var(--text-muted);
}

.empty-state p { margin-bottom: 20px; font-size: 1.1rem; }

.result-count {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: .9rem;
}

/* Footer */
.footer {
    background: #263238;
    color: #cfd8dc;
    padding: 50px 0 0;
    margin-top: 50px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 30px;
}

.footer h4 { color: white; margin-bottom: 15px; font-size: 1rem; }
.footer p { font-size: .85rem; line-height: 1.7; }

.footer ul { list-style: none; }
.footer li { margin-bottom: 6px; }
.footer a { color: #b0bec5; font-size: .85rem; }
.footer a:hover { color: white; }

.footer-bottom {
    border-top: 1px solid #37474f;
    margin-top: 30px;
    padding: 20px 0;
    text-align: center;
    font-size: .8rem;
    color: #78909c;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-search { display: none; }
    .nav-links { display: none; }
    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        padding: 15px 20px;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
    }
    .nav-toggle { display: block; margin-left: auto; }

    .hero h1 { font-size: 1.6rem; }
    .hero-stats { gap: 15px; font-size: .8rem; }
    .hero-stats strong { font-size: 1.1rem; }

    .voucher-card {
        flex-direction: column;
        align-items: stretch;
        border-left: none;
        border-top: 4px solid var(--primary);
    }
    .voucher-card.expired { border-top-color: var(--text-muted); }
    .voucher-card.upcoming { border-top-color: #ff9800; }

    .voucher-left {
        border-right: none;
        border-bottom: 1px dashed var(--border);
        padding: 12px;
    }

    .voucher-right {
        flex-direction: row;
        justify-content: center;
        padding: 12px;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .shop-header { flex-direction: column; align-items: flex-start; }

    .category-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .shop-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 480px) {
    .footer-grid { grid-template-columns: 1fr; }
    .hero { padding: 40px 0 30px; }
}
