/* ==========================================================================
   High-Fidelity Interactive iPhone 15 Pro Simulator Stylesheet
   ========================================================================== */

/* Simulator Shell Wrap - Desktop Only */
.simulator-sandbox {
    display: none;
}

body.simulator-active {
    background: radial-gradient(circle at center, #1e1b4b 0%, #03001e 50%, #02000d 100%) !important;
    overflow: hidden !important;
    height: 100vh !important;
    width: 100vw !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    perspective: 1000px;
}

body.simulator-active .simulator-sandbox {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 10000;
}

/* Simulated iPhone 15 Pro Chassis */
.iphone-chassis {
    position: relative;
    width: 425px;
    height: 882px;
    background: #0f172a;
    border-radius: 54px;
    padding: 13px; /* Bezel size */
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.7),
        inset 0 0 3px 2px rgba(255, 255, 255, 0.15),
        inset 0 0 0 4px rgba(255, 255, 255, 0.05),
        inset 0 0 15px 5px rgba(0, 0, 0, 0.8),
        0 0 0 6px #1e293b, /* Titanium frame outer border */
        0 0 0 8px #334155, /* Titanium highlight */
        0 0 25px 10px rgba(157, 78, 221, 0.15); /* Purple ambient glow */
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Side Hardware Buttons */
.chassis-btn {
    position: absolute;
    background: linear-gradient(to bottom, #475569, #1e293b);
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-action {
    left: -7px;
    top: 160px;
    width: 6px;
    height: 32px;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5);
}

.btn-vol-up {
    left: -7px;
    top: 215px;
    width: 6px;
    height: 60px;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5);
}

.btn-vol-down {
    left: -7px;
    top: 290px;
    width: 6px;
    height: 60px;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.5);
}

.btn-power {
    right: -7px;
    top: 235px;
    width: 6px;
    height: 90px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

/* Simulated Screen Viewport */
.simulator-screen {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #07080c;
    border-radius: 42px;
    overflow: hidden;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
}

/* Sleek Dynamic Island */
.dynamic-island {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 30px;
    background-color: #000000;
    border-radius: 20px;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), height 0.3s ease, border-radius 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.dynamic-island:hover {
    width: 260px;
    height: 45px;
}

.dynamic-island-content {
    display: none;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 16px;
    color: white;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.dynamic-island:hover .dynamic-island-content {
    display: flex;
    opacity: 1;
}

.di-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--accent-purple);
}

.di-right {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-cyan);
    font-weight: 500;
}

/* Real-time Status Bar */
.status-bar-sim {
    height: 44px;
    width: 100%;
    padding: 0 28px 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    background-color: transparent;
    z-index: 10000;
    user-select: none;
    position: absolute;
    top: 0;
    left: 0;
}

.status-left-time {
    letter-spacing: -0.1px;
}

.status-right-icons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-icon-cell,
.status-icon-wifi {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-icon-battery {
    display: flex;
    align-items: center;
    gap: 3px;
}

.battery-body {
    width: 22px;
    height: 11px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 3px;
    padding: 1px;
    position: relative;
}

.battery-body::after {
    content: '';
    position: absolute;
    top: 2px;
    right: -3px;
    width: 2px;
    height: 5px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 0 1px 1px 0;
}

.battery-fill {
    width: 80%; /* updates in JS */
    height: 100%;
    background-color: #10b981;
    border-radius: 1px;
    transition: width 0.5s ease;
}

.battery-fill.low {
    background-color: #ef4444;
}

.battery-fill.charging {
    background-color: #34d399;
}

/* Home Indicator Bar */
.home-indicator-sim {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 3px;
    z-index: 10000;
}

/* Screen Sleep/Power Off state */
.sleep-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    z-index: 10002;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    color: rgba(255, 255, 255, 0.3);
}

.sleep-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.sleep-time {
    font-size: 2.5rem;
    font-weight: 300;
    color: #e2e8f0;
    margin-bottom: 5px;
    font-family: 'Outfit', sans-serif;
}

.sleep-date {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 2rem;
}

.sleep-unlock-hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    position: absolute;
    bottom: 40px;
    animation: pulseSlow 2s infinite;
}

@keyframes pulseSlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* Screen content viewport (Iframe wraps app here) */
.screen-content-wrapper {
    flex-grow: 1;
    width: 100%;
    height: 100%;
    padding-top: 0; /* JS wraps target container */
    overflow: hidden;
    position: relative;
    border-radius: 42px;
}

/* Force elements within simulator screen to adapt to mobile */
.iphone-chassis .app-container {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    overflow-y: auto !important;
    padding-bottom: 30px !important;
}

/* Glassmorphic Control Dashboard */
.simulator-control-panel {
    width: 320px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 1.75rem;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.15),
        0 0 20px rgba(157, 78, 221, 0.05);
    color: #f1f5f9;
}

.ctrl-title-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 1rem;
}

.ctrl-title-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
}

.ctrl-title-icon i {
    width: 20px;
    height: 20px;
    color: white;
}

.ctrl-title-text h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

.ctrl-title-text span {
    font-size: 0.75rem;
    color: #94a3b8;
}

.ctrl-groups {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ctrl-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ctrl-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Control buttons styles */
.ctrl-btn-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.ctrl-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 14px;
    color: #e2e8f0;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: white;
}

.ctrl-btn.active {
    background: linear-gradient(135deg, rgba(157, 78, 221, 0.25), rgba(6, 214, 160, 0.1));
    border-color: rgba(157, 78, 221, 0.4);
    color: white;
    box-shadow: 0 0 10px rgba(157, 78, 221, 0.2);
}

