/* ============================================================
   UAAU Messenger — Android Native App Style CSS
   Material You & Glassmorphism Experience
   ============================================================ */

@import url('/fonts.css');
@import url('/tokens.css');

/* ── Base Reset & Body ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body.android-body {
    font-family: var(--font-body, system-ui, sans-serif);
    background-color: #06070a;
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(255, 122, 0, 0.12), transparent 45%),
        radial-gradient(circle at 10% 90%, rgba(30, 60, 120, 0.1), transparent 40%);
    background-attachment: fixed;
    color: #f8fafc;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    overflow-x: hidden;
}

/* ── Android Smartphone Shell Layout ── */
.android-app-shell {
    width: 100%;
    max-width: 480px;
    min-height: 100vh;
    background: #0d0f17;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.75);
}

@media (min-width: 600px) {
    .android-app-shell {
        margin: 25px auto 40px auto;
        border-radius: 40px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        min-height: 860px;
        max-height: 94vh;
        overflow: hidden;
    }
}

/* ── Top App Bar ── */
.android-app-bar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 68px;
    background: rgba(13, 15, 23, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

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

.app-logo {
    width: 36px;
    height: 36px;
    filter: drop-shadow(0 2px 8px rgba(255, 122, 0, 0.4));
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.app-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}

.server-status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: #4ade80;
    font-weight: 500;
    margin-top: 2px;
}

.status-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 8px #4ade80;
    animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

.app-bar-actions .icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s ease;
}

.app-bar-actions .icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

/* ── Scrollable Content Area ── */
.android-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.android-content::-webkit-scrollbar {
    display: none;
}

/* ── 1. Hero Account Card ── */
.android-hero-card {
    background: linear-gradient(155deg, rgba(255, 122, 0, 0.14), rgba(20, 24, 38, 0.75));
    border: 1px solid rgba(255, 122, 0, 0.28);
    border-radius: 28px;
    padding: 22px 18px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45);
    position: relative;
    overflow: hidden;
}

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

.hero-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(255, 122, 0, 0.18);
    color: #ff9d42;
    border: 1px solid rgba(255, 122, 0, 0.35);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.android-hero-card h2 {
    font-size: 1.45rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 6px;
}

.hero-subtitle {
    color: #94a3b8;
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 18px;
}

/* CTA Button */
.android-cta-btn {
    width: 100%;
    background: linear-gradient(135deg, #ff7a00, #ff4d00);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 15px 20px;
    font-size: 0.98rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(255, 107, 0, 0.4);
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.btn-sparkle {
    font-size: 1.2rem;
    color: #ffe600;
}

/* Loading Spinner */
#loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    color: #ff9d42;
    font-size: 0.88rem;
    font-weight: 600;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 122, 0, 0.25);
    border-top-color: #ff7a00;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* QR Result */
.android-qr-box {
    background: #ffffff;
    padding: 14px;
    border-radius: 20px;
    width: fit-content;
    margin: 18px auto 8px auto;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#result-qr {
    display: block;
    border-radius: 10px;
}

.qr-hint {
    color: #475569;
    font-size: 0.72rem;
    margin-top: 6px;
    font-weight: 600;
}

/* Action Buttons */
.android-btn-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.android-action-btn {
    width: 100%;
    padding: 13px 16px;
    border-radius: 16px;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.android-action-btn.primary {
    background: #2563eb;
    color: #ffffff;
    border: none;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.android-action-btn.primary:hover:not(:disabled) {
    background: #1d4ed8;
}

.android-action-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.android-action-btn.secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.14);
}

.android-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Collapsible / Instruction Boxes */
.android-collapsible-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 14px;
    margin-top: 14px;
    text-align: right;
}

.android-collapsible-box.note-ios {
    border-color: rgba(255, 183, 3, 0.25);
    background: rgba(255, 183, 3, 0.04);
}

.collapsible-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #f1f5f9;
    margin-bottom: 6px;
}

.collapsible-text {
    font-size: 0.8rem;
    color: #94a3b8;
    line-height: 1.5;
}

