/* MyXorange Public App CSS */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.mxo-app {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
}

/* INSTALL BANNER */
.mxo-install-banner {
    position: fixed;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 100%; max-width: 480px;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 30px rgba(0,0,0,.15);
    z-index: 9999;
    animation: slideUp .4s ease;
}
.mxo-banner-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}
.mxo-banner-logo { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.mxo-banner-text { flex: 1; }
.mxo-banner-text strong { display: block; font-size: 14px; color: #1a1a1a; }
.mxo-banner-text span { font-size: 12px; color: #888; }
.mxo-btn-install {
    background: #FF6600;
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .15s, box-shadow .15s;
}
.mxo-btn-install:hover { transform: scale(1.04); box-shadow: 0 4px 12px rgba(255,102,0,.35); }
.mxo-banner-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #999;
    padding: 4px;
    flex-shrink: 0;
}

/* SPLASH */
.mxo-splash {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #FF6600 0%, #e65c00 100%);
    z-index: 100;
    gap: 16px;
    transition: opacity .5s, visibility .5s;
}
.mxo-splash.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.mxo-splash-img {
    width: 120px;
    height: 120px;
    border-radius: 24px;
    object-fit: cover;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    animation: pulse 2s infinite;
}
.mxo-splash-name {
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: .5px;
}
.mxo-spinner {
    width: 32px; height: 32px;
    border: 3px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* SCREENS */
.mxo-screens { min-height: 100vh; }
.mxo-screen { display: none; min-height: 100vh; flex-direction: column; background: #fafafa; }
.mxo-screen.active { display: flex; }

/* HOME */
.mxo-home-bg {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px 24px;
    /* background set inline via PHP */
}
.mxo-home-logo-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 48px;
}
.mxo-home-logo {
    width: 110px;
    height: 110px;
    border-radius: 24px;
    object-fit: cover;
    box-shadow: 0 8px 32px rgba(0,0,0,.3);
    animation: pulse 3s infinite;
}
.mxo-home-title {
    color: #fff;
    font-size: 28px;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0,0,0,.3);
    letter-spacing: .5px;
    text-align: center;
}
.mxo-home-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 320px;
}

/* BADGE SUI BOTTONI */
.mxo-btn-wrap {
    position: relative;
    display: block;
}
.mxo-btn-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
    z-index: 20;
    pointer-events: none;
    animation: mxo-badge-pop .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes mxo-badge-pop {
    from { transform: scale(0); }
    to   { transform: scale(1); }
}

/* BUTTONS */
.mxo-btn {
    display: block;
    width: 100%;
    padding: 18px 24px;
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    letter-spacing: .3px;
    transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
    position: relative;
    overflow: hidden;
}
.mxo-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background .2s;
    border-radius: 16px;
}
.mxo-btn:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.mxo-btn:hover::after { background: rgba(255,255,255,.08); }
.mxo-btn:active { transform: scale(.97); }

