/* Standalone webapp shell (APK / WebView) — home dashboard only */
:root {
    --primary: #7B1FA2;
    --primary-dark: #4A148C;
    --accent: #FF9F43;
    --bg: #F4F6F9;
    --text: #2C3E50;
    --muted: #7F8C8D;
}

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

html, body.webapp-root {
    height: 100%;
    font-family: 'Inter', 'Noto Sans Bengali', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

.webapp-hidden { display: none !important; }

/* Splash */
#view-splash {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

#view-splash h1 { font-size: 32px; font-weight: 800; margin-bottom: 8px; }
#view-splash p { opacity: 0.9; margin-bottom: 28px; }

.webapp-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 28px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

/* Login */
#view-login {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

#view-login h2 {
    color: var(--primary);
    font-size: 20px;
    margin-bottom: 8px;
}

#view-login .sub {
    color: var(--muted);
    font-size: 13px;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.4;
}

#login-loading-msg {
    margin-top: 16px;
    color: var(--accent);
    font-weight: 700;
    font-size: 13px;
    display: none;
}

/* Home — full screen */
#view-home {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.webapp-header {
    background: var(--primary);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.webapp-user {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    min-width: 0;
}

.webapp-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.5);
    background: #E1BEE7;
    flex-shrink: 0;
}

.webapp-avatar-fallback {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #E1BEE7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.webapp-user-name {
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.webapp-stars {
    background: rgba(0,0,0,0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.webapp-main {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    -webkit-overflow-scrolling: touch;
}

.webapp-welcome {
    background: linear-gradient(135deg, #FF9F43, #E040FB);
    color: white;
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 14px;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(255, 159, 67, 0.25);
}

.webapp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.webapp-card {
    background: white;
    border-radius: 16px;
    padding: 18px 12px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    border: none;
    cursor: pointer;
    transition: transform 0.15s;
    position: relative;
}

.webapp-card:active { transform: scale(0.97); }

.webapp-card .icon { font-size: 34px; margin-bottom: 8px; display: block; }
.webapp-card .label { font-size: 14px; font-weight: 700; color: var(--text); }

.webapp-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #E74C3C;
    color: white;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
}

/* Modal (login phone / alerts) */
.webapp-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.webapp-modal-overlay.show { display: flex; }

.webapp-modal {
    background: white;
    border-radius: 16px;
    padding: 20px;
    width: 100%;
    max-width: 340px;
    color: var(--text);
}

.webapp-modal h3 { margin-bottom: 8px; color: var(--primary); }
.webapp-modal p { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.webapp-modal input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 16px;
}

.webapp-modal-actions { display: flex; gap: 10px; }
.webapp-modal-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

.webapp-modal-primary { background: var(--primary); color: white; }
.webapp-modal-secondary { background: #eee; color: var(--text); }

/* index.php when opened from app */
html.app-standalone body {
    background: var(--bg) !important;
    background-image: none !important;
}

html.app-standalone header,
html.app-standalone footer,
html.app-standalone .intro-section,
html.app-standalone .features-grid,
html.app-standalone .parent-strip,
html.app-standalone .guide-box {
    display: none !important;
}

html.app-standalone .container {
    display: block !important;
    padding: 0 !important;
    min-height: 100dvh;
}

html.app-standalone .simulator-wrapper {
    width: 100%;
    max-width: 100%;
}

html.app-standalone .device {
    width: 100%;
    max-width: 480px;
    height: 100dvh;
    margin: 0 auto;
    border: none;
    border-radius: 0;
    box-shadow: none;
}
