/* IOS Simulation Styles */

/* Base reset for the phone frame logic */
:root {
    --phone-width: 375px;
    --phone-height: 812px;
    --phone-border-radius: 40px;
    --phone-bezel: 15px;
    --notch-width: 150px;
    --notch-height: 25px;
}

/* DESKTOP MODE: Display the Phone Frame */
@media (min-width: 769px) {
    body {
        background-color: #1a1a1a;
        background-image: none;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100vh;
        margin: 0;
        overflow: hidden;
    }

    .iphone-frame {
        /* Fixed Base Size for Scaling Logic (iPhone X/12/13 Mini approx) */
        width: 375px;
        height: 812px;

        background: black;
        border-radius: 40px;
        /* Fixed radius */
        box-shadow: 0 0 0 10px #333, 0 0 50px rgba(0, 0, 0, 0.5);
        position: relative;
        overflow: hidden;
        border: 12px solid black;
        box-sizing: border-box;

        /* Scaling will be handled by JS */
        transition: transform 0.1s;
    }

    /* Notch */
    .iphone-frame::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 150px;
        /* Fixed width */
        height: 25px;
        /* Fixed height */
        background: black;
        border-bottom-left-radius: 12px;
        border-bottom-right-radius: 12px;
        z-index: 1000;
    }

    .iphone-screen {
        width: 100%;
        height: 100%;
        background-color: #000;
        background-image: url('background.png');
        background-size: cover;
        background-position: center;
        overflow: hidden;
        /* Iframe handles scrolling */
        position: relative;
    }

    /* Status Bar Simulation */
    .status-bar {
        height: 3%;
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 900;
        display: flex;
        justify-content: space-between;
        padding: 0 20px;
        box-sizing: border-box;
        color: white;
        font-size: 11px;
        font-weight: 600;
        align-items: center;
        pointer-events: none;
    }


    /* Desktop: Match app header background for coherence (only when viewing apps) */
    body.viewing-app .status-bar {
        background: rgba(28, 28, 30, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }


    .time {
        margin-top: 5px;
        margin-left: 10px;
    }

    .status-icons {
        display: flex;
        gap: 5px;
        margin-top: 5px;
    }

    /* Home Indicator */
    .home-indicator {
        position: absolute;
        bottom: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40%;
        height: 5px;
        background-color: white;
        border-radius: 10px;
        z-index: 1000;
        cursor: pointer;
        /* Clickable home button */
    }
}

/* MOBILE MODE: Reset specific frame styles */
@media (max-width: 768px) {

    html,
    body {
        margin: 0;
        padding: 0;
    }

    html.iphone-shell,
    body.iphone-shell {
        width: 100%;
        height: 100%;
        overflow: hidden;
        /* Prevent body scroll, iframe handles it */
    }

    .iphone-frame {
        width: 100%;
        height: 100%;
        border: none;
        box-shadow: none;
        border-radius: 0;
        position: absolute;
        top: 0;
        left: 0;
    }

    .iphone-frame::before {
        display: none;
    }

    /* Hide notch */

    .iphone-screen {
        width: 100%;
        height: 100%;
        overflow: hidden;
        /* Iframe will scroll */
        position: absolute;
        top: 0;
        left: 0;
    }

    .status-bar,
    .home-indicator {
        display: none;
    }
}

/* APP GRID / SPRINGBOARD STYLES */
.springboard {
    padding: 50px 15px 80px 15px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: max-content;
    gap: 20px 12px;
    /* Vertical gap, Horizontal gap */
    justify-items: center;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    width: 55px;
    gap: 4px;
    transition: transform 0.2s;
}

.app-icon:active {
    transform: scale(0.9);
    filter: brightness(0.8);
}

.app-icon img {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    /* iOS shape */
    object-fit: contain;
    /* Or cover, depending on assets */
    background: #222;
    /* Fallback for png transparency */
    /* If icons are transparent PNGs, might need a background color to look like Apps */
}

/* Special background for known transparent icons to make them look like apps */
.app-icon img {
    background: linear-gradient(145deg, #1c1c1c, #2a2a2a);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.app-icon span {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: white;
    font-size: 10px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 65px;
}

/* New App Bounce Animation */
.app-icon.new-app {
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Add a subtle glow to new apps */
.app-icon.new-app img {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5), 
                0 0 20px rgba(255, 215, 0, 0.4);
}

/* Dock styling */
.dock-container {
    position: absolute;
    bottom: 20px;
    left: 12px;
    right: 12px;
    height: 75px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 8px;
}

/* App Header Styles */
.app-header {
    position: sticky;
    top: 0px;
    z-index: 1000;
    background: rgba(28, 28, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    box-sizing: border-box;
    width: 100%;
}

/* Desktop simulation: Add a spacer block at the top */
.in-iframe .app-header-spacer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: rgba(28, 28, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 999;
}

/* Desktop simulation: Push app-header down by 20px */
.in-iframe .app-header {
    top: 20px;
}

.app-header-left,
.app-header-right {
    flex: 1;
}

.app-title {
    font-family: 'Rye', cursive;
    font-size: 16px;
    font-weight: 400;
    color: #ffd700;
    text-align: center;
    text-transform: uppercase;
    flex: 2;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
    animation: blink 2s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.back-btn {
    text-decoration: none;
    color: #0a84ff;
    font-size: 15px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    display: flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    transition: opacity 0.2s;
}

.back-btn:active {
    opacity: 0.5;
}

.back-arrow {
    font-size: 24px;
    line-height: 1;
    font-weight: 300;
}
/* Standard App Content Container */
.app-content {
    padding: 16px !important;
    border: none !important;
    box-shadow: none !important;
    width: 100%;
    box-sizing: border-box;
    margin: 0 !important;
}
