/* OhMyPoints – Mobile-first responsive styles */

:root {
    --primary: #6B46C1;
    --primary-dark: #5a3aa3;
    --secondary: #3182CE;
    --bg: #f7fafc;
    --card-bg: #fff;
    --text: #2d3748;
    --text-muted: #718096;
    --border: #e2e8f0;
    --error: #e53e3e;
    --success: #38a169;
    --warning: #d69e2e;
    --tier-bronze: #CD7F32;
    --tier-silver: #C0C0C0;
    --tier-gold: #FFD700;
    --tier-vip: #9B59B6;
    --header-height: 56px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 12px rgba(107, 70, 193, 0.15);
}

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

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: var(--header-height);
    padding: 0 1rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary);
    text-decoration: none;
}
.logo:hover {
    text-decoration: none;
    color: var(--primary-dark);
}
.logo-img {
    display: block;
    height: 40px;
    width: auto;
    object-fit: contain;
}

.nav-main {
    display: none; /* hidden on mobile until menu is opened */
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
@media (min-width: 768px) {
    .nav-main {
        display: flex;
    }
}

.nav-main a {
    color: var(--text);
    font-size: 0.9375rem;
}
.nav-main a:hover {
    color: var(--primary);
}

.filter-bar {
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: var(--header-height);
    z-index: 99;
}
.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.filter-btn {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    color: var(--text);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.filter-btn:hover {
    background: var(--bg);
    border-color: var(--primary);
}
.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}
.menu-toggle::before {
    content: '';
    width: 22px;
    height: 2px;
    background: var(--text);
    box-shadow: 0 6px 0 var(--text), 0 12px 0 var(--text);
    transition: opacity 0.2s, transform 0.2s;
}
.menu-toggle {
    position: relative;
}
/* Open state: show X instead of hamburger */
.nav-open .menu-toggle::before {
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -10px;
    margin-top: -1px;
    width: 20px;
    height: 2px;
    box-shadow: none;
    background: var(--text);
    transform: rotate(45deg);
}
.nav-open .menu-toggle::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -10px;
    margin-top: -1px;
    width: 20px;
    height: 2px;
    background: var(--text);
    transform: rotate(-45deg);
}
@media (min-width: 768px) {
    .menu-toggle {
        display: none;
    }
}

/* Mobile nav overlay – visible only when .nav-open */
.nav-open .nav-main {
    display: flex;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 1.5rem 1rem;
    background: var(--card-bg);
    gap: 0;
    z-index: 99;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.nav-open .nav-main a {
    padding: 0.875rem 0;
    font-size: 1.0625rem;
    border-bottom: 1px solid var(--border);
}
.nav-open .nav-main a:last-child {
    border-bottom: none;
}
@media (min-width: 768px) {
    .nav-open .nav-main {
        position: static;
        flex-direction: row;
        padding: 0;
        background: transparent;
    }
}

/* Main content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* Hero */
.hero {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
    margin-bottom: 1.5rem;
}
.hero h1 {
    margin: 0 0 0.5rem;
    font-size: 2rem;
}
.hero-tagline {
    margin: 0;
    font-size: 1.125rem;
    opacity: 0.95;
}

/* Deal cards grid */
.deals-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}
@media (min-width: 600px) {
    .deals-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 1024px) {
    .deals-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.deal-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.deal-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    text-decoration: none;
}
.deal-card:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.deal-card-image {
    aspect-ratio: 4/3;
    overflow: hidden;
    background: var(--border);
}
.deal-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.deal-card-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.deal-card-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.deal-card-title {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.3;
}

.deal-card-vendor {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.deal-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.5rem;
}
.deal-card-meta .points {
    font-weight: 600;
    color: var(--primary);
}
.deal-card-meta .discount {
    font-size: 0.875rem;
    color: var(--success);
}

/* Hide by category (JS filter) */
.deal-card.hidden {
    display: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.2s, color 0.2s;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}
