/* ==========================================
   DESIGN SYSTEM & VARIABLES
   ========================================== */
:root {
    --bg-dark: #070913;
    --bg-card: rgba(15, 22, 42, 0.45);
    --bg-card-hover: rgba(23, 33, 62, 0.65);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-active: rgba(0, 242, 254, 0.4);
    
    --primary: #6366f1; /* Indigo */
    --primary-hover: #4f46e5;
    
    --accent-cyan: #00f2fe;
    --accent-purple: #a855f7;
    --accent-gold: #fbbf24;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --success: #10b981;
    --danger: #ef4444;
    
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
    --shadow-cyan-glow: 0 0 25px rgba(0, 242, 254, 0.25);
    --radius-lg: 16px;
    --radius-md: 12px;
    
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Glowing background blobs */
.blob {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
    animation: blob-float 15s infinite alternate ease-in-out;
}
.blob-1 {
    top: -100px;
    left: -100px;
    background-color: var(--primary);
}
.blob-2 {
    bottom: -150px;
    right: -50px;
    background-color: var(--accent-purple);
    animation-delay: 5s;
}
.blob-3 {
    top: 50%;
    left: 45%;
    background-color: var(--accent-cyan);
    animation-delay: 10s;
}

@keyframes blob-float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 40px) scale(1.2); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==========================================
   COMMON GLASS CARD
   ========================================== */
.card-glass {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: all 0.3s ease;
}

/* ==========================================
   APP HEADER
   ========================================== */
.app-header {
    background: rgba(7, 9, 19, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}
.nav-logo-icon {
    font-size: 1.75rem;
    background: linear-gradient(135deg, var(--accent-cyan), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.4));
}
.logo-text {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.logo-accent {
    color: var(--accent-cyan);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}
.nav-link.active {
    border-bottom: 2px solid var(--accent-cyan);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background: rgba(0, 242, 254, 0.05);
}

.nav-btn-logout {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}
.nav-btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: white;
}

/* ==========================================
   LAYOUT STRUCTURE
   ========================================== */
.main-content {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    position: relative;
}

.view-section {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.view-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   BUTTONS & INPUTS
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-decoration: none;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}
.btn-accent {
    background: linear-gradient(135deg, var(--accent-cyan), var(--primary));
    color: #070913;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}
.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-cyan-glow);
}
.btn-block {
    width: 100%;
    padding: 0.95rem;
}
.btn:active {
    transform: translateY(0);
}

.btn-back {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}
.btn-back:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.pulse {
    animation: button-pulse 2s infinite;
}
@keyframes button-pulse {
    0% { box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.6); }
    70% { box-shadow: 0 0 0 15px rgba(0, 242, 254, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 242, 254, 0); }
}

/* Inputs and Forms */
.input-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}
.input-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}
.input-field {
    position: relative;
    display: flex;
    align-items: center;
}
.input-field i {
    position: absolute;
    left: 1.2rem;
    color: var(--text-muted);
    font-size: 1rem;
    transition: color 0.3s ease;
}
.input-field input {
    width: 100%;
    padding: 0.9rem 1.2rem 0.9rem 2.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}
.input-field input::placeholder {
    color: var(--text-muted);
}
.input-field input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.15);
}
.input-field input:focus + i {
    color: var(--accent-cyan);
}
.error-msg {
    color: var(--danger);
    font-size: 0.8rem;
    height: 0.8rem;
    margin-top: 2px;
}

/* ==========================================
   1. AUTHENTICATION COMPONENT
   ========================================== */
.auth-card-container {
    max-width: 480px;
    margin: 3rem auto;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}
.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-glass);
}
.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 1.25rem;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}
.auth-tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.02);
}
.auth-tab.active {
    color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.04);
    border-bottom: 3px solid var(--accent-cyan);
}

.auth-form-wrapper {
    padding: 2.5rem;
    display: none;
}
.auth-form-wrapper.active {
    display: block;
    animation: fadeIn 0.4s ease forwards;
}

.auth-title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, white, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.auth-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

/* ==========================================
   2. PROFILE COMPONENT
   ========================================== */
