/**
 * Paytm Merchant Gateway - 100% Standalone Self-Dependent Design System
 * Zero External Dependencies (No Tailwind CDN, No External Fonts, 100% Offline-Ready)
 */

:root {
    --ptm-navy: #042b62;
    --ptm-navy-dark: #001942;
    --ptm-blue: #002970;
    --ptm-cyan: #00baf2;
    --ptm-cyan-light: #e6f8fd;
    --ptm-cyan-hover: #009ed1;
    --ptm-green: #21c17a;
    --ptm-green-light: #e8f9f1;
    --ptm-red: #ea4335;
    --ptm-amber: #f59e0b;
    --ptm-bg: #f3f6fa;
    --ptm-card-bg: #ffffff;
    --ptm-border: #e2e8f0;
    --ptm-text-dark: #0f172a;
    --ptm-text-muted: #64748b;
    --ptm-text-light: #94a3b8;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(4, 43, 98, 0.08);
    --shadow-lg: 0 10px 25px -5px rgba(4, 43, 98, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--ptm-bg);
    color: var(--ptm-text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* App Header */
.app-header {
    background: linear-gradient(135deg, var(--ptm-navy-dark) 0%, var(--ptm-navy) 60%, #004b99 100%);
    color: #fff;
    padding: 14px 24px;
    box-shadow: 0 4px 15px rgba(0, 25, 66, 0.2);
    position: sticky;
    top: 0;
    z-index: 50;
}

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

.brand-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-badge {
    background: #fff;
    color: var(--ptm-navy);
    font-weight: 900;
    font-size: 18px;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.brand-badge span {
    color: var(--ptm-cyan);
}

.brand-title {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 11px;
    color: var(--ptm-cyan);
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    padding: 3px;
    border-radius: 10px;
}

.nav-tab-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-tab-btn.active {
    background: #fff;
    color: var(--ptm-navy);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.nav-tab-btn:hover:not(.active) {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* Main Container */
.main-wrapper {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
    flex: 1;
    width: 100%;
}

/* Grid Layout for Checkout */
.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 860px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }
}

/* Card Styling */
.ptm-card {
    background: var(--ptm-card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--ptm-border);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--ptm-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ptm-text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 22px;
}

/* Form Controls */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--ptm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.form-label .req {
    color: var(--ptm-red);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--ptm-text-light);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--ptm-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--ptm-text-dark);
    background: #fff;
    transition: all 0.2s ease;
    outline: none;
}

.form-input.has-icon {
    padding-left: 42px;
}

.form-input:focus {
    border-color: var(--ptm-cyan);
    box-shadow: 0 0 0 3px rgba(0, 186, 242, 0.15);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--ptm-cyan) 0%, #009ed1 100%);
    color: #fff;
    border: none;
    padding: 13px 20px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(0, 186, 242, 0.35);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 186, 242, 0.45);
}

.btn-primary:active {
    transform: translateY(0);
}

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

/* QR Code & Display Stand */
.qr-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.qr-box-wrapper {
    background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 100%);
    border: 2px solid #e0eeff;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 41, 112, 0.08);
    position: relative;
    max-width: 320px;
    width: 100%;
    margin: 0 auto;
}

.qr-merchant-banner {
    background: var(--ptm-navy);
    color: #fff;
    padding: 8px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qr-canvas-holder {
    background: #fff;
    padding: 14px;
    border-radius: 14px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 14px;
}

.qr-canvas-holder img, 
.qr-canvas-holder canvas {
    display: block;
    max-width: 100%;
}

.qr-amount-badge {
    font-size: 26px;
    font-weight: 800;
    color: var(--ptm-navy);
    margin: 8px 0 4px;
}

.qr-upi-info {
    font-size: 12px;
    color: var(--ptm-text-muted);
    font-weight: 500;
}

.supported-apps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--ptm-border);
}

