@font-face {
    font-family: 'SF Pro Display';
    src: url('assets/fonts/SFPRODISPLAYREGULAR.OTF') format('opentype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'SF Pro Display';
    src: url('assets/fonts/SFPRODISPLAYMEDIUM.OTF') format('opentype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'SF Pro Display';
    src: url('assets/fonts/SFPRODISPLAYBOLD.OTF') format('opentype');
    font-weight: 700;
    font-style: normal;
}

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

body {
    background-color: #000;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ios-container {
    width: 375px;
    height: 812px;
    margin: 20px auto;
    background: url('https://applescoop.org/image/wallpapers/iphone/88687086508350787-93966135943258583.jpeg') center/cover;
    position: relative;
    border-radius: 40px;
    overflow: hidden;
    transition: width 0.3s, height 0.3s;
}

/* Update the status bar styling */
.status-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 17px 20px;
    color: white;
    font-size: clamp(15px, 1.5vw, 14px);
    z-index: 1002;
    transition: all 0.3s ease;
}

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

.status-icons i {
    font-size: clamp(12px, 1.5vw, 14px);
}

.status-icons img {
    width: clamp(16px, 2vw, 20px);
    height: auto;
    object-fit: contain;
    transition: filter 0.3s ease;
}

.status-icons img.battery {
    width: clamp(20px, 2.5vw, 24px);
}

/* Add new class for dark icons */
.status-icons.dark img {
    filter: brightness(0); /* This will make white icons black */
}

.app-grid {
    position: relative;
    height: calc(100% - 150px);
    overflow: hidden;
    display: flex;
    width: 100%;
    margin-top: 35px; /* Add this line to move content below status bar */
}

.page {
    min-width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 20px;
    position: relative; /* Change from absolute to relative */
    transition: transform 0.3s ease-out;
    align-content: start; /* Add this to remove extra vertical space */
}

.app-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px; /* Reduce gap between icon and text */
    margin-bottom: 0; /* Remove any bottom margin */
}

