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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    color: #1a1a1a;
    background: #f5f5f5;
}

/* Navbar */

.navbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1a1a1a;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1rem;
    margin-left: auto;
}

.nav-links a {
    color: #555;
    text-decoration: none;
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: #1a1a1a;
}

.nav-links a.active {
    color: #2563eb;
    font-weight: 600;
}

.nav-logout {
    color: #999 !important;
}

/* Container */

.container {
    max-width: 600px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

/* Flash messages */

.flash-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

/* Search form */

.search-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-form input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}

.search-form button {
    padding: 0.75rem 1.2rem;
    border: none;
    border-radius: 6px;
    background: #2563eb;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

.search-form button:hover {
    background: #1d4ed8;
}

/* Results */

.results {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-card {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-decoration: none;
    color: #1a1a1a;
}

.result-card:hover {
    border-color: #2563eb;
}

.result-card span {
    font-size: 0.85rem;
    color: #777;
}

.no-results {
    color: #777;
    text-align: center;
    padding: 2rem 0;
}

.hint {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 1rem 0;
}

/* Card */

.card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.card h1 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.card-details {
    margin-bottom: 0.5rem;
}

.card-detail {
    color: #555;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.card section {
    margin-top: 1.25rem;
}

.card h2 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.25rem;
}

/* Warning badge (missing birthday etc.) */

.warning-badge {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Discount card chips */

.card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0.85rem;
    background: #f5f5f5;
    border: 2px solid #d0d0d0;
    border-radius: 10px;
    text-decoration: none;
    color: #1a1a1a;
    text-align: center;
}

.card-chip:hover {
    border-color: #2563eb;
    background: #eef4ff;
}

/* Card color coding by type */
.card-chip--bonus { border-color: #60a5fa; background: #eff6ff; }
.card-chip--discount { border-color: #a78bfa; background: #f5f3ff; }
.card-chip--gold { border-color: #f59e0b; background: #fffbeb; }
.card-chip--vip { border-color: #e11d48; background: #fff1f2; }
.card-chip--staff { border-color: #6b7280; background: #f9fafb; }

.card-chip--selected {
    box-shadow: 0 0 0 2px #2563eb;
}

.card-chip--inactive {
    opacity: 0.45;
    border-style: dashed;
}

.card-chip__type {
    font-weight: 600;
    font-size: 0.75rem;
    white-space: nowrap;
}

.card-chip__number {
    font-size: 0.8rem;
    color: #555;
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    white-space: nowrap;
}

.card-chip__total {
    font-size: 0.7rem;
    color: #777;
    margin-top: 0.15rem;
}

/* Customer header with total */
.customer-header {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.customer-header h1 {
    margin-bottom: 0;
}

.customer-total {
    font-size: 0.95rem;
    font-weight: 600;
    color: #2563eb;
    white-space: nowrap;
}

/* Receipts / Purchase history */

.receipt {
    margin-bottom: 1rem;
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
}

.receipt__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.receipt__date {
    color: #555;
}

.receipt__total {
    font-weight: 600;
}

/* Data tables */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    color: #555;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.data-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Image placeholder */

.image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 120px;
    background: #f0f0f0;
    border: 1px dashed #ccc;
    border-radius: 6px;
    color: #999;
    font-size: 0.9rem;
}

/* Back link */

.back-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: #2563eb;
    text-decoration: none;
    font-size: 0.95rem;
}

.back-link:hover {
    text-decoration: underline;
}

/* Login */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-form {
    width: 100%;
    max-width: 320px;
    text-align: center;
}

.login-form h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.login-form input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1.25rem;
    text-align: center;
    letter-spacing: 0.3em;
    margin-bottom: 1rem;
}

.login-form button {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    background: #2563eb;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
}

.login-form button:hover {
    background: #1d4ed8;
}

.error {
    color: #dc2626;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

/* Headings */

h1 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.birthday-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

.birthday-form input[type="date"] {
    padding: 0.4rem;
    border: 1px solid #fed7aa;
    border-radius: 4px;
    font-size: 0.9rem;
    background: #fff;
}

.birthday-form button {
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 4px;
    background: #ea580c;
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}

.birthday-form button:hover {
    background: #c2410c;
}

.text-muted {
    color: #888;
    font-size: 0.85em;
}

/* Mobile optimizations */

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
        margin: 0.75rem auto;
    }

    .card {
        padding: 1rem;
        border-radius: 6px;
    }

    .card h1 {
        font-size: 1.15rem;
    }

    /* Scrollable tables on mobile */
    .table-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.25rem;
        padding: 0 0.25rem;
    }

    .data-table {
        font-size: 0.8rem;
        min-width: 340px;
    }

    .data-table th,
    .data-table td {
        padding: 0.4rem 0.5rem;
    }

    /* Larger touch targets */
    .result-card {
        padding: 0.85rem 1rem;
    }

    .discount-card {
        padding: 0.85rem 1rem;
    }

    .search-form input {
        font-size: 16px; /* prevents iOS zoom on focus */
    }

    .login-form input {
        font-size: 18px;
    }

    /* Compact nav */
    .navbar {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .nav-links {
        gap: 0.75rem;
        font-size: 0.9rem;
    }

    /* Receipt headers */
    .receipt__header {
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }
}