.app-pill {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f1f5f9;
}
.app-pill.phonepe { color: #5f259f; background: #f3e8ff; }
.app-pill.gpay { color: #1a73e8; background: #e8f0fe; }
.app-pill.paytm { color: #00baf2; background: #e6f8fd; }
.app-pill.bhim { color: #00897b; background: #e0f2f1; }

/* Status Bar & Timer */
.status-bar {
    margin-top: 16px;
    background: #f8fafc;
    border: 1px solid var(--ptm-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--ptm-cyan);
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(0, 186, 242, 0.7);
    animation: radar-pulse 1.8s infinite;
}

@keyframes radar-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 186, 242, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(0, 186, 242, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 186, 242, 0); }
}

.timer-pill {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 10px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    font-weight: 700;
}

/* Soundbox Simulation Widget */
.soundbox-card {
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-top: 20px;
    border: 1px solid #334155;
    box-shadow: var(--shadow-md);
}

.soundbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.soundbox-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ptm-cyan);
}

.soundbox-wave {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 16px;
}

.soundbox-wave span {
    width: 3px;
    background: var(--ptm-cyan);
    border-radius: 3px;
    height: 4px;
    transition: height 0.2s ease;
}

.soundbox-wave.active span:nth-child(1) { animation: wave 0.8s infinite ease-in-out; }
.soundbox-wave.active span:nth-child(2) { animation: wave 0.8s 0.2s infinite ease-in-out; }
.soundbox-wave.active span:nth-child(3) { animation: wave 0.8s 0.4s infinite ease-in-out; }
.soundbox-wave.active span:nth-child(4) { animation: wave 0.8s 0.1s infinite ease-in-out; }

@keyframes wave {
    0%, 100% { height: 4px; }
    50% { height: 16px; }
}

.soundbox-speaker-text {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.4;
    background: rgba(255,255,255,0.06);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--ptm-cyan);
}

/* Action Buttons Grid */
.actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.btn-secondary {
    background: #fff;
    color: var(--ptm-text-dark);
    border: 1.5px solid var(--ptm-border);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-simulate {
    grid-column: span 2;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: #fff;
    border: none;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
    transition: all 0.2s ease;
}

.btn-simulate:hover {
    filter: brightness(1.08);
}

/* Success View / Receipt */
.success-card {
    text-align: center;
    padding: 30px 20px;
}

.success-icon-wrap {
    width: 64px;
    height: 64px;
    background: var(--ptm-green-light);
    color: var(--ptm-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 16px;
    border: 3px solid var(--ptm-green);
}

.receipt-sheet {
    background: #f8fafc;
    border: 1px solid var(--ptm-border);
    border-radius: var(--radius-md);
    padding: 18px;
    margin: 20px 0;
    text-align: left;
    font-size: 13px;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px dashed var(--ptm-border);
}

.receipt-row:last-child {
    border-bottom: none;
}

.receipt-label {
    color: var(--ptm-text-muted);
}

.receipt-val {
    font-weight: 600;
    color: var(--ptm-text-dark);
}

.receipt-val.highlight {
    color: var(--ptm-green);
    font-weight: 800;
    font-size: 16px;
}

/* Passbook / Transactions Table */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 640px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}

.stat-box {
    background: #fff;
    border: 1px solid var(--ptm-border);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 12px;
    color: var(--ptm-text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.stat-num {
    font-size: 24px;
    font-weight: 800;
    color: var(--ptm-navy);
    margin-top: 6px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.ptm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ptm-table th {
    background: #f1f5f9;
    padding: 12px 14px;
    text-align: left;
    font-weight: 700;
    color: var(--ptm-text-muted);
    border-bottom: 1.5px solid var(--ptm-border);
}

.ptm-table td {
    padding: 14px;
    border-bottom: 1px solid var(--ptm-border);
    color: var(--ptm-text-dark);
}

.ptm-table tr:hover {
    background: #f8fafc;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-success { background: var(--ptm-green-light); color: var(--ptm-green); }
.badge-pending { background: #fef3c7; color: #b45309; }
.badge-expired { background: #fee2e2; color: #dc2626; }

/* Toast Notifications */
.toast-msg {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--ptm-navy);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-msg.show {
    opacity: 1;
    transform: translateY(0);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--ptm-text-muted);
}

/* Utilities */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }

