/*
 * SuperPass Digital Loyalty Pass System Style Sheet
 * Implements a premium, modern design with black, gold, and dark gray accents.
 */

:root {
    --bg-dark: #0D0D0D;
    --bg-card: rgba(31, 31, 31, 0.85); /* Hex #1F1F1F Dark Gray base */
    --bg-card-border: rgba(255, 255, 255, 0.06);
    --text-primary: #FFFFFF;
    --text-secondary: #F5F5F5;
    
    --primary: #FFC107; /* Gold */
    --primary-glow: rgba(255, 193, 7, 0.25);
    
    --light-gold: #FFD54F;
    --dark-gold: #E6A700;
    
    --success: #22C55E;
    --info: #3B82F6;
    --danger: #EF4444; /* Error */
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(255, 193, 7, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(230, 167, 0, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    letter-spacing: -0.01em;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--bg-card-border);
    border-radius: 16px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.8);
}

/* Navbar Custom Styling */
.navbar-custom {
    background: rgba(13, 13, 13, 0.8) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bg-card-border);
    padding: 1rem 0;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--text-primary) !important;
    background: linear-gradient(135deg, var(--light-gold), var(--primary), var(--dark-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    transition: var(--transition-smooth);
    border-radius: 8px;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary) !important;
    background: rgba(255, 255, 255, 0.04);
}

/* Sidebar for dashboard */
.sidebar {
    position: sticky;
    top: 90px;
    height: calc(100vh - 120px);
}

/* Forms & Inputs */
.form-control, .form-select {
    background-color: rgba(13, 13, 13, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--text-primary) !important;
    border-radius: 10px !important;
    padding: 0.75rem 1rem !important;
    transition: var(--transition-smooth) !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px var(--primary-glow) !important;
    background-color: rgba(13, 13, 13, 0.8) !important;
}

.form-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* Custom Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--dark-gold)) !important;
    color: #0D0D0D !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 0.75rem 1.5rem !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.15) !important;
    transition: var(--transition-smooth) !important;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.3) !important;
    background: linear-gradient(135deg, var(--light-gold), var(--primary)) !important;
}

.btn-success {
    background: linear-gradient(135deg, #16a34a, var(--success)) !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 0.75rem 1.5rem !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    transition: var(--transition-smooth) !important;
}

.btn-success:hover {
    transform: translateY(-2px);
}

/* Custom Tables */
.table-custom {
    margin-bottom: 0;
    background-color: var(--primary) !important; /* Gold background */
    border-radius: 12px;
    overflow: hidden;
    border-collapse: collapse;
}

.table-custom th,
.table-custom td {
    background-color: var(--primary) !important; /* Force cell backgrounds to gold */
}

.table-custom th {
    color: #0D0D0D !important; /* Black text */
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1.2rem 1rem;
    border-bottom: 1px solid rgba(13, 13, 13, 0.2) !important;
}

.table-custom td {
    padding: 1.2rem 1rem;
    vertical-align: middle;
    color: #0D0D0D !important; /* Black text */
    border-bottom: 1px solid rgba(13, 13, 13, 0.1) !important;
}

.table-custom td .text-white, 
.table-custom td .text-secondary, 
.table-custom td .text-muted,
.table-custom td small,
.table-custom td i {
    color: #0D0D0D !important; /* Force all subtexts, icons, and small tags to black */
}

.table-custom .badge-custom {
    background-color: #0D0D0D !important; /* High contrast black background */
    color: var(--primary) !important; /* Gold text */
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.table-custom tr:last-child td {
    border-bottom: none !important;
}

/* Wallet Pass Live Mockup */
.wallet-pass-container {
    perspective: 1000px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: sticky;
    top: 100px;
}

.wallet-pass {
    width: 320px;
    background-color: #1e293b;
    border-radius: 18px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica;
    transition: var(--transition-smooth);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.wallet-pass-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
    position: relative;
}

.wallet-pass-header::before, .wallet-pass-header::after {
    content: '';
    position: absolute;
    bottom: -8px;
    width: 16px;
    height: 16px;
    background-color: var(--bg-dark); /* or card container bg */
    border-radius: 50%;
}
.wallet-pass-container .wallet-pass-header::before, .customer-card-view .wallet-pass-header::before {
    left: -8px;
}
.wallet-pass-container .wallet-pass-header::after, .customer-card-view .wallet-pass-header::after {
    right: -8px;
}

.wallet-pass-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-right: 12px;
    object-fit: cover;
}

.wallet-pass-header-text {
    flex: 1;
}

.wallet-pass-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
    margin-bottom: 2px;
    font-weight: 600;
}

.wallet-pass-subtitle {
    font-size: 0.95rem;
    font-weight: 700;
}

.wallet-pass-body {
    padding: 20px;
}