.ltr-path {
    display: inline-block;
    color: #cbd5e1;
    font-family: monospace;
    font-size: 0.78rem;
    margin-top: 4px;
}

.android-code-box {
    display: block;
    direction: ltr;
    text-align: left;
    background: #080a10;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    padding: 10px 12px;
    margin-top: 10px;
    color: #38bdf8;
    font-family: monospace;
    font-size: 0.75rem;
    word-break: break-all;
    cursor: pointer;
    transition: background 0.2s;
}

.android-code-box:hover {
    background: #0f1320;
}

/* Error */
#error-message, #deltachat-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    padding: 12px;
    border-radius: 14px;
    font-size: 0.82rem;
    margin-top: 12px;
    text-align: right;
}

/* ── 2. Android App Tiles Grid ── */
.android-section {
    margin-bottom: 22px;
}

.section-header-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 10px;
    padding: 0 4px;
}

.android-tiles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.android-tile-card {
    background: rgba(22, 26, 38, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    padding: 16px 14px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 128px;
    position: relative;
    transition: all 0.22s cubic-bezier(0.2, 0, 0, 1);
}

.android-tile-card:active {
    transform: scale(0.96);
}

.android-tile-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(28, 33, 48, 0.85);
}

.tile-icon-bubble {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.tile-download .tile-icon-bubble {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.4));
    color: #60a5fa;
}

.tile-apps .tile-icon-bubble {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(147, 51, 234, 0.4));
    color: #c084fc;
}

.tile-links .tile-icon-bubble {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.2), rgba(13, 148, 136, 0.4));
    color: #2dd4bf;
}

.tile-help .tile-icon-bubble {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.4));
    color: #fbbf24;
}

.tile-texts {
    display: flex;
    flex-direction: column;
}

.tile-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
}

.tile-sub {
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 3px;
    line-height: 1.3;
}

.tile-arrow {
    position: absolute;
    bottom: 14px;
    left: 14px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.3);
    transition: transform 0.2s;
}

.android-tile-card:hover .tile-arrow {
    color: #ffffff;
    transform: translateX(-3px);
}

/* ── 3. Shadowsocks Proxy Card ── */
.android-proxy-card {
    background: rgba(20, 24, 38, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    padding: 16px;
}

.proxy-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

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

.proxy-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
}

.proxy-desc {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 2px;
    line-height: 1.4;
}

.proxy-copy-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #080a10;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 6px 8px 6px 12px;
}

.proxy-code {
    flex: 1;
    direction: ltr;
    text-align: left;
    font-family: monospace;
    font-size: 0.75rem;
    color: #38bdf8;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.proxy-copy-btn {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.proxy-path-hint {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 10px;
}

/* ── 4. Rules Card ── */
.android-rules-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 22px;
    padding: 16px;
}

.rules-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #cbd5e1;
    margin-bottom: 10px;
}

.rules-list {
    padding-right: 18px;
    color: #94a3b8;
    font-size: 0.78rem;
    line-height: 1.6;
}

.rules-list li {
    margin-bottom: 4px;
}

/* Spacer for Fixed Bottom Nav */
.bottom-nav-spacer {
    height: 75px;
}

/* ── 5. Android Bottom Navigation Bar ── */
.android-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 70px;
    background: rgba(13, 15, 23, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
    z-index: 1000;
}

@media (min-width: 600px) {
    .android-bottom-nav {
        border-bottom-left-radius: 38px;
        border-bottom-right-radius: 38px;
    }
}

.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #64748b;
    flex: 1;
    padding: 6px 0;
    transition: all 0.2s ease;
}

.tab-indicator {
    width: 48px;
    height: 28px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.2, 0, 0, 1);
}

.tab-label {
    font-size: 0.68rem;
    font-weight: 600;
    margin-top: 3px;
    transition: color 0.2s;
}

.nav-tab.active {
    color: #ffffff;
}

.nav-tab.active .tab-indicator {
    background: rgba(255, 122, 0, 0.22);
    color: #ff7a00;
}

.nav-tab.active .tab-label {
    color: #ff7a00;
    font-weight: 700;
}

.nav-tab:hover {
    color: #cbd5e1;
}
