/* ===== ROOT VARIABLES ===== */
:root {
    --color-primary: #704538;
    --color-primary-dark: #2C1810;
    --color-primary-light: #8B6F47;
    --color-accent: #D4AF37;
    --color-accent-light: #FFD700;
    --color-accent-dark: #B8860B;
    --color-bg-cream: #F5E6D3;
    --color-bg-cream-dark: #E8D4B8;
    --color-white: #FFFFFF;
    --color-gray-50: #F9FAFB;
    --color-gray-100: #F3F4F6;
    --color-gray-200: #E5E7EB;
    --color-gray-300: #D1D5DB;
    --color-gray-400: #9CA3AF;
    --color-gray-500: #6B7280;
    --color-gray-600: #4B5563;
    --color-gray-700: #374151;
    --color-gray-800: #1F2937;
    --color-gray-900: #111827;
    --color-success: #10B981;
    --color-error: #EF4444;
    --color-warning: #F59E0B;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    --shadow-2xl: 0 25px 50px rgba(0, 0, 0, 0.25);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--color-gray-800);
}

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

a {
    text-decoration: none;
    color: inherit;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
}

input, textarea, select {
    font-family: inherit;
    font-size: 1rem;
}

/* ===== UTILITY CLASSES ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

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

.text-left {
    text-align: left;
}

.hidden {
    display: none !important;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.min-h-screen {
    min-height: 100vh;
}

.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }

.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-4 > * + * { margin-left: 1rem; }
.space-x-6 > * + * { margin-left: 1.5rem; }

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

/* Padding */
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-12 { padding: 3rem; }

.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }

/* Margin */
.m-auto { margin: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

/* Border Radius */
.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-3xl { border-radius: 1.5rem; }
.rounded-full { border-radius: 9999px; }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-2xl { box-shadow: var(--shadow-2xl); }

/* Background Colors */
.bg-white { background-color: var(--color-white); }
.bg-gray-50 { background-color: var(--color-gray-50); }
.bg-gray-100 { background-color: var(--color-gray-100); }
.bg-primary { background-color: var(--color-primary); }
.bg-cream { background-color: var(--color-bg-cream); }

/* Text Colors */
.text-white { color: var(--color-white); }
.text-gray-500 { color: var(--color-gray-500); }
.text-gray-600 { color: var(--color-gray-600); }
.text-gray-700 { color: var(--color-gray-700); }
.text-gray-800 { color: var(--color-gray-800); }
.text-primary { color: var(--color-primary); }
.text-accent { color: var(--color-accent); }

/* Font Sizes */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.text-5xl { font-size: 3rem; }
.text-6xl { font-size: 4rem; }

/* Font Weight */
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ===== GRADIENT BACKGROUNDS ===== */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 50%, var(--color-primary-light) 100%);
}

.bg-gradient-cream {
    background: linear-gradient(135deg, var(--color-bg-cream) 0%, var(--color-bg-cream-dark) 100%);
}

/* ===== PAGE BACKGROUNDS ===== */
.page-bg {
    background: linear-gradient(135deg, #2C1810 0%, #704538 50%, #8B6F47 100%);
    min-height: 100vh;
}

.admin-bg {
    background-color: var(--color-gray-50);
    min-height: 100vh;
}

/* ===== CARD COMPONENTS ===== */
.card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.card-white-transparent {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: var(--shadow-2xl);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: var(--color-bg-cream);
    padding: 1rem 2.5rem;
    border: 2px solid var(--color-accent);
    box-shadow: 0 5px 20px rgba(112, 69, 56, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(112, 69, 56, 0.6);
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-primary) 100%);
    border-color: var(--color-accent-light);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--color-bg-cream);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-secondary:hover {
    background: var(--color-primary);
    color: var(--color-bg-cream);
    border-color: var(--color-accent);
}

.btn-icon {
    margin-right: 0.5rem;
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--color-gray-700);
    font-size: 0.875rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--color-gray-200);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(112, 69, 56, 0.1);
}

.form-input.error {
    border-color: var(--color-error);
}

.error-message {
    color: var(--color-error);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ===== LOGO ===== */
.logo-container {
    max-width: 200px;
    margin: 0 auto 2rem;
    text-align: center;
}

.logo-container img {
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* ===== HEADINGS ===== */
.heading-1 {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.75rem;
}

.heading-2 {
    font-size: 2.25rem;
    font-weight: 700;
}

.heading-3 {
    font-size: 1.875rem;
    font-weight: 700;
}

.subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
}

/* ===== SPIN WHEEL SPECIFIC ===== */
.spin-wheel-container {
    position: relative;
    width: 350px;
    height: 350px;
    margin: 0 auto;
}

.wheel-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5), 
                inset 0 0 0 8px var(--color-bg-cream), 
                inset 0 0 0 10px var(--color-primary);
    border: 5px solid var(--color-bg-cream);
}

.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--color-bg-cream) 0%, var(--color-bg-cream-dark) 100%);
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 
                inset 0 2px 4px rgba(255, 255, 255, 0.3);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--color-primary);
    font-size: 16px;
    letter-spacing: 1px;
    border: 3px solid var(--color-primary);
}

.wheel-pointer {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    border-top: 50px solid var(--color-accent);
    z-index: 5;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.5));
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-gray-500);
    cursor: pointer;
    padding: 0;
}

.modal-close:hover {
    color: var(--color-gray-700);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    animation: slideInRight 0.3s ease;
    max-width: 350px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast.error {
    background: #FEE;
    color: #C33;
    border-left: 4px solid #C33;
}

.toast.success {
    background: #EFE;
    color: #3C3;
    border-left: 4px solid #3C3;
}

@keyframes slideInRight {
    from { transform: translateX(400px); }
    to { transform: translateX(0); }
}

/* ===== LOADER ===== */
.loader {
    border: 4px solid var(--color-bg-cream);
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin-loader 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin-loader {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== CONFETTI ===== */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--color-accent);
    animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ===== NAVIGATION (Admin) ===== */
.nav {
    background: white;
    box-shadow: var(--shadow-md);
    padding: 1rem 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    height: 3rem;
}

.nav-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-gray-800);
}

/* ===== TABS (Admin) ===== */
.tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tab-button {
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    border: 2px solid transparent;
    background: white;
    color: var(--color-gray-600);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background: var(--color-gray-100);
}

.tab-button.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.tab-content {
    display: none;
}

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

/* ===== STATS CARDS (Admin) ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    color: var(--color-gray-600);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: var(--shadow-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

th {
    background: var(--color-primary);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-gray-200);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: var(--color-gray-50);
}

.table-code {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--color-primary);
}

/* ===== STATUS BADGES ===== */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background: #D4EDDA;
    color: #155724;
}

.status-redeemed {
    background: #D1ECF1;
    color: #0C5460;
}

.status-expired {
    background: #F8D7DA;
    color: #721C24;
}

/* ===== QR SCANNER ===== */
.qr-scanner-container {
    width: 100%;
    max-width: 500px;
    margin: 1rem auto;
}

#qr-reader {
    border: 2px solid var(--color-primary);
    border-radius: 10px;
    overflow: hidden;
}

/* ===== RESPONSIVE GRID ===== */
.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ===== RESPONSIVE DESIGN ===== */
@media (min-width: 768px) {
    .md\\:text-5xl {
        font-size: 3rem;
    }
    
    .md\\:p-12 {
        padding: 3rem;
    }
    
    .md\\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .lg\\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .lg\\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .heading-1 {
        font-size: 2.25rem;
    }
    
    .spin-wheel-container {
        width: 280px;
        height: 280px;
    }
    
    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }
    
    .toast {
        bottom: 20px;
        right: 20px;
        left: 20px;
        max-width: none;
    }
    
    .tab-buttons {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .spin-wheel-container {
        width: 250px;
        height: 250px;
    }
    
    .wheel-center {
        width: 50px;
        height: 50px;
        font-size: 0.875rem;
    }
    
    .heading-1 {
        font-size: 1.875rem;
    }
    
    .btn-primary {
        padding: 0.875rem 2rem;
        font-size: 1rem;
    }
}

/* ===== PRIZE DISPLAY ===== */
.prize-box {
    padding: 1.5rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--color-bg-cream) 0%, var(--color-bg-cream-dark) 100%);
    border: 2px solid var(--color-accent);
    margin-bottom: 1.5rem;
}

.prize-label {
    font-size: 1.125rem;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.prize-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #8B4513;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 1.5rem;
    box-shadow: var(--shadow-xl);
    padding: 2rem;
    width: 100%;
    max-width: 28rem;
}

/* ===== SEARCH BAR ===== */
.search-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--color-gray-200);
    border-radius: 0.5rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* ===== VOUCHER DETAILS CARD ===== */
.voucher-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-item {
    padding: 0.5rem 0;
}

.detail-label {
    font-size: 0.875rem;
    color: var(--color-gray-600);
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-gray-800);
}

.detail-value.highlight {
    color: var(--color-primary);
}

/* ===== EMOJI ICONS ===== */
.emoji-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* ===== UTILITY - Opacity ===== */
.opacity-90 {
    opacity: 0.9;
}

/* ===== UTILITY - Max Width ===== */
.max-w-xs { max-width: 20rem; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-6xl { max-width: 72rem; }

/* ===== TERMS & CONDITIONS MODAL CONTENT ===== */
.terms-content {
    max-height: 24rem;
    overflow-y: auto;
    padding-right: 1rem;
}

.terms-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-gray-800);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.terms-content h3:first-child {
    margin-top: 0;
}

.terms-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-gray-700);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.terms-content p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
    color: var(--color-gray-700);
}

.terms-content ul, .terms-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.terms-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    color: var(--color-gray-700);
}

.terms-content strong {
    font-weight: 600;
    color: var(--color-gray-800);
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