/* Stamp board grid */
.stamp-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stamp-slot {
    aspect-ratio: 1;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.2);
    position: relative;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stamp-slot.stamped {
    border-style: solid;
    animation: stampIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes stampIn {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.stamp-slot.stamped::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 8px #ffffff;
    animation: pulse 1.5s infinite;
}

/* Dynamic stamp shapes */
.shape-circle { border-radius: 50%; }
.shape-square { border-radius: 8px; }
.shape-star { clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.shape-heart { clip-path: path("M12,5 C10,1 4,1 2,5 C0,8 3,14 12,21 C21,14 24,8 22,5 C20,1 14,1 12,5 Z"); } /* Simplified heart */

.wallet-pass-footer {
    background: rgba(0, 0, 0, 0.25);
    padding: 16px 20px;
    font-size: 0.8rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.wallet-pass-qr {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    background: #ffffff;
    border-radius: 12px;
    margin: 15px auto;
    width: 140px;
    height: 140px;
}

#qrcode {
    width: 120px;
    height: 120px;
    display: block;
}

#qrcode img, #qrcode canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.wallet-pass-serial {
    text-align: center;
    font-family: monospace;
    font-size: 0.75rem;
    opacity: 0.6;
    letter-spacing: 0.1em;
}

/* Apple and Google wallet buttons styling */
.wallet-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.add-wallet-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: var(--transition-smooth);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.add-apple-wallet {
    background-color: #000000;
    color: #ffffff;
}

.add-apple-wallet:hover {
    background-color: #1a1a1a;
    transform: translateY(-2px);
}

.add-google-wallet {
    background-color: #000000;
    color: #ffffff;
}

.add-google-wallet:hover {
    background-color: #1a1a1a;
    transform: translateY(-2px);
}

.add-wallet-btn img {
    height: 24px;
    margin-right: 8px;
}

/* Scanner viewport simulation */
.scanner-viewport {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    margin: 0 auto 20px;
    background: #020617;
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.scanner-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-laser {
    position: absolute;
    top: 10%;
    left: 5%;
    width: 90%;
    height: 3px;
    background: linear-gradient(to right, transparent, var(--danger), transparent);
    box-shadow: 0 0 10px var(--danger);
    animation: laserScan 2s infinite ease-in-out;
}

@keyframes laserScan {
    0%, 100% { top: 10%; }
    50% { top: 90%; }
}

.scanner-overlay {
    position: absolute;
    top: 20%;
    left: 20%;
    right: 20%;
    bottom: 20%;
    border: 2px solid var(--primary);
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.scanner-overlay::before {
    content: '';
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    border: 4px solid var(--primary);
    border-radius: 14px;
    clip-path: polygon(
        0% 20%, 0% 0%, 20% 0%,
        80% 0%, 100% 0%, 100% 20%,
        100% 80%, 100% 100%, 80% 100%,
        20% 100%, 0% 100%, 0% 80%
    );
    animation: targetPulse 1.5s infinite;
}

@keyframes targetPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.7; }
}

/* Sound notification and success badge */
.badge-custom {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    background-color: var(--primary-glow);
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-success-custom {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Floating toasts */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1080;
}

.custom-toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--bg-card-border);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    color: #ffffff;
    padding: 16px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(100px);
    opacity: 0;
    animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes toastSlideIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.custom-toast.success { border-left-color: var(--success); }
.custom-toast.danger { border-left-color: var(--danger); }
.custom-toast.warning { border-left-color: var(--warning); }

/* Confetti effect helper container */
.confetti-container {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f59e0b;
    border-radius: 50%;
    animation: confettiFall 3s linear infinite;
}

@keyframes confettiFall {
    0% { transform: translateY(-50px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

/* Responsive fixes */
@media (max-width: 768px) {
    .sidebar {
        height: auto;
        position: static;
        margin-bottom: 20px;
    }
    .wallet-pass-container {
        position: static;
        margin-top: 20px;
    }
}

/* Mobile Phone Simulator Frame for Desktop Viewports */
.mobile-simulator-frame {
    width: 100%;
    margin: 0 auto;
}

@media (min-width: 992px) {
    .mobile-simulator-frame {
        max-width: 410px;
        height: 840px;
        border: 14px solid #1F1F1F;
        border-radius: 40px;
        position: relative;
        background-color: var(--bg-dark);
        box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), inset 0 0 4px rgba(255, 255, 255, 0.2);
        overflow-y: auto;
        overflow-x: hidden;
        padding: 40px 20px 20px;
        scrollbar-width: none; /* Hide scrollbar for Firefox */
    }
    
    .mobile-simulator-frame::-webkit-scrollbar {
        display: none; /* Hide scrollbar for Chrome/Safari */
    }
    
    /* Phone Camera Notch */
    .mobile-simulator-frame::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 160px;
        height: 28px;
        background-color: #1F1F1F;
        border-bottom-left-radius: 18px;
        border-bottom-right-radius: 18px;
        z-index: 1050;
    }
    
    /* Home Indicator bar at bottom */
    .mobile-simulator-frame::after {
        content: '';
        position: absolute;
        bottom: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 130px;
        height: 5px;
        background-color: rgba(255, 255, 255, 0.3);
        border-radius: 10px;
        z-index: 1050;
        pointer-events: none;
    }
}
