/* Appemon Public Stylesheet */
#appemon-portfolio-app {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 680px;
    height: calc(100vh - 80px);
    max-height: 920px;
    background: transparent;
    color: #f8fafc;
    border-radius: 0;
    overflow: hidden;
    direction: rtl;
    font-family: 'Vazirmatn', sans-serif;
    position: relative;
    isolation: isolate;
    z-index: 1;
}
.appemon-stage-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    flex: 1;
}

/* هدر یکپارچه و تمیز */
.appemon-stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    height: auto;
    padding: 8px 16px;
    box-sizing: border-box;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    margin-bottom: 10px;
    z-index: 5;
    flex-shrink: 0;
}
.current-app-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.appemon-mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.18);
    color: #c7d2fe;
    border: 1px solid rgba(99, 102, 241, 0.35);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.1s;
}
.appemon-mobile-menu-btn:hover {
    background: rgba(99, 102, 241, 0.3);
}
.appemon-mobile-menu-btn:active {
    transform: scale(0.96);
}
.current-app-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.current-app-icon-wrapper svg { width: 18px; height: 18px; stroke: #fff; fill: none; }
.current-app-text-block {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0 !important;
    padding: 0 !important;
}
.current-app-text-block h2 {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.35 !important;
    letter-spacing: normal !important;
    box-sizing: border-box !important;
}
.app-desc-desktop {
    margin: 2px 0 0 !important;
    padding: 0 !important;
    font-size: 11px !important;
    color: #94a3b8 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 450px !important;
    line-height: 1.35 !important;
    letter-spacing: normal !important;
    box-sizing: border-box !important;
}
.stage-live-badge-wrapper {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.stage-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 12px;
    border-radius: 9999px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
    font-size: 11.5px;
    font-weight: 700;
    position: relative;
}
.live-dot-ping {
    position: absolute;
    right: 9px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #34d399;
    opacity: 0.75;
    animation: livePing 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.live-dot-core {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #10b981;
    position: relative;
    z-index: 1;
}
@keyframes livePing {
    75%, 100% {
        transform: scale(2.2);
        opacity: 0;
    }
}
.stage-brand-selector-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 6px 0 10px;
    z-index: 10;
}
.stage-brand-selector-pill .brand-switch-group {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 3px 4px;
    gap: 4px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
}
.stage-brand-selector-pill .brand-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.stage-brand-selector-pill .brand-btn:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.05);
}
.stage-brand-selector-pill .brand-btn.active {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    transform: scale(1.02);
}
.stage-brand-selector-pill .brand-btn svg {
    flex-shrink: 0;
}

