/* ==========================================================
   One-Touch Exchange — Dark Crypto Theme
   ========================================================== */

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

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #1e2747;
    --bg-input: #0f3460;
    --border-color: #2a3a5e;
    --border-focus: #4a90d9;
    --text-primary: #e8e8f0;
    --text-secondary: #8892b0;
    --text-muted: #5a6488;
    --accent-green: #00d4aa;
    --accent-blue: #4a90d9;
    --accent-red: #e74c3c;
    --accent-orange: #f39c12;
    --accent-yellow: #f1c40f;
    --font-stack: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --max-width: 800px;
    --transition: 0.2s ease;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-stack);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Container --- */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* --- Header --- */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* --- Alert --- */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-error {
    background: rgba(231, 76, 60, 0.12);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #ff6b6b;
}

.alert-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* --- Fee Notice --- */
.fee-notice {
    text-align: center;
    padding: 0.6rem 1rem;
    background: rgba(0, 212, 170, 0.08);
    border: 1px solid rgba(0, 212, 170, 0.2);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    color: var(--accent-green);
    font-size: 0.9rem;
    font-weight: 500;
}

.fee-label {
    font-weight: 600;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.8rem;
    margin-bottom: 1.5rem;
}

/* --- Exchange Form --- */
.exchange-form {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.8rem;
}

.form-columns {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
    align-items: end;
    margin-bottom: 1.5rem;
}

.form-column {
    flex: 1;
}

.arrow-column {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.3rem 0.4rem;
}

.arrow-icon {
    font-size: 1.5rem;
    color: var(--accent-blue);
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-select,
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-stack);
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238892b0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

.form-select option {
    background: var(--bg-input);
    color: var(--text-primary);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.input-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.select-wrapper {
    position: relative;
}

.network-badge {
    display: none;
    position: absolute;
    right: 2.6rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    background: rgba(74, 144, 217, 0.15);
    color: var(--accent-blue);
    pointer-events: none;
}

.network-badge.visible {
    display: inline;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: var(--font-stack);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition), opacity var(--transition), transform var(--transition);
}

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

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
}

.btn-primary:hover {
    background: #3a7bc8;
}

.btn-secondary {
    background: transparent;
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
}

.btn-secondary:hover {
    background: rgba(74, 144, 217, 0.1);
}

.btn-full {
    width: 100%;
    padding: 0.9rem;
    font-size: 1.05rem;
    border-radius: var(--radius);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-copy {
    background: rgba(0, 212, 170, 0.12);
    color: var(--accent-green);
    border: 1px solid rgba(0, 212, 170, 0.3);
}

.btn-copy:hover {
    background: rgba(0, 212, 170, 0.2);
}

.btn-copy.copied {
    background: rgba(0, 212, 170, 0.25);
    color: var(--accent-green);
    border-color: var(--accent-green);
}

/* --- Trust Info --- */
.trust-info {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius);
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.trust-icon {
    font-size: 1.1rem;
}

/* --- Exchange Flow (Preview / Status) --- */
.exchange-flow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.flow-source,
.flow-dest {
    flex: 1;
    text-align: center;
}

.flow-arrow {
    flex: 0 0 auto;
}

.arrow-big {
    font-size: 2rem;
    color: var(--accent-blue);
}

.currency-badge {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.currency-badge-source {
    background: rgba(74, 144, 217, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(74, 144, 217, 0.3);
}

.currency-badge-dest {
    background: rgba(0, 212, 170, 0.12);
    color: var(--accent-green);
    border: 1px solid rgba(0, 212, 170, 0.3);
}

/* --- Detail Rows --- */
.preview-details,
.status-details {
    margin-bottom: 1.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.detail-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 120px;
}

.detail-value {
    color: var(--text-primary);
    font-size: 0.9rem;
    text-align: right;
    word-break: break-all;
}

.rate-value {
    color: var(--accent-green);
    font-weight: 600;
}

.fee-value {
    color: var(--accent-orange);
}

.address-truncate {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    color: var(--text-secondary);
    max-width: 280px;
}

/* --- Deposit Address Box --- */
.deposit-section {
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
}

.address-box {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.address-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
}

.address-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.address-value {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    overflow-x: auto;
}

.address-value code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    color: var(--accent-green);
    word-break: break-all;
    line-height: 1.5;
}

/* --- QR Placeholder --- */
.qr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius);
}

