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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    padding: 20px 0;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.header .subtitle {
    font-size: 16px;
    opacity: 0.9;
}

.card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card h2 {
    font-size: 20px;
    margin-bottom: 12px;
    color: #333;
}

.card p {
    color: #666;
    margin-bottom: 16px;
    line-height: 1.5;
}

.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f3f4f6;
    color: #333;
}

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

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    width: auto;
    display: inline-block;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 14px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #667eea;
}

.input-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #666;
}

/* Radio buttons */
.radio-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.3s;
    flex: 1;
    min-width: 85px;
    justify-content: center;
    background: white;
}

.radio-label:hover {
    border-color: #667eea;
    background: #f9fafb;
}

.radio-label input[type="radio"] {
    margin: 0;
    width: auto;
    padding: 0;
}

.radio-label input[type="radio"]:checked {
    accent-color: #667eea;
}

.radio-label span {
    font-size: 14px;
    font-weight: 500;
}

.radio-label input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: 600;
}

/* Checkbox */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    transition: all 0.3s;
}

.checkbox-label:hover {
    border-color: #667eea;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 2px;
    min-width: 20px;
    min-height: 20px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

.checkbox-label span {
    line-height: 1.5;
    font-size: 14px;
}

.checkbox-label a {
    color: #667eea;
    text-decoration: underline;
    font-weight: 600;
}

.footer {
    margin-top: auto;
    padding: 20px 0;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    font-size: 14px;
    opacity: 0.9;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

.user-info {
    background: #f9fafb;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.user-info h3 {
    font-size: 18px;
    margin-bottom: 4px;
    color: #333;
}

.user-info p {
    color: #666;
    font-size: 14px;
    margin: 0;
}

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

.stat-card {
    background: #f9fafb;
    padding: 16px;
    border-radius: 12px;
    text-align: center;
}

.stat-card .number {
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 4px;
}

.stat-card .label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reward-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
}

.reward-item .info {
    flex: 1;
}

.reward-item .number {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

.reward-item .date {
    font-size: 12px;
    color: #666;
}

.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

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

.badge-redeemed {
    background: #e5e7eb;
    color: #6b7280;
}

.visit-item {
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.visit-item .date {
    font-weight: 600;
    color: #333;
}

.visit-item .time {
    color: #666;
    font-size: 14px;
}

.visit-source {
    font-size: 12px;
    color: #667eea;
    margin-left: 8px;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.alert {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

#scannerModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

#scannerModal.active {
    display: flex;
}

#scannerContainer {
    width: 90%;
    max-width: 500px;
    background: white;
    border-radius: 16px;
    padding: 20px;
    position: relative;
}

#reader {
    border-radius: 8px;
    overflow: hidden;
}

.close-scanner {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

/* Admin styles */
.admin-search {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
}

.admin-results {
    background: white;
    border-radius: 16px;
    padding: 24px;
}

.reward-admin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
}

.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: white;
    padding: 12px;
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.users-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.table-header {
    padding: 16px;
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
}

.user-row {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-row:hover {
    background: #f9fafb;
}

.user-row:last-child {
    border-bottom: none;
}

.user-row-main {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    margin-bottom: 4px;
}

.user-phone {
    font-size: 14px;
    color: #666;
}

.user-row-stats {
    display: flex;
    gap: 16px;
}

.stat-small {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stat-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #667eea;
}

.user-row-arrow {
    font-size: 20px;
    color: #667eea;
    font-weight: 700;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover,
.close:focus {
    color: #333;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #333;
}

/* Mobile-first responsive design */
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 12px;
    }
    
    .header {
        padding: 16px 0;
        margin-bottom: 20px;
    }
    
    .header h1 {
        font-size: 22px;
    }
    
    .header .subtitle {
        font-size: 14px;
    }
    
    .card {
        padding: 16px;
        margin-bottom: 12px;
    }
    
    .input-group input,
    .input-group select,
    .btn {
        min-height: 44px;
        font-size: 16px;
    }
    
    .input-group label {
        font-size: 14px;
    }
    
    .radio-group {
        gap: 6px;
    }
    
    .radio-label {
        min-width: 75px;
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .user-row {
        padding: 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .user-row-stats {
        flex-direction: row;
        gap: 12px;
        width: 100%;
        justify-content: space-around;
    }
    
    .user-row-arrow {
        display: none;
    }
    
    .stat-small {
        text-align: center;
        min-width: 60px;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .reward-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .admin-tabs {
        flex-direction: column;
        gap: 8px;
    }
    
    .tab-btn {
        width: 100%;
    }
    
    .checkbox-label {
        padding: 10px;
    }
    
    .checkbox-label input[type="checkbox"] {
        min-width: 18px;
        min-height: 18px;
        width: 18px;
        height: 18px;
    }
}

/* Tablet breakpoint */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        max-width: 600px;
        padding: 24px;
    }
    
    .radio-group {
        justify-content: center;
    }
    
    .radio-label {
        min-width: 110px;
    }
}

/* Desktop breakpoint */
@media (min-width: 769px) {
    .container {
        max-width: 600px;
    }
    
    .radio-label {
        flex: 0 1 auto;
        min-width: 120px;
    }
}
