/* ============================================
   Vending Machine Snack - Customer Portal CSS
   Dark Glassmorphism Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ============ CSS Variables ============ */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #111118;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.09);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-hover: rgba(255, 108, 26, 0.5);

    --accent-primary: #ff6c1a;
    --accent-secondary: #ff9f5a;
    --accent-glow: rgba(255, 108, 26, 0.35);
    --accent-gradient: linear-gradient(135deg, #ff6c1a, #ff9f5a);

    --text-primary: #f0f0f5;
    --text-secondary: #9898aa;
    --text-muted: #5a5a70;

    --success: #22d3a5;
    --warning: #f0c040;
    --danger: #f05050;
    --info: #60a5fa;

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    --shadow-glow: 0 0 40px rgba(255, 108, 26, 0.2);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============ Reset & Base ============ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ============ Animated Background ============ */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 108, 26, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    animation: float-orb1 15s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    bottom: -30%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 159, 90, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    animation: float-orb2 18s ease-in-out infinite reverse;
    z-index: 0;
    pointer-events: none;
}

@keyframes float-orb1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(60px, 80px) scale(1.1); }
    66% { transform: translate(-40px, 50px) scale(0.9); }
}

@keyframes float-orb2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-80px, -60px) scale(1.15); }
}

/* ============ Scrollbar ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--accent-primary); border-radius: 3px; }

/* ============ Header / Navbar ============ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(10, 10, 15, 0.85);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 2rem;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.navbar-logo-icon {
    width: 42px;
    height: 42px;
    background: var(--accent-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.navbar-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.navbar-title span {
    color: var(--accent-primary);
}

.navbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--success);
    background: rgba(34, 211, 165, 0.1);
    border: 1px solid rgba(34, 211, 165, 0.25);
    padding: 6px 14px;
    border-radius: 50px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ============ Hero Section ============ */
.hero-section {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 60px 2rem 40px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 108, 26, 0.12);
    border: 1px solid rgba(255, 108, 26, 0.3);
    color: var(--accent-secondary);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1px;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.hero-title .gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto 30px;
    line-height: 1.7;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

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

.hero-stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent-primary);
}

.hero-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============ Section Title ============ */
.section-header {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 20px 2rem 10px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.section-divider {
    width: 50px;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: 2px;
    margin: 0 auto;
}

/* ============ Products Grid ============ */
.products-container {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 1.5rem 80px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

/* ============ Product Card ============ */
.product-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.product-card:hover {
    transform: translateY(-6px);
    border-color: var(--glass-border-hover);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-glow), var(--shadow-card);
}

.product-card.out-of-stock {
    opacity: 0.5;
    pointer-events: none;
}

.card-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 50px;
    letter-spacing: 0.5px;
    z-index: 2;
}

.badge-sold-out {
    background: rgba(240, 80, 80, 0.9);
}

.card-slot-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    z-index: 2;
    border: 1px solid var(--glass-border);
}

.card-image-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a25, #0f0f18);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.card-image-wrapper img {
    width: 75%;
    height: 75%;
    object-fit: contain;
    transition: transform 0.4s ease;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5));
}

.product-card:hover .card-image-wrapper img {
    transform: scale(1.08) rotate(-2deg);
}

.card-body {
    padding: 18px 18px 14px;
}

.card-slot-info {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 6px;
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 6px;
}

.card-description {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-top: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.15);
}

.card-price {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--accent-primary);
}

.card-stock {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.btn-buy {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 9px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-buy:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px var(--accent-glow);
}

.btn-buy:active {
    transform: scale(0.97);
}

/* ============ Modal Overlay ============ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

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

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

.modal-box {
    background: #14141e;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 420px;
    width: 90%;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.modal-product-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    display: block;
    margin: 0 auto 20px;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5));
}

.modal-product-name {
    font-size: 1.3rem;
    font-weight: 800;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.modal-product-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
    margin-bottom: 20px;
}

.modal-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 108, 26, 0.08);
    border: 1px solid rgba(255, 108, 26, 0.2);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
}

.modal-price-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.modal-price-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-primary);
}

.modal-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(96, 165, 250, 0.08);
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.78rem;
    color: var(--info);
    margin-bottom: 20px;
    line-height: 1.5;
}

.btn-pay {
    width: 100%;
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 6px 25px var(--accent-glow);
}

.btn-pay:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 35px var(--accent-glow);
}

.btn-pay:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============ Loading Spinner ============ */
.spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ Toast Notification ============ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #1a1a28;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 18px;
    min-width: 280px;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlide 0.3s ease;
    font-size: 0.85rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

@keyframes toastSlide {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success { border-color: rgba(34, 211, 165, 0.4); }
.toast.error { border-color: rgba(240, 80, 80, 0.4); }

.toast-icon { font-size: 1.3rem; flex-shrink: 0; }
.toast-text { color: var(--text-primary); line-height: 1.4; }

/* ============ Footer ============ */
.footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--glass-border);
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* ============ Responsive ============ */
@media (max-width: 600px) {
    .products-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 20px 1rem 60px;
    }

    .navbar { padding: 0 1rem; }

    .hero-section { padding: 40px 1rem 30px; }

    .hero-stats { gap: 1rem; }

    .modal-box { padding: 24px; }
}

@media (max-width: 380px) {
    .products-container {
        grid-template-columns: 1fr;
    }
}