/* FOOTER BRAND */
.mxo-footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 48px;
    opacity: .7;
}
.mxo-footer-logo { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.mxo-footer-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.mxo-footer-info span,
.mxo-footer-info a {
    font-size: 10px;
    color: #fff;
    text-decoration: none;
    line-height: 1.4;
}
.mxo-footer-info a:hover { text-decoration: underline; }

/* SCREEN HEADER */
.mxo-screen-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.mxo-screen-header h2 { font-size: 18px; color: #1a1a1a; flex: 1; }
.mxo-back-btn {
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    color: #555;
    transition: all .2s;
    white-space: nowrap;
}
.mxo-back-btn:hover { background: #f5f5f5; }

/* FORM */
.mxo-form-wrap { padding: 20px; display: flex; flex-direction: column; gap: 16px; flex: 1; }
.mxo-form-intro { color: #666; font-size: 14px; line-height: 1.5; }
.mxo-field-group { display: flex; flex-direction: column; gap: 6px; }
.mxo-field-group label { font-size: 13px; font-weight: 600; color: #444; }
.mxo-field-group input,
.mxo-field-group select {
    padding: 14px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-size: 16px;
    color: #1a1a1a;
    background: #fff;
    transition: border-color .2s;
    outline: none;
    width: 100%;
    -webkit-appearance: none;
}
.mxo-field-group input:focus,
.mxo-field-group select:focus { border-color: #FF6600; }
.mxo-field-group input.valid { border-color: #27ae60; }
.mxo-btn-submit {
    padding: 16px;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.mxo-btn-submit:disabled { opacity: .5; cursor: not-allowed; }
.mxo-btn-submit:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.mxo-error { color: #e74c3c; font-size: 14px; padding: 10px; background: #fdf0ee; border-radius: 8px; }
.mxo-success-msg { color: #27ae60; font-size: 14px; padding: 10px; background: #eafaf1; border-radius: 8px; text-align: center; }
.mxo-link-btn { background: none; border: none; color: #FF6600; font-size: 14px; cursor: pointer; text-decoration: underline; padding: 4px 0; }

/* CHANNEL */
.mxo-channel-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.mxo-ch-msg {
    background: #fff;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    border-left: 4px solid #FF6600;
}
.mxo-ch-msg-meta { font-size: 11px; color: #aaa; margin-bottom: 6px; }
.mxo-ch-msg-text { font-size: 15px; color: #333; line-height: 1.5; }
.mxo-ch-msg img { max-width: 100%; border-radius: 10px; margin-top: 8px; }
.mxo-ch-msg audio,
.mxo-ch-msg video { width: 100%; margin-top: 8px; border-radius: 8px; }

/* ADMINS LIST */
.mxo-admins-list { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.mxo-admin-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    cursor: pointer;
    transition: all .2s;
    border: 2px solid transparent;
}
.mxo-admin-item:hover { border-color: #FF6600; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,102,0,.15); }
.mxo-admin-avatar {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, #FF6600, #e65c00);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}
.mxo-admin-info { flex: 1; }
.mxo-admin-name { font-size: 16px; font-weight: 600; color: #1a1a1a; }
.mxo-role-badge {
    display: inline-block;
    background: #fff3e0;
    color: #e65c00;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 3px;
}

/* CHAT */
.mxo-chat-hdr { background: #FF6600; }
.mxo-chat-hdr .mxo-back-btn { color: #fff; border-color: rgba(255,255,255,.4); }
.mxo-chat-hdr .mxo-back-btn:hover { background: rgba(255,255,255,.15); }
.mxo-chat-admin-info { flex: 1; }
.mxo-chat-admin-info strong { color: #fff; font-size: 16px; }
.mxo-chat-admin-info .mxo-role-badge { background: rgba(255,255,255,.2); color: #fff; }

.mxo-chat-msgs-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f5f0eb;
}
.mxo-msg-bubble {
    max-width: 78%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.4;
    position: relative;
    word-break: break-word;
}
.mxo-msg-bubble.mxo-out {
    align-self: flex-end;
    background: #FF6600;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.mxo-msg-bubble.mxo-in {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.mxo-msg-time { font-size: 10px; opacity: .65; margin-top: 4px; text-align: right; }
.mxo-chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}
.mxo-chat-input-wrap textarea {
    flex: 1;
    border: 2px solid #e8e8e8;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 15px;
    resize: none;
    outline: none;
    transition: border-color .2s;
    max-height: 100px;
    overflow-y: auto;
    font-family: inherit;
}
.mxo-chat-input-wrap textarea:focus { border-color: #FF6600; }
.mxo-send-btn {
    width: 46px; height: 46px;
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 4px 12px rgba(255,102,0,.35);
}
.mxo-send-btn:hover { transform: scale(1.1); }

/* MISC */
.mxo-loading { color: #999; text-align: center; padding: 40px; font-size: 15px; }
.mxo-empty-state { text-align: center; padding: 40px 20px; color: #bbb; }
.mxo-modify-data { text-align: center; }
.mxo-no-admins { color: #999; text-align: center; padding: 40px 20px; font-size: 15px; }

/* ANIMATIONS */
@keyframes slideUp { from { transform: translateX(-50%) translateY(100%); } to { transform: translateX(-50%) translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.03); } }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.mxo-screen.active { animation: fadeIn .3s ease; }

/* Push permission prompt */
.mxo-push-prompt {
    position: fixed;
    top: 16px; left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 440px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
    padding: 16px;
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeIn .3s ease;
}
.mxo-push-prompt-icon { font-size: 32px; flex-shrink: 0; }
.mxo-push-prompt-text { flex: 1; }
.mxo-push-prompt-text strong { display: block; font-size: 14px; color: #1a1a1a; margin-bottom: 2px; }
.mxo-push-prompt-text span { font-size: 12px; color: #888; }
.mxo-push-yes { background: #FF6600; color: #fff; border: none; border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.mxo-push-no { background: none; border: none; color: #aaa; font-size: 13px; cursor: pointer; padding: 8px; }

@media(max-width:480px){ .mxo-app{ border-radius:0; box-shadow:none; } }

/* APP HEADER */
.mxo-app-header {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    padding: 0 20px;
    flex-shrink: 0;
    position: relative;
}
.mxo-app-header-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .3px;
    text-align: center;
}

/* APP FOOTER NAV */
.mxo-app-footer {
    display: flex;
    align-items: stretch;
    min-height: 60px;
    flex-shrink: 0;
    border-top: 1px solid rgba(0,0,0,.1);
}
.mxo-footer-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity .2s, background .2s;
    border: none;
    background: none;
    cursor: pointer;
    letter-spacing: .2px;
}
.mxo-footer-nav-btn:hover { opacity: .75; }

/* PAGE SCREEN */
.mxo-screen-page .mxo-page-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 18px 32px;
    font-size: 15px;
    line-height: 1.7;
}
.mxo-screen-page .mxo-page-content h1,
.mxo-screen-page .mxo-page-content h2,
.mxo-screen-page .mxo-page-content h3 {
    margin: 1.2em 0 .5em;
    line-height: 1.3;
}
.mxo-screen-page .mxo-page-content p { margin: 0 0 1em; }
.mxo-screen-page .mxo-page-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
}
.mxo-screen-page .mxo-page-content a { text-decoration: underline; opacity: .85; }
.mxo-screen-page .mxo-page-content ul,
.mxo-screen-page .mxo-page-content ol { padding-left: 22px; margin: 0 0 1em; }