.profile-container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.profile-header-card {
    display: flex;
    align-items: center;
    padding: 2.5rem;
    gap: 2rem;
}
.profile-avatar-wrapper {
    position: relative;
}
.profile-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    font-family: var(--font-heading);
    font-weight: 800;
    color: #070913;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.3);
}
.profile-meta {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.profile-name {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
}
.profile-email {
    color: var(--text-secondary);
    font-size: 1rem;
}
.profile-badge {
    align-self: flex-start;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}
.stat-card {
    display: flex;
    align-items: center;
    padding: 1.75rem;
    gap: 1.25rem;
}
.stat-icon {
    font-size: 2.25rem;
}
.icon-cyan {
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.3));
}
.icon-purple {
    color: var(--accent-purple);
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.3));
}
.icon-gold {
    color: var(--accent-gold);
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.3));
}
.stat-info {
    display: flex;
    flex-direction: column;
}
.stat-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
}
.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.profile-progress-box {
    padding: 2.25rem;
}
.progress-title {
    font-family: var(--font-heading);
    font-weight: 600;
    margin-bottom: 1.25rem;
}
.progress-bar-container {
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 1rem;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--primary));
    border-radius: 6px;
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
}
.progress-status-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.75rem;
}

/* ==========================================
   3. COURSE PLAYER COMPONENT
   ========================================== */
.course-layout {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 2rem;
    align-items: start;
    margin-bottom: 2rem;
}

@media (max-width: 900px) {
    .course-layout {
        grid-template-columns: 1fr;
    }
}

.player-container {
    overflow: hidden;
}
.video-wrapper {
    position: relative;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #000;
}
.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
}
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    cursor: pointer;
}
.video-overlay.show {
    opacity: 1;
    pointer-events: all;
}
.play-overlay-icon {
    font-size: 5rem;
    color: white;
    filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.6));
    transition: transform 0.2s ease;
}
.video-overlay:hover .play-overlay-icon {
    transform: scale(1.1);
}

.video-details {
    padding: 2rem;
}
.video-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.video-tag {
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.3);
    color: var(--accent-cyan);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.dev-controls {
    display: inline-block;
}
.btn-dev {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}
.btn-dev:hover {
    background: rgba(239, 68, 68, 0.3);
    color: white;
}
.video-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.video-description {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Playlist Sidebar */
.playlist-container {
    padding: 1.75rem;
    max-height: 580px;
    display: flex;
    flex-direction: column;
}
.playlist-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.playlist-subtitle {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 1.25rem;
}
.playlist-items {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 0.25rem;
}

.playlist-item {
    display: flex;
    align-items: center;
    padding: 0.9rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.01);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    gap: 0.9rem;
}
.playlist-item:hover:not(.locked) {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}
.playlist-item.active {
    background: rgba(99, 102, 241, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.1);
}
.playlist-item.locked {
    opacity: 0.45;
    cursor: not-allowed;
}
.playlist-item.completed {
    border-color: rgba(16, 185, 129, 0.3);
}

.item-index-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.playlist-item.active .item-index-badge {
    background: var(--primary);
    color: white;
}
.playlist-item.completed .item-index-badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.item-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.item-title {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.item-status-icon {
    font-size: 0.95rem;
}
.playlist-item.locked .item-status-icon {
    color: var(--text-muted);
}
.playlist-item.completed .item-status-icon {
    color: var(--success);
}
.playlist-item:not(.locked):not(.completed) .item-status-icon {
    color: var(--accent-cyan);
}

/* Sidebar Upgrade Section */
.sidebar-upgrade-box {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--border-glass);
    text-align: center;
}
.sidebar-upgrade-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}
.btn-sm {
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
}

/* Call-to-Action for Payment */
.payment-cta {
    margin-top: 2rem;
    padding: 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3rem;
    position: relative;
    overflow: hidden;
    border-color: rgba(0, 242, 254, 0.25);
    background: linear-gradient(135deg, rgba(15, 22, 42, 0.7) 0%, rgba(99, 102, 241, 0.07) 100%);
    box-shadow: 0 10px 40px rgba(0, 242, 254, 0.1);
}
@media (max-width: 850px) {
    .payment-cta {
        flex-direction: column;
        padding: 2.25rem;
        gap: 1.75rem;
        text-align: center;
    }
    .cta-features {
        justify-content: center;
    }
}
.cta-sparkles {
    position: absolute;
    top: -20px;
    right: -20px;
    font-size: 6rem;
    opacity: 0.1;
    color: var(--accent-cyan);
}
.cta-content {
    flex: 1;
}
.cta-title {
    font-family: var(--font-heading);
    font-size: 2.1rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
}
.gradient-text {
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.cta-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}
.cta-features {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.cta-feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #e2e8f0;
}
.cta-feature i {
    color: var(--accent-cyan);
}
.cta-actions {
    flex-shrink: 0;
}

/* ==========================================
   4. PAYMENT GATEWAY COMPONENT
   ========================================== */
.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 2.5rem;
    max-width: 1000px;
    margin: 0 auto;
    align-items: start;
}
@media (max-width: 850px) {
    .checkout-layout {
        grid-template-columns: 1fr;
    }
}

