/* ==========================================
   ZYROX — App Page (Dark Theme)
   Inherits landing.css variables
   ========================================== */

/* === APP SECTION LAYOUT === */
.app-section {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 96px 24px 48px;
}

.app-section-inner {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.app-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

/* === TRANSFER CARD (dark) === */
.app-card {
    width: 100%;
    max-width: 460px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    padding: 36px 28px;
    text-align: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: cardFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

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

/* === APP HEADER === */
.app-header {
    margin-bottom: 24px;
}

.app-card h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    margin-bottom: 2px;
    background: linear-gradient(135deg, #ffffff 0%, #999999 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 0.82rem;
    color: #777;
}

.home-hint {
    margin-top: 6px;
    font-size: 0.7rem;
    color: #666;
}

/* === SCREENS (transition system — dark) === */
.screen {
    display: none;
    opacity: 0;
    transform: translateY(6px);
}

.screen.active {
    display: block;
    animation: screenIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen.exiting {
    display: block;
    animation: screenOut 0.18s ease forwards;
}

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

@keyframes screenOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-4px); }
}

/* === BUTTONS (dark) === */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 10px;
    -webkit-tap-highlight-color: transparent;
    min-height: 48px;
}

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

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

.btn.primary {
    background: #fff;
    color: #000;
}

.btn.primary:hover:not(:disabled) {
    background: #e8e8e8;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.1);
}

.btn.secondary {
    background: transparent;
    color: #ddd;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn.secondary:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.04);
}

.btn.small {
    width: auto;
    padding: 12px 18px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.btn-icon {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    color: #777;
    min-width: 40px;
    min-height: 40px;
}

.btn-icon:hover {
    border-color: rgba(255, 255, 255, 0.3);
    color: #ddd;
}

.btn-icon.copied {
    border-color: #4ade80;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.08);
}

.back-link {
    background: none;
    border: none;
    color: #777;
    font-weight: 500;
    font-size: 0.85rem;
    margin-top: 14px;
    padding: 10px;
    cursor: pointer;
    display: block;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s;
}

.back-link:hover {
    color: #ddd;
}

/* === MODE BADGES (dark) === */
.mode-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.mode-badge.relay {
    background: rgba(74, 222, 128, 0.08);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.15);
}

.mode-badge.p2p {
    background: rgba(96, 165, 250, 0.08);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.15);
}

.mode-tag {
    font-size: 0.76rem;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.mode-tag.relay {
    background: rgba(74, 222, 128, 0.06);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.1);
}

.mode-tag.p2p {
    background: rgba(96, 165, 250, 0.06);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.1);
}

/* === QR CODE (dark) === */
.qr-box {
    background: #fff;
    padding: 10px;
    border-radius: 14px;
    display: inline-block;
    margin-bottom: 10px;
}

.qr-box img {
    display: block;
    width: 160px;
    height: 160px;
    max-width: 100%;
}

/* === LINK ROW === */
.link-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.link-text {
    font-size: 0.72rem;
    color: #777;
    word-break: break-all;
    line-height: 1.3;
    min-width: 0;
}

/* === CODE DISPLAY (dark) === */
.code-display {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: #f5f5f5;
    font-family: 'Courier New', monospace;
}

.code-display.large {
    font-size: 2.2rem;
    letter-spacing: 0.25em;
    padding: 16px 12px;
    margin: 0;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    flex: 1;
    min-width: 0;
}

.code-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 14px;
}

.your-code-label {
    font-size: 0.75rem;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-bottom: 4px;
}

.refresh-btn {
    padding: 8px;
    border-radius: 50%;
}

.refresh-btn.spinning svg {
    animation: spinOnce 0.5s ease;
}

@keyframes spinOnce {
    from { transform: rotate(0); }
    to { transform: rotate(360deg); }
}

/* === DIVIDER (dark) === */
.divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 14px;
    color: #666;
    font-size: 0.75rem;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

/* === CODE INPUT (dark) === */
.code-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.code-input {
    flex: 1;
    min-width: 0;
    padding: 12px 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.2s;
    background: rgba(255, 255, 255, 0.03);
    color: #f5f5f5;
}

.code-input:focus {
    border-color: rgba(255, 255, 255, 0.3);
}

.code-input::placeholder {
    color: #444;
}

/* === STATUS (dark) === */
.status {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.status.error {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.status.info {
    background: rgba(96, 165, 250, 0.06);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.1);
}

.status.success {
    background: rgba(74, 222, 128, 0.06);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.1);
}

/* === FILE INPUT (dark) === */
.file-input-wrapper {
    position: relative;
    margin-bottom: 14px;
}

input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

label[for="fileInput"] {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px 14px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

label[for="fileInput"]:hover,
#fileInput:focus + label {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.03);
}

.file-input-wrapper.drag-over label {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.04);
    transform: scale(1.01);
}

.upload-icon {
    color: #666;
}

label[for="fileInput"]:hover .upload-icon {
    color: #aaa;
}

.label-title {
    font-weight: 500;
    font-size: 0.95rem;
    color: #ddd;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.label-subtitle {
    font-size: 0.78rem;
    color: #666;
}

/* === UPLOAD ANIMATION === */
.upload-anim {
    margin-bottom: 12px;
}