.btn-ghost {
    background: transparent;
    color: var(--text);
}
.btn-ghost:hover {
    background: var(--bg);
    color: var(--text);
}
.btn-block {
    width: 100%;
}
.btn-wallet {
    background: #333;
    color: #fff;
    font-size: 0.875rem;
    padding: 0.4rem 0.75rem;
}
.btn-wallet:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Login page */
.page-login .main-content {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-height));
}

.login-card {
    width: 100%;
    max-width: 360px;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.login-card h1 {
    margin: 0 0 1.25rem;
    font-size: 1.5rem;
}

.form-login label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}
.form-login label:first-of-type {
    margin-top: 0;
}
.form-login input[type="email"],
.form-login input[type="password"] {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}
.form-login .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-weight: normal;
}
.form-login .forgot-link {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}
.form-login .btn-block {
    margin-top: 1.25rem;
}

/* Messages */
.message {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.message-error {
    background: #fed7d7;
    color: #c53030;
}
.message-success {
    background: #c6f6d5;
    color: #276749;
}
.message-warning {
    background: #fefcbf;
    color: #975a16;
}

/* Dashboard */
.page-dashboard h1 {
    margin: 0 0 1rem;
    font-size: 1.5rem;
}

.tier-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.tier-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: var(--tier-color, var(--tier-bronze));
    margin-bottom: 0.5rem;
}

.points-display {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}
.tier-next {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.quick-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat {
    padding: 1rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}
.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.active-deals-section h2 {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
}
.deal-list-mini {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}
.deal-list-mini li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.deal-list-mini li:last-child {
    border-bottom: none;
}
.deal-list-mini .expires {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.empty-state {
    color: var(--text-muted);
    margin: 0 0 1rem;
}

/* Deal detail page */
.deal-detail .deal-article {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.deal-detail-image {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--border);
}
.deal-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.deal-detail-body {
    padding: 1.5rem;
}
.deal-vendor-info {
    margin-bottom: 1rem;
}
.vendor-logo-small {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}
.deal-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}
.deal-detail-body h1 {
    margin: 0.25rem 0 0.5rem;
    font-size: 1.5rem;
}
.vendor-name {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--text-muted);
}
.deal-description {
    margin: 0 0 1rem;
}
.deal-meta-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}
.points-badge {
    font-weight: 600;
    color: var(--primary);
}
.discount-badge {
    color: var(--success);
}
.deal-terms h3 {
    margin: 0 0 0.5rem;
    font-size: 0.9375rem;
}
.deal-terms p {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.valid-until {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
}

.claimed-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.claimed-section h3 {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
}
.show-to-vendor {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
}
.qr-wrap {
    display: inline-block;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}
.qr-image {
    width: 180px;
    height: 180px;
    display: block;
}
.qr-placeholder {
    width: 180px;
    height: 180px;
    background: var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.expires-at {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
}
.wallet-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.claim-form {
    margin-top: 1rem;
}

/* My deals page */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.filter-tab {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.filter-tab:hover {
    background: var(--bg);
}
.filter-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.my-deals-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.my-deal-item {
    margin-bottom: 1rem;
}
.my-deal-item.hidden {
    display: none;
}
.my-deal-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.my-deal-info {
    flex: 1;
    min-width: 0;
}
.my-deal-title {
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}
.my-deal-vendor {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0 0 0.25rem;
}
.my-deal-expires {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-used {
    background: #c6f6d5;
    color: #276749;
}
.badge-expired {
    background: #fed7d7;
    color: #c53030;
}
.my-deal-qr {
    flex-shrink: 0;
}
.qr-thumb {
    width: 80px;
    height: 80px;
    object-fit: contain;
}
.qr-thumb.qr-placeholder {
    width: 80px;
    height: 80px;
    font-size: 0.75rem;
}

/* 404 */
.page-404 .main-content {
    text-align: center;
    padding-top: 3rem;
}
.page-404 h1 {
    margin: 0 0 0.5rem;
}
.page-404 .btn {
    margin-top: 1rem;
}