.ctrl-select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: #e2e8f0;
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.ctrl-select:focus {
    border-color: var(--accent-purple);
}

/* Present Mode Button */
.ctrl-btn-danger {
    background: linear-gradient(135deg, rgba(239, 35, 60, 0.15), rgba(239, 35, 60, 0.05));
    border-color: rgba(239, 35, 60, 0.3);
    color: #f87171;
}

.ctrl-btn-danger:hover {
    background: linear-gradient(135deg, rgba(239, 35, 60, 0.25), rgba(239, 35, 60, 0.1));
    border-color: rgba(239, 35, 60, 0.4);
    color: #ef4444;
}

/* Floating Simulator Toggle Widget (Fixed on Desktop screens) */
.simulator-float-widget {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    padding: 8px 16px;
    box-shadow: 
        0 10px 25px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 15px rgba(6, 214, 160, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    user-select: none;
}

.simulator-float-widget:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 12px 30px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(157, 78, 221, 0.2);
    border-color: rgba(157, 78, 221, 0.3);
}

.widget-icon-shell {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(6, 214, 160, 0.3);
}

.widget-icon-shell i {
    width: 16px;
    height: 16px;
    color: white;
}

.widget-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.2px;
}

/* Hide Floating widget on small viewports natively */
@media (max-width: 1024px) {
    .simulator-float-widget {
        display: none !important;
    }
}

/* Landscape Mode Toggling */
.iphone-chassis.landscape {
    width: 882px;
    height: 425px;
    padding: 13px;
}

.iphone-chassis.landscape .simulator-screen {
    flex-direction: row;
}

.iphone-chassis.landscape .dynamic-island {
    top: 50%;
    left: 15px;
    transform: translateY(-50%) rotate(-90deg);
    width: 110px;
    height: 30px;
}

.iphone-chassis.landscape .dynamic-island:hover {
    width: 110px; /* Don't expand in landscape to prevent breaking */
}

.iphone-chassis.landscape .status-bar-sim {
    display: none; /* Hide status bar in landscape for simplicity */
}

.iphone-chassis.landscape .home-indicator-sim {
    bottom: auto;
    left: auto;
    right: 8px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
    width: 140px;
    height: 5px;
}

/* Sleep lock screen content for landscape */
.iphone-chassis.landscape .sleep-overlay {
    flex-direction: row;
    gap: 2rem;
}

/* Popups & Dialogs inside Simulator view */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.qr-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.qr-card {
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 2rem;
    width: 360px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.qr-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: white;
}

.qr-code-placeholder {
    width: 180px;
    height: 180px;
    background: white;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-code-placeholder svg {
    width: 100%;
    height: 100%;
}

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

.qr-close-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: white;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.qr-close-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* Auth containers viewport containment inside Simulator */
.iphone-chassis .auth-wrapper,
.iphone-chassis .auth-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999 !important;
    border-radius: 0 !important;
    padding: 1.5rem !important;
    overflow-y: auto !important;
    background-color: var(--bg-darker) !important;
    box-sizing: border-box !important;
}

.iphone-chassis .auth-card {
    margin: 1.5rem auto !important;
    box-shadow: none !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* Simulator Viewport constraints for Bottom Navigation */
.iphone-chassis .bottom-nav {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    z-index: 900 !important;
    border-bottom-left-radius: 40px;
    border-bottom-right-radius: 40px;
    padding-bottom: 15px; /* Account for iPhone home bar */
    height: 74px !important;
}

/* Enable slide-out sidebar drawer inside Simulator viewport on desktop */
.simulator-active .sidebar,
.iphone-chassis .sidebar,
.simulator-active .admin-sidebar,
.iphone-chassis .admin-sidebar {
    display: flex !important;
    position: absolute !important;
    top: 0 !important;
    left: -280px !important;
    width: 280px !important;
    height: 100% !important;
    z-index: 1000 !important;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin-left: 0 !important;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.6) !important;
    background-color: var(--bg-sidebar) !important;
}

body.sidebar-open .simulator-active .sidebar,
body.sidebar-open .iphone-chassis .sidebar,
body.sidebar-open .simulator-active .admin-sidebar,
body.sidebar-open .iphone-chassis .admin-sidebar {
    left: 0 !important;
}

/* Simulator active sidebar overlay overlaying only the viewport */
.simulator-active .mobile-sidebar-overlay,
.iphone-chassis .mobile-sidebar-overlay {
    display: none;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(4px) !important;
    z-index: 999 !important;
}

body.sidebar-open .simulator-active .mobile-sidebar-overlay,
body.sidebar-open .iphone-chassis .mobile-sidebar-overlay {
    display: block !important;
}

.simulator-active .main-content,
.iphone-chassis .main-content,
.simulator-active .admin-main,
.iphone-chassis .admin-main {
    margin-left: 0 !important;
    width: 100% !important;
    padding-bottom: 90px !important;
    padding-top: 60px !important;
}

/* Ensure mobile header menu toggles are shown inside the simulator */
.simulator-active .hexagon-menu-btn,
.iphone-chassis .hexagon-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(157, 78, 221, 0.1) !important;
    border: 1px solid rgba(157, 78, 221, 0.2) !important;
    border-radius: 50% !important;
    color: var(--accent-purple) !important;
    cursor: pointer;
    width: 38px;
    height: 38px;
}

.simulator-active .bottom-nav,
.iphone-chassis .bottom-nav {
    display: flex !important;
}

/* Landscape Mode overrides for simulated elements */
.iphone-chassis.landscape .bottom-nav {
    padding-bottom: 2px !important;
    height: 52px !important;
}

.iphone-chassis.landscape .main-content {
    padding-bottom: 60px !important;
    padding-top: 15px !important;
}