.upload-pulse {
    color: #ddd;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: translateY(0); }
    50% { opacity: 0.4; transform: translateY(-4px); }
}

/* === SUCCESS ICON (dark) === */
.success-icon {
    margin-bottom: 10px;
    color: #4ade80;
    animation: popIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

/* === PROGRESS (dark) === */
.progress-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 10px;
    transition: none;
}

.progress-percent {
    font-size: 0.82rem;
    color: #777;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.screen-title {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 6px;
    color: #f5f5f5;
}

.hint {
    font-size: 0.82rem;
    color: #777;
    line-height: 1.4;
    margin-bottom: 16px;
}

.hint.small {
    font-size: 0.72rem;
    margin-bottom: 14px;
}

/* === TOAST (dark) === */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #fff;
    color: #000;
    padding: 10px 22px;
    border-radius: 28px;
    font-size: 0.82rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    max-width: calc(100vw - 40px);
    font-family: 'Inter', sans-serif;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* === FLOATING TRANSFER BAR (dark) === */
.transfer-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 900;
    background: rgba(10, 10, 10, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.4);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.transfer-bar.visible {
    transform: translateY(0);
}

.transfer-bar-inner {
    max-width: 420px;
    margin: 0 auto;
    padding: 14px 20px 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.tb-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tb-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: #ddd;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.tb-meta {
    font-size: 0.72rem;
    color: #777;
    margin-left: 10px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.tb-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
}

.tb-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    border-radius: 6px;
    transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.tb-bottom {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}

.tb-percent {
    font-size: 0.75rem;
    font-weight: 600;
    color: #777;
    font-variant-numeric: tabular-nums;
}

.tb-speed {
    font-size: 0.72rem;
    color: #666;
    font-variant-numeric: tabular-nums;
}

.tb-done {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    animation: screenIn 0.3s ease;
}

.tb-done-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: #4ade80;
}

.tb-new-btn {
    background: #fff;
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.tb-new-btn:hover {
    background: #e0e0e0;
}

/* Push toast up when transfer bar visible */
.transfer-bar.visible ~ .toast {
    bottom: 90px;
}

.hidden {
    display: none !important;
}

/* === SIDE CONTEXT CARDS === */
.app-context {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 900px;
    animation: cardFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.app-context-card {
    padding: 20px 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    transition: all 0.3s ease;
}

.app-context-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.app-context-icon {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.app-context-card h3 {
    font-size: 0.88rem;
    font-weight: 600;
    color: #ddd;
    margin-bottom: 6px;
}

.app-context-card p {
    font-size: 0.78rem;
    color: #777;
    line-height: 1.5;
}

/* ═══════════════════════════════════
   RESPONSIVE — App Page
   ═══════════════════════════════════ */

@media (max-width: 768px) {
    .app-context {
        grid-template-columns: 1fr;
    }

    .app-section {
        padding: 80px 16px 32px;
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .app-card {
        padding: 28px 18px;
        border-radius: 16px;
    }

    .app-card h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .btn {
        padding: 13px;
        font-size: 0.88rem;
        min-height: 46px;
    }

    .code-display.large {
        font-size: 1.6rem;
        letter-spacing: 0.18em;
        padding: 14px 10px;
    }

    .code-input {
        padding: 11px 8px;
        font-size: 0.95rem;
    }

    .qr-box img {
        width: 140px;
        height: 140px;
    }

    .screen-title {
        font-size: 0.95rem;
    }
}

@media (max-width: 360px) {
    .app-card {
        padding: 22px 14px;
        border-radius: 14px;
    }

    .app-card h1 {
        font-size: 1.35rem;
    }

    .code-display.large {
        font-size: 1.4rem;
        letter-spacing: 0.15em;
        padding: 12px 8px;
    }

    .code-input-row {
        flex-direction: column;
    }

    .btn.small {
        width: 100%;
    }

    .btn {
        min-height: 44px;
    }

    .qr-box img {
        width: 120px;
        height: 120px;
    }
}

/* === FILE LIST (multi-file) === */
.file-list {
    max-height: 160px;
    overflow-y: auto;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.file-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    animation: fileItemIn 0.2s ease;
}

.file-list-item:last-child {
    border-bottom: none;
}

@keyframes fileItemIn {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: translateX(0); }
}

.file-list-name {
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
    color: #ccc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.file-list-size {
    font-size: 0.7rem;
    color: #666;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.file-list-remove {
    background: none;
    border: none;
    color: #555;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s;
    flex-shrink: 0;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.file-list-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* === ZIP PROGRESS === */
.zip-progress {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(168, 85, 247, 0.06);
    border: 1px solid rgba(168, 85, 247, 0.12);
}

.zip-progress-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.zip-progress-inner span {
    font-size: 0.8rem;
    font-weight: 500;
    color: #c084fc;
    font-variant-numeric: tabular-nums;
}

.zip-spinner {
    color: #c084fc;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

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

.progress-bar-track.small {
    height: 5px;
    margin-bottom: 0;
}

/* === ZIP MODE TAG === */
.mode-tag.zip {
    background: rgba(168, 85, 247, 0.06);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.12);
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }

::selection {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}