/* Update the app-icon class */
.app-icon {
    width: clamp(50px, 6vh, 65px);
    height: clamp(50px, 6vh, 65px);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: clamp(12px, 1.5vh, 18px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* Update the app-name class for better text scaling */
.app-name {
    color: white;
    font-size: clamp(10px, 1.2vh, 12px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Add media queries for fullscreen mode */
@media (min-height: 812px) {
    .app-icon {
        width: clamp(55px, 7vh, 70px);
        height: clamp(55px, 7vh, 70px);
    }

    .app-name {
        font-size: clamp(11px, 1.4vh, 13px);
    }
}

/* Update dock icons to match main app icons */
.dock .app-icon {
    width: clamp(50px, 6.5vh, 70px);
    height: clamp(50px, 6.5vh, 70px);
}

/* Adjust dock padding and spacing */
.dock {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: space-evenly; /* Add this to space icons evenly */
    width: calc(100% - 40px); /* Make dock wider with 20px padding on each side */
    padding: clamp(15px, 2vh, 25px) clamp(10px, 1.5vh, 20px);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    gap: clamp(10px, 2vh, 30px);
}

.page-indicators {
    position: absolute;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: background-color 0.3s;
}

.dot.active {
    background: rgba(255, 255, 255, 0.8);
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.8); }
}

.bounce {
    animation: bounce 0.3s ease-in-out;
}

.fullscreen-btn {
    position: static; /* Remove fixed positioning */
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

/* Keep the mobile-only display for fullscreen button */
@media (max-width: 768px) {
    .fullscreen-btn {
        position: fixed;
        bottom: 20px;
        right: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Mobile fullscreen button styling */
.fullscreen-btn.mobile-only {
    display: none;
    position: static;
    margin: 20px auto;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
}

@media (max-width: 768px) {
    .right-panel .fullscreen-btn {
        display: none;
    }
    
    .fullscreen-btn.mobile-only {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Update the app container styling */
.app-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 999;
    display: none;
    flex-direction: column;
    padding-bottom: 34px; /* Match home bar container height */
    -ms-overflow-style: none;  /* Hide scrollbar for IE and Edge */
    scrollbar-width: none;     /* Hide scrollbar for Firefox */
    padding-top: 50px;
}

.app-container::-webkit-scrollbar {
    display: none;             /* Hide scrollbar for Chrome, Safari and Opera */
}

/* Add styling for the app content */
.app-content {
    flex: 1;
    margin-top: 54px; /* Height of status bar */
    overflow-y: auto;
    position: relative;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.app-content::-webkit-scrollbar {
    display: none;
}

/* Update home bar container */
.home-bar-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    z-index: 1001;
    pointer-events: none;
}

.home-bar {
    position: absolute;
    bottom: 25px; /* adjust as needed */
    left: 50%;
    transform: translateX(-50%);
    width: 134px;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    z-index: 1000;
}

/* Add app opening animation styles */
@keyframes openApp {
  from {
    transform: scale(0.1);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.app-opening {
  animation: openApp 0.3s ease-out forwards;
  transform-origin: bottom;
}

.app-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: black;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  z-index: 999;
}

.app-background.visible {
  opacity: 1;
}

@keyframes closeApp {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0.1) translateY(-100%);
        opacity: 0;
    }
}

.app-closing {
    animation: closeApp 0.3s ease-in forwards;
    transform-origin: top;
}

.app-background.closing {
    opacity: 0;
}

/* Custom popup styling for iOS-like appearance */
.custom-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0;
    background: rgba(250, 250, 250, 0.95);
    backdrop-filter: blur(20px);
    color: #000;
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    z-index: 2147483647; /* Maximum safe z-index value */
    width: 270px;
    animation: popupIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.custom-popup .popup-content {
    padding: 16px 16px 0;
    text-align: center;
}

.custom-popup p {
    margin: 0 0 16px;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.3;
    color: #000;
}

/* Add horizontal line above button */
.custom-popup .popup-close {
    width: 100%;
    background: none;
    color: #007AFF;
    border: none;
    border-top: 1px solid rgba(0,0,0,0.1);
    padding: 16px;
    margin: 0 -16px; /* Negative margin to extend line full width */
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.1s;
}

.custom-popup .popup-close:active {
    background-color: rgba(0,0,0,0.1);
}

/* Backdrop overlay */
.popup-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    z-index: 2147483646; /* One less than popup */
    animation: backdropIn 0.3s forwards;
}

.popup-backdrop.closing {
    animation: backdropOut 0.2s forwards;
}

/* Animations */
@keyframes popupIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.2);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes popupOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

@keyframes backdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes backdropOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Add fullscreen specific styles */
.ios-container:fullscreen .custom-popup,
.ios-container:-webkit-full-screen .custom-popup {
    position: fixed;
    z-index: 2147483647;
}

.ios-container:fullscreen .popup-backdrop,
.ios-container:-webkit-full-screen .popup-backdrop {
    position: fixed;
    z-index: 2147483646;
}

.desktop-container {
    display: flex;
    align-items: center; /* Changed from flex-start to center */
    justify-content: center;
    gap: 2rem;
    padding: 2rem;
    min-height: 100vh;
}

.left-panel {
    text-align: left;
}

.webphone-title {
    font-size: 2rem;
    color: #e3e3e3;
    margin-bottom: 0.5rem;
}

.beta-tag {
    font-size: 0.8rem;
    background-color: #007AFF;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: super;
}

.version-info {
    display: flex;
    flex-direction: column;
    color: #666;
    font-size: 0.9rem;
}

.right-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.control-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Remove the gap property from control-btn and add it to icon */
.control-btn i {
    width: auto;
}

/* Make it responsive */
@media (max-width: 768px) {
    .left-panel, .right-panel {
        display: none;
    }
    
    .desktop-container {
        padding: 0;
    }
}

/* Warning overlay for low resolution */
.resolution-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
    color: white;
    text-align: center;
    padding: 20px;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.warning-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
}

.warning-title {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 15px;
}

.warning-subtitle {
    font-size: 16px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.8);
}

/* Replace the existing media query with this more sophisticated version */

/* Calculate minimum requirements based on aspect ratio */
@media (max-width: 400px), (max-height: 730px) {
    @media (min-aspect-ratio: 9/16) {
        /* For wider screens */
        @media (min-height: 670px) {
            .ios-container {
                filter: none;
            }
            .resolution-warning {
                display: none;
            }
        }
        /* For shorter screens, show warning */
        @media (max-height: 670px) {
            .ios-container {
                filter: blur(10px);
            }
            .resolution-warning {
                display: block;
            }
        }
    }

    @media (max-aspect-ratio: 9/16) {
        /* For taller screens, consider both width and height */
        @media (max-width: 376px) and (max-height: 700px) {
            .ios-container {
                filter: blur(10px);
            }
            .resolution-warning {
                display: block;
            }
        }
        @media (min-width: 376px), (min-height: 701px) {
            .ios-container {
                filter: none;
            }
            .resolution-warning {
                display: none;
            }
        }
    }
}

/* Block devices that don’t meet both minimum dimensions */
@media (max-width: 375px) and (max-height: 667px) {
    .ios-container {
        filter: blur(10px);
    }
    .resolution-warning {
        display: block;
    }
}

/* Block devices with excessively narrow aspect ratios */
@media (max-aspect-ratio: 0.45) {
    .ios-container {
        filter: blur(10px);
    }
    .resolution-warning {
        display: block;
    }
}