.checkout-summary {
    padding: 2.25rem;
}
.checkout-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.75rem;
}
.product-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}
.prod-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.prod-name {
    font-size: 1.05rem;
    font-weight: 600;
}
.prod-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.prod-price {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.pricing-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-bottom: 2rem;
}
.price-row {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.95rem;
}
.summary-divider {
    border: none;
    border-top: 1px dashed var(--border-glass);
}
.total-row {
    color: white;
    font-weight: 700;
    font-size: 1.15rem;
}
.final-price {
    color: white;
    font-size: 1.35rem;
}

.guarantee-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}
.security-badge {
    font-size: 1.85rem;
    color: var(--accent-cyan);
    filter: drop-shadow(0 0 5px rgba(0, 242, 254, 0.2));
}
.guarantee-box h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}
.guarantee-box p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.checkout-form-container {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 2.25rem;
}

/* 3D Flipping Card Visual */
.interactive-card-wrapper {
    perspective: 1000px;
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
}
.credit-card {
    width: 100%;
    height: 220px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.credit-card.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 15px;
    backface-visibility: hidden;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.card-front {
    background: linear-gradient(135deg, #1e1b4b 0%, #311054 50%, #03001e 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(168, 85, 247, 0.15);
}
.card-back {
    background: linear-gradient(135deg, #03001e 0%, #311054 50%, #1e1b4b 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transform: rotateY(180deg);
    padding: 1.5rem 0 1.5rem 0; /* strip takes full width */
}

/* Card details styling */
.card-chip {
    width: 42px;
    height: 32px;
    background: linear-gradient(135deg, #ffd700, #b8860b);
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}
.card-chip::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(rgba(0,0,0,0.1), rgba(0,0,0,0.1) 2px, transparent 2px, transparent 6px);
}
.card-brand {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    font-size: 2.25rem;
    color: white;
}
.card-number-display {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.35rem;
    letter-spacing: 2px;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    word-spacing: 4px;
    margin: 1.5rem 0;
    text-align: center;
}
.card-lower {
    display: flex;
    justify-content: space-between;
}
.card-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    display: block;
    margin-bottom: 0.25rem;
}
.card-val-preview {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    max-width: 180px;
}

/* Card back details styling */
.card-magnetic-strip {
    height: 45px;
    background: #111;
    width: 100%;
}
.card-signature-area {
    padding: 0 1.5rem;
    margin-top: 1rem;
    text-align: right;
}
.card-signature-area .card-label {
    text-align: right;
    margin-bottom: 0.4rem;
}
.card-cvv-preview {
    height: 35px;
    background: #eaeaea;
    color: #111;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 700;
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.75rem;
    border-radius: 4px;
    font-size: 1rem;
    letter-spacing: 2px;
}

.payment-fields-form {
    display: flex;
    flex-direction: column;
}
.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Processing State animation */
.loading-spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   5. SUCCESS VIEW COMPONENT
   ========================================== */
.success-card {
    max-width: 550px;
    margin: 2rem auto;
    padding: 4rem 3rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
    animation: scaleUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.success-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}
.success-icon-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(16, 185, 129, 0.15);
    border-radius: 50%;
    transform: scale(1.3);
    animation: ripple 2s infinite ease-out;
}
@keyframes ripple {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
}
.success-icon {
    font-size: 4.5rem;
    color: var(--success);
    z-index: 1;
    filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.4));
}

.success-title {
    font-family: var(--font-heading);
    font-size: 2.1rem;
    font-weight: 800;
}
.success-subtitle {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 1.05rem;
}
.receipt-box {
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}
.receipt-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.receipt-row span:last-child {
    font-weight: 600;
    color: white;
}
.receipt-row span.text-green {
    color: var(--success);
}
.success-actions {
    margin-top: 1rem;
    width: 100%;
}

/* ==========================================
   FOOTER SECTION
   ========================================== */
.app-footer {
    border-top: 1px solid var(--border-glass);
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
}

/* ==========================================
   TOAST NOTIFICATION SYSTEM
   ========================================== */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}
.toast {
    background: rgba(15, 22, 42, 0.9);
    border-left: 4px solid var(--primary);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass);
    border-left-width: 4px;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    min-width: 280px;
    max-width: 400px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.toast.show {
    transform: translateX(0);
}
.toast-success {
    border-left-color: var(--success);
}
.toast-error {
    border-left-color: var(--danger);
}
.toast-icon {
    font-size: 1.1rem;
}
.toast-success .toast-icon {
    color: var(--success);
}
.toast-error .toast-icon {
    color: var(--danger);
}
.toast-msg {
    font-size: 0.9rem;
    font-weight: 500;
}