.qr-icon {
    font-size: 1.5rem;
}

.qr-text {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.qr-subtext {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.qr-box {
    width: 120px;
    height: 120px;
    background: #fff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.5rem;
}

.qr-inner {
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-code-text {
    color: #333;
    font-size: 0.6rem;
    text-align: center;
    word-break: break-all;
    padding: 0.5rem;
}

/* --- Warning Box --- */
.warning-box {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    background: rgba(243, 156, 18, 0.08);
    border: 1px solid rgba(243, 156, 18, 0.25);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--accent-orange);
    margin-bottom: 1rem;
}

.warning-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* --- Exchange Actions --- */
.exchange-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.exchange-actions .btn {
    width: 100%;
}

.status-actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1rem;
}

.status-actions .btn {
    width: 100%;
}

/* --- Exchange ID Bar --- */
.exchange-id-bar {
    text-align: center;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius);
    font-size: 0.8rem;
}

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

.eid-value {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* --- Status Card --- */
.status-card {
    position: relative;
    overflow: hidden;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    margin: -1.8rem -1.8rem 1.5rem -1.8rem;
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
}

.status-indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.status-text {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* --- Progress Steps --- */
.status-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
}

.progress-step.active {
    color: var(--accent-green);
}

.step-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: all var(--transition);
}

.progress-step.active .step-dot {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: #fff;
}

.progress-line {
    width: 60px;
    height: 2px;
    background: var(--border-color);
    transition: background var(--transition);
}

.progress-line.active {
    background: var(--accent-green);
}

/* --- Status Message --- */
.status-message {
    text-align: center;
    margin-bottom: 1.5rem;
}

.status-msg-text {
    font-size: 1rem;
    font-weight: 500;
}

.status-success {
    color: var(--accent-green);
}

.status-error {
    color: var(--accent-red);
}

/* --- Address Inline --- */
.address-inline {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 250px;
}

.address-code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    word-break: break-all;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- TX Links --- */
.tx-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    transition: color var(--transition);
}

.tx-link:hover {
    color: #6aafff;
    text-decoration: underline;
}

/* --- Share URL --- */
.share-url {
    text-align: center;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.share-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    display: block;
    margin-bottom: 0.3rem;
}

.share-link {
    color: var(--accent-blue);
    font-size: 0.82rem;
    text-decoration: none;
    word-break: break-all;
}

.share-link:hover {
    text-decoration: underline;
}

/* --- Form Validation --- */
.form-input.error,
.form-select.error {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.15);
}

.error-text {
    display: block;
    font-size: 0.75rem;
    color: var(--accent-red);
    margin-top: 0.25rem;
}

/* --- Status Transition Animation --- */
.status-fade-in {
    animation: fadeIn 0.4s ease;
}

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

/* --- Loading Spinner --- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* --- Responsive --- */
@media (max-width: 640px) {
    .container {
        padding: 1rem 0.75rem;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .form-columns {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .arrow-column {
        padding: 0;
    }

    .arrow-icon {
        transform: rotate(90deg);
        display: inline-block;
    }

    .card {
        padding: 1rem;
    }

    .status-bar {
        margin: -1rem -1rem 1rem -1rem;
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }

    .progress-line {
        width: 30px;
    }

    .detail-row {
        flex-direction: column;
        gap: 0.2rem;
    }

    .detail-value {
        text-align: left;
    }

    .address-truncate {
        max-width: 100%;
    }

    .trust-info {
        flex-direction: column;
        align-items: center;
        gap: 0.6rem;
    }
}

@media (max-width: 400px) {
    .header h1 {
        font-size: 1.2rem;
    }

    .currency-badge {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    .arrow-big {
        font-size: 1.5rem;
    }
}

/* --- Print --- */
@media print {
    .btn,
    .btn-copy {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .card,
    .exchange-form {
        border: 1px solid #ccc;
        box-shadow: none;
    }
}
