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

:root {
    --primary: #29166f;
    --success: #069b6a;
    --warning: #f59e0b;
    --danger: #d40000;
    --info: #3b82f6;
    --light: #f3f4f6;
    --dark: #1f2937;
    --border: #e5e7eb;
    --white: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f9fafb;
    color: #374151;
    line-height: 1.6;
}

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

p {
    padding: .5rem 0;
}

/* Header  */
header {
    background: #fff;
    color: #333;
    padding: .4rem 1.2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1360px;
    margin: 0 auto;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    z-index: 1500;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.user-btn {
    background: var(--light);
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.user-btn:hover {
    background: var(--light);
    color: var(--dark);
}

.icon {
    width: 24px;
    height: 24px;
    stroke: var(--dark);
    stroke-width: 2;
    fill: none;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Breadcrumbs */
.breadcrumb {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 0;
    flex-wrap: wrap;
}

.breadcrumb-item {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb-item:not(:last-child)::after {
    content: "/";
    margin-left: 0.5rem;
    color: #d1d5db;
}

.breadcrumb-item.active {
    color: var(--dark);
}



/* Welcome Section */
.welcome-section {
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.welcome-section h1 {
    margin-bottom: 0.5rem;
    color: white;
}

.welcome-section p {
    opacity: 0.9;
}

/* Masonry Grid Layout */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    grid-auto-rows: 20px;
    margin-bottom: 2rem;
}

/* Panel Base */
.panel {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Panel Sizes */
.panel-small { grid-row-end: span 10; }
.panel-medium { grid-row-end: span 15; }
.panel-large { grid-row-end: span 20; }
.panel-xlarge { grid-row-end: span 25; }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.panel-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.panel-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.25rem;
    color: white;
}

.badge-primary { background: var(--primary); }
.badge-success { background: var(--success); }
.badge-warning { background: var(--warning); }
.badge-danger { background: var(--danger); }
.badge-info { background: var(--info); }

/* Points Display */
.points-display {
    text-align: center;
    padding: 1rem 0;
}

.points-value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.points-label {
    color: #6b7280;
    font-size: 0.875rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--light);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--info));
}

/* Voucher Card */
.voucher-card {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    position: relative;
    overflow: hidden;
}

.voucher-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -10px;
    width: 20px;
    height: 20px;
    background: #f9fafb;
    border-radius: 50%;
    transform: translateY(-50%);
}

.voucher-card::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -10px;
    width: 20px;
    height: 20px;
    background: #f9fafb;
    border-radius: 50%;
    transform: translateY(-50%);
}

.voucher-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.voucher-expiry {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Button */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    width: 100%;
    text-align: center;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-info { background: var(--info); color: white; }

.btn-group {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Stats Item */
.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: #6b7280;
    font-size: 0.875rem;
}

.stat-value {
    font-weight: 600;
    color: var(--dark);
}

/* Achievement Badge */
.achievement {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--light);
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
}

.achievement-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.achievement-info {
    flex: 1;
}

.achievement-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.achievement-desc {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Responsive */
@media (max-width: 768px) {
    .masonry-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }
    
    .panel-small, .panel-medium, .panel-large, .panel-xlarge {
        grid-row-end: auto;
    }

    .welcome-section {
        padding: 1.5rem;
    }

    .points-value {
        font-size: 2.5rem;
    }
    
    .btn-group {
        flex-direction: column-reverse;
    }
    
    .btn-group .btn {
        width: 100%;
    }

}

@media (min-width: 769px) and (max-width: 1200px) {
    .masonry-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .header-container img {
        margin-left: 14px;
    }
    .header-container #userBtn {
        margin-right: 14px;
    }
}




/* Bottom Navigation */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0;
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    cursor: pointer;
    text-decoration: none;
    color: #757575;
}

.nav-item.active {
    color: #29166f;
}

.nav-icon {
    width: 24px;
    height: 24px;
    position: relative;
}

.nav-item.scan .nav-icon {
    width: 56px;
    height: 56px;
    background: var(--danger);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -28px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.nav-item.scan .nav-icon svg {
    width: 28px;
    height: 28px;
}

.nav-label {
    font-size: 12px;
    font-weight: 500;
}

.nav-item.scan .nav-label {
    margin-top: 4px;
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.alert.show {
    display: block;
}

.alert-success { background: #ecfdf5; border-color: var(--success); color: #065f46; }
.alert-danger { background: #fef2f2; border-color: var(--danger); color: #991b1b; }
.alert-info { background: #e6f0ff; border-color: var(--info); color: #274f90; }

.space {
    height: 5rem;
}


/* QR Scanner Modal */
.scanner-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    flex-direction: column;
}

.scanner-modal.active {
    display: flex;
}

.scanner-header {
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scanner-header h2 {
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 10px;
    right: 10px;
}

.scanner-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#video {
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    display: none;
}

#video.active {
    display: block;
}

.scanner-frame {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 20px auto;
}

.scanner-frame::before,
.scanner-frame::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid #29166f;
}

.scanner-frame::before {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
}

.scanner-frame::after {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
}

.scanner-frame .corner-bl,
.scanner-frame .corner-br {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid #29166f;
}

.scanner-frame .corner-bl {
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: none;
}

.scanner-frame .corner-br {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
}

.scanner-instruction {
    color: white;
    text-align: center;
    margin-top: 20px;
    font-size: 16px;
}

.scan-result {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    display: none;
}

.scan-result.active {
    display: block;
}

.scan-result h3 {
    color: #333;
    margin-bottom: 10px;
}

.scan-result p {
    color: #666;
    word-break: break-all;
}

.title {
    padding-bottom: 1rem;
}
