:root {
    --bg-primary: #0b0f19;
    --bg-card: rgba(17, 25, 40, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --primary: #2563eb;
    --primary-glow: rgba(37, 99, 235, 0.4);
    --accent: #eab308;
    --accent-glow: rgba(234, 179, 8, 0.2);
    --error: #ef4444;
    --success: #10b981;
    --font-sans: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Background decorative lights */
.glow-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.25;
    mix-blend-mode: screen;
    animation: float 15s infinite alternate ease-in-out;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.orb-2 {
    width: 350px;
    height: 350px;
    background: var(--accent);
    bottom: -80px;
    right: -80px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 30px) scale(1.15); }
}

/* Premium Card container */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    width: 100%;
    max-width: 500px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Auth Section */
#auth-container {
    padding: 30px;
    max-height: 90vh;
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 25px;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.2s ease;
    position: relative;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--text-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 18px;
    animation: fadeIn 0.4s ease;
}

.auth-form.active {
    display: flex;
}

h2 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: -10px;
    line-height: 1.4;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    font-family: var(--font-sans);
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.2s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--primary-glow);
    filter: brightness(1.1);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Chat container styling */
#chat-container {
    max-width: 800px;
    height: 90vh;
    border-radius: 24px;
}

.chat-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.agent-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d4ed8, #1e3a8a);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.chat-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.badge {
    font-size: 11px;
    background: rgba(234, 179, 8, 0.15);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid rgba(234, 179, 8, 0.3);
    font-weight: 500;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 15px;
}

.username {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(0, 0, 0, 0.1);
}

/* Message styling */
.message {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    animation: slideUp 0.3s ease;
    word-break: break-word;
}

.user-msg {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.model-msg {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.system-msg {
    align-self: center;
    background: rgba(234, 179, 8, 0.08);
    color: var(--text-primary);
    border: 1px dashed rgba(234, 179, 8, 0.25);
    max-width: 90%;
    border-radius: 12px;
}

.message p {
    margin-bottom: 8px;
}
.message p:last-child {
    margin-bottom: 0;
}

.message ul, .message ol {
    margin-left: 20px;
    margin-bottom: 8px;
}

.message li {
    margin-bottom: 4px;
}

/* Typing indicator */
.typing {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    padding: 12px 20px;
    border-radius: 18px;
    display: flex;
    gap: 6px;
    align-items: center;
    margin-left: 20px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    width: fit-content;
}

.typing span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing span:nth-child(1) { animation-delay: -0.32s; }
.typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input form area */
.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.01);
}

.chat-input-area form {
    display: flex;
    gap: 12px;
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
}

.btn-send {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    width: 46px;
    height: 46px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-send:hover {
    transform: scale(1.05);
    background: #3b82f6;
    box-shadow: 0 6px 15px var(--primary-glow);
}

/* Utilities */
.hidden { display: none !important; }
.error-msg { color: var(--error); font-size: 13px; font-weight: 500; }
.success-msg { color: var(--success); font-size: 13px; font-weight: 500; }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.token-badge {
    background: rgba(16, 185, 129, 0.15) !important;
    color: var(--success) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    font-size: 11px;
}

.status-msg {
    align-self: flex-start;
    font-size: 13px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

.status-msg span {
    font-size: 16px;
}

/* Modal Overlay & Transitions */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    max-width: 460px;
    width: 90%;
    max-height: 90vh;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.6);
    animation: modalZoom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
    padding: 0 4px;
}

.btn-close:hover {
    color: var(--error);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

/* Callouts & Step Layouts */
.warning-callout {
    background: rgba(239, 68, 68, 0.08);
    border-left: 4px solid var(--error);
    padding: 16px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    text-align: left;
    border-top: 1px solid rgba(239, 68, 68, 0.1);
    border-right: 1px solid rgba(239, 68, 68, 0.1);
    border-bottom: 1px solid rgba(239, 68, 68, 0.1);
}

.warning-callout p {
    margin: 0;
    line-height: 1.45;
}

.testnet-note {
    color: var(--text-secondary);
    font-size: 13px;
}

.payment-step {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    text-align: center;
    width: 100%;
}

.payment-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Premium QR code card */
.qr-container-wrapper {
    background: #ffffff;
    padding: 14px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 8px 0;
}

#qrcode canvas, #qrcode img {
    display: block;
    width: 180px !important;
    height: 180px !important;
}

/* Invoice input & Copy button */
.invoice-copy-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    text-align: left;
}

.invoice-copy-container label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.invoice-copy-row {
    display: flex;
    gap: 8px;
    width: 100%;
}

.invoice-copy-row input {
    flex: 1;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    font-family: monospace;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
}

.btn-copy {
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: white;
    width: 42px;
    height: 42px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-copy:hover {
    background: #3b82f6;
    transform: scale(1.05);
}

.btn-copy:active {
    transform: scale(0.98);
}

/* Spinner and status text */
.payment-status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 12px;
    width: 100%;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Success Checkmark Animation */
.success-icon-wrapper {
    margin: 15px 0;
}

.success-checkmark {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--success);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.check-icon {
    width: 14px;
    height: 28px;
    border-right: 3px solid var(--success);
    border-bottom: 3px solid var(--success);
    transform: rotate(45deg) translate(-2px, -4px);
    transform-origin: center;
    animation: checkmarkGrow 0.4s ease-out;
}

/* Custom Keyframes */
@keyframes modalZoom {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

@keyframes checkmarkGrow {
    0% { height: 0; width: 0; opacity: 0; }
    50% { height: 0; width: 14px; opacity: 1; }
    100% { height: 28px; width: 14px; opacity: 1; }
}

/* Welcome Modal Styles */
.info-callout {
    background: rgba(37, 99, 235, 0.08);
    border-left: 4px solid var(--primary);
    padding: 16px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    text-align: left;
    border-top: 1px solid rgba(37, 99, 235, 0.1);
    border-right: 1px solid rgba(37, 99, 235, 0.1);
    border-bottom: 1px solid rgba(37, 99, 235, 0.1);
}

.info-callout p {
    margin: 0;
    line-height: 1.45;
}

.welcome-desc-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.welcome-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.welcome-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