/* بدنه اصلی شامل سایدبار و استیج */
.appemon-main-body {
    display: flex;
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* سایدبار دسکتاپ */
.appemon-sidebar {
    width: 290px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 5;
}
.appemon-sidebar-header {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-title { font-size: 12px; font-weight: bold; color: #fff; }
.counter-badge {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 10px;
}
.appemon-sidebar-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
}
.appemon-apps-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.appemon-app-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.appemon-app-card.active {
    background: rgba(99, 102, 241, 0.25);
    border-color: #6366f1;
}
.card-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.card-icon svg {
    width: 19px;
    height: 19px;
    stroke: #ffffff;
    fill: none;
}
.card-info {
    min-width: 0;
    flex: 1;
}
.card-info h3 { margin: 0 0 2px; font-size: 12px; font-weight: bold; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-info p { margin: 0; font-size: 10px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* استیج تمیز و شفاف فریم گوشی */
.appemon-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    padding: 6px 12px;
    position: relative;
    overflow-y: auto;
}
.appemon-device-viewport {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: auto 0;
    padding: 6px 0;
}

/* شبیه‌ساز واقعی بدنه تیتانیوم کشیده */
.device-hardware-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}
.side-button {
    position: absolute;
    background: #3a3f50;
    border-radius: 2px;
}
.btn-action { left: -4px; top: 110px; width: 3px; height: 26px; }
.btn-vol-up { left: -4px; top: 150px; width: 3px; height: 48px; }
.btn-vol-down { left: -4px; top: 208px; width: 3px; height: 48px; }
.btn-power { right: -4px; top: 150px; width: 3px; height: 70px; }

/* استایل بدنه اختصاصی آیفون */
.device-hardware-wrapper.brand-iphone .device-chassis {
    border-radius: 52px;
    background: #1a1c24;
    border-color: #363a48;
}
.device-hardware-wrapper.brand-iphone .device-inner-bezel {
    border-radius: 47px;
}
.device-hardware-wrapper.brand-iphone .screen-canvas {
    border-radius: 44px;
}
.device-hardware-wrapper.brand-iphone .dynamic-island {
    display: flex;
    width: 98px;
    height: 26px;
    border-radius: 20px;
}

/* استایل بدنه اختصاصی سامسونگ Galaxy Ultra */
.device-hardware-wrapper.brand-samsung .device-chassis {
    border-radius: 18px;
    background: #13151b;
    border-color: #2c303c;
}
.device-hardware-wrapper.brand-samsung .device-inner-bezel {
    border-radius: 14px;
}
.device-hardware-wrapper.brand-samsung .screen-canvas {
    border-radius: 12px;
}
.device-hardware-wrapper.brand-samsung .btn-action,
.device-hardware-wrapper.brand-samsung .btn-vol-up,
.device-hardware-wrapper.brand-samsung .btn-vol-down {
    display: none;
}
.device-hardware-wrapper.brand-samsung .btn-power {
    top: 135px;
    height: 58px;
}
.device-hardware-wrapper.brand-samsung .dynamic-island {
    display: flex;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.device-hardware-wrapper.brand-samsung .island-indicator {
    display: none;
}
.device-hardware-wrapper.brand-samsung .home-indicator {
    width: 90px;
    height: 3px;
}

/* استایل بدنه اختصاصی شیائومی */
.device-hardware-wrapper.brand-xiaomi .device-chassis {
    border-radius: 40px;
    background: #16181f;
    border-color: #383c48;
}
.device-hardware-wrapper.brand-xiaomi .device-inner-bezel {
    border-radius: 35px;
}
.device-hardware-wrapper.brand-xiaomi .screen-canvas {
    border-radius: 32px;
}
.device-hardware-wrapper.brand-xiaomi .btn-action {
    display: none;
}
.device-hardware-wrapper.brand-xiaomi .dynamic-island {
    display: flex;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.device-hardware-wrapper.brand-xiaomi .island-indicator {
    display: none;
}
.device-hardware-wrapper.brand-xiaomi .home-indicator {
    width: 110px;
    height: 3px;
}

.device-chassis {
    width: 340px;
    height: 720px;
    max-height: 78vh;
    background: #1a1c24;
    border-radius: 52px;
    padding: 5px;
    border: 2px solid #363a48;
    position: relative;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9);
    outline: 1px solid rgba(255, 255, 255, 0.12);
    transition: all 0.3s ease;
}
.device-inner-bezel {
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 47px;
    padding: 2.5px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}
.dynamic-island {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 98px;
    height: 26px;
    background: #000;
    border-radius: 20px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    user-select: none;
    transition: all 0.3s ease;
}
.island-camera {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #090d16;
    border: 1px solid #1e2330;
    position: relative;
}
.lens-glare {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(96, 165, 250, 0.6);
}
.island-indicator {
    display: flex;
    align-items: center;
}
.sensor-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}
.screen-canvas {
    width: 100%;
    height: 100%;
    border-radius: 44px;
    overflow: hidden;
    background: #fff;
    position: relative;
}
#appemon-live-iframe {
    width: 100%;
    height: 100%;
    border: none;
}
.home-indicator {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 4px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    pointer-events: none;
    z-index: 5;
}

/* پاپ‌آپ شناور مشاهده اپلیکیشن پایین استیج */
.appemon-bottom-action-popup {
    width: 100%;
    max-width: 380px;
    margin-top: 8px;
    z-index: 5;
}
.popup-inner {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.popup-app-details {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.popup-icon-wrapper {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.popup-icon-wrapper svg { width: 18px; height: 18px; stroke: #fff; fill: none; }
.popup-text {
    min-width: 0;
}
.popup-text h4 {
    margin: 0;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.popup-text span {
    display: block;
    font-size: 10px;
    color: #94a3b8;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.app-direct-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: bold;
    background: linear-gradient(135deg, #6366f1, #9333ea);
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
    flex-shrink: 0;
}
.app-direct-link-btn:hover {
    filter: brightness(1.1);
}
.app-direct-link-btn:active {
    transform: scale(0.96);
}

/* گرادینت‌های رنگی */
.from-rose-500.to-pink-600 { background: linear-gradient(135deg, #f43f5e, #db2777); }
.from-blue-500.to-indigo-600 { background: linear-gradient(135deg, #3b82f6, #4f46e5); }
.from-amber-500.to-orange-600 { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.from-emerald-500.to-teal-600 { background: linear-gradient(135deg, #10b981, #0d9488); }
.from-fuchsia-500.to-purple-600 { background: linear-gradient(135deg, #d946ef, #9333ea); }
.from-cyan-500.to-blue-600 { background: linear-gradient(135deg, #06b6d4, #2563eb); }
.from-amber-600.to-yellow-600 { background: linear-gradient(135deg, #d97706, #ca8a04); }
.from-violet-500.to-indigo-700 { background: linear-gradient(135deg, #8b5cf6, #4338ca); }
.from-red-500.to-amber-600 { background: linear-gradient(135deg, #ef4444, #d97706); }
.from-indigo-500.to-purple-600 { background: linear-gradient(135deg, #6366f1, #9333ea); }

/* لایه پوششی برای دراور موبایل */
.appemon-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.appemon-drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* واکنش‌گرایی در موبایل */
@media (max-width: 860px) {
    .appemon-mobile-menu-btn {
        display: inline-flex;
    }
    .app-desc-desktop {
        display: none;
    }
    .appemon-sidebar {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 280px;
        max-width: 85%;
        z-index: 100;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: -10px 0 30px rgba(0,0,0,0.7);
    }
    .appemon-sidebar.open {
        transform: translateX(0);
    }
    .appemon-sidebar-close-btn {
        display: inline-block;
    }
    .device-chassis {
        width: 300px;
        height: 580px;
    }
}
