/* iOS Mobile Layout */
@media (max-width: 768px) {
    /* Hide all content when iOS homescreen is active */
    body.ios-mode > *:not(.ios-homescreen) {
        display: none !important;
    }
    
    body.ios-mode {
        overflow: hidden !important;
    }
    
    .ios-homescreen {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #4a90e2 100%) !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        z-index: 9999 !important;
    }

    .ios-status-bar {
        display: none !important;
    }

    .ios-app-container {
        flex: 1 !important;
        position: relative !important;
        overflow: hidden !important;
    }

    .ios-app {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        border-radius: 20px 20px 0 0;
        margin-top: 10px;
    }

    .ios-app.active {
        transform: translateX(0);
    }

    .ios-app.about {
        transform: translateX(0);
        background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #4a90e2 100%);
        color: white;
        border-radius: 0;
        margin-top: 0;
    }

    .ios-app-header {
        height: 50px; /* Reduced header height */
        background: rgba(0, 0, 0, 0) !important;
        display: flex;
        align-items: center;
        padding: 0 15px; /* Reduced padding */
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }

    .ios-app-title {
        font-size: 14px; /* Reduced from 16px */
        font-weight: 600;
        color: #333;
    }

    .ios-app.about .ios-app-title {
        color: white;
    }

    .ios-app-content {
        padding: 10px; /* Reduced padding for mobile */
        overflow-y: none;
        font-size: 13px; /* Reduced from 14px */
    }

    .ios-app.about .ios-app-content {
        display: flex;
        flex-direction: column;
        justify-content: flex-start; /* Changed from center to flex-start for scrolling */
        align-items: center;
        text-align: center;
        padding: 10px 10px; /* Reduced top padding from 20px to 10px */
        overflow-y: auto; /* Ensure scrolling works */
    }

    /* Scroll down animation */
    .scroll-down-indicator {
        text-align: center;
        margin: 0em 0 1em 0;
        animation: bounce 2s infinite;
    }

    .scroll-down-arrow {
        color: rgba(255, 255, 255, 0.8);
        font-size: 1.5em;
        display: block;
        margin-bottom: 0.5em;
    }

    .scroll-down-text {
        color: rgba(255, 255, 255, 0.6);
        font-size: 0.9em;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

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

    /* News section within About app */
    .ios-app.about .news-section-in-about {
        border-top: 1px solid rgba(255, 255, 255, 0.3);
        width: 100%;
        color: white !important;
        padding-bottom: 15em !important;
    }

    .ios-app.about .news-section-in-about h2 {
        margin-top: 0em !important;
        padding-top: 0em !important;
        color: white !important;
        margin-bottom: 0.5em;
        font-size: 2em !important;
    }

    .ios-app.about .news-section-in-about .card {
        background: rgba(224, 221, 221, 0.1) !important;
        backdrop-filter: blur(10px);
        border-radius: 15px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        margin-bottom: 1em;
        color: white !important;
    }

    .ios-app.about .news-section-in-about .card img {
        max-width: 8em !important;
        max-height: 8em !important;
        object-fit: contain;
    }

    .ios-dock {
        height: 80px !important;
        background: rgba(255, 255, 255, 0.15) !important;
        backdrop-filter: blur(30px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(30px) saturate(180%) !important;
        border-radius: 25px 25px 0 0 !important;
        border: 1px solid rgba(255, 255, 255, 0.18) !important;
        border-bottom: none !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 20px !important;
        gap: 15px !important;
        flex-shrink: 0 !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 10px !important;
        right: 10px !important;
        z-index: 10000 !important;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12) !important;
    }

    .ios-dock-item-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
    }

    .ios-dock-item {
        width: 50px;
        height: 50px;
        background: rgba(255, 255, 255, 0.25) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-radius: 14px !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
        font-size: 20px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), 
                    0 2px 8px rgba(0, 0, 0, 0.06),
                    inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
        position: relative !important;
    }

    .ios-dock-item:active {
        transform: scale(0.92) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    }

    .ios-dock-item.active {
        background: rgba(255, 255, 255, 0.4) !important;
        border: 1px solid rgba(255, 255, 255, 0.5) !important;
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15),
                    0 3px 12px rgba(0, 0, 0, 0.1),
                    inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
        transform: translateY(-2px) !important;
    }

    .ios-dock-label {
        font-size: 8px;
        font-weight: 600;
        color: white;
        text-align: center;
        max-width: 50px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
        letter-spacing: 0.2px;
    }

    /* Hide desktop elements on mobile */
    .desktop-view {
        display: none !important;
    }

    /* About section styling in iOS mobile */
    .about-content.ios {
        background: rgba(255, 255, 255, 0.1) !important;
        backdrop-filter: blur(10px);
        border-radius: 15px;
        padding: 15px; /* Reduced padding */
        border: 1px solid rgba(255, 255, 255, 0.2);
        margin: 10px 0; /* Reduced margin */
    }

    .about-content.ios a {
        color: white !important;
    }

    .about-content.ios .terminal,
    .about-content.ios #typewriter {
        background: rgba(0, 0, 0, 0.7) !important;
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: #00ff00 !important;
        padding: 15px !important; /* Reduced padding */
        margin: 10px 0; /* Reduced margin */
        font-size: 12px; /* Smaller font for mobile */
    }

    .about-content.ios .small-img {
        border-radius: 50%;
        border: 3px solid rgba(255, 255, 255, 0.5);
        margin-bottom: 15px; /* Reduced margin */
        max-width: 8em !important;
        height: auto;
    }

    .ios-app.publications {
        background: rgba(255, 255, 255, 0.4) !important;
        backdrop-filter: blur(10px);
        border-radius: 15px;
        padding: 15px; /* Reduced padding */
        border: 1px solid rgba(255, 255, 255, 0.2);
        margin: 10px 0; /* Reduced margin */
        color:black !important;
        padding-bottom: 15em; /* Reduced bottom padding */
    }

    .ios-app.students {
        background: rgba(255, 255, 255, 0.4) !important;
        backdrop-filter: blur(10px);
        border-radius: 15px;
        padding: 15px; /* Reduced padding */
        border: 1px solid rgba(255, 255, 255, 0.2);
        margin: 10px 0; /* Reduced margin */
        color: black !important;
        padding-bottom: 15em; /* Reduced bottom padding */
    }

    .ios-app.projects {
        background: rgba(255, 255, 255, 0.4) !important;
        backdrop-filter: blur(10px);
        border-radius: 15px;
        padding: 15px; /* Reduced padding */
        border: 1px solid rgba(255, 255, 255, 0.2);
        margin: 10px 0; /* Reduced margin */
        color: black !important;
        padding-bottom: 15em; /* Reduced bottom padding */
    }

    .ios-app.contacts {
        background: rgba(255, 255, 255, 0.4) !important;
        backdrop-filter: blur(10px);
        border-radius: 15px;
        padding: 15px; /* Reduced padding */
        border: 1px solid rgba(255, 255, 255, 0.2);
        margin: 10px 0; /* Reduced margin */
        color: black !important;
        padding-bottom: 15em; /* Reduced bottom padding */
    }

    .ios-app .card {
        background: rgba(224, 221, 221, 0.2) !important;
        backdrop-filter: blur(10px);
        border-radius: 15px;
        padding: 15px !important; /* Reduced padding */
        border: 1px solid rgba(255, 255, 255, 0.1);
        margin: 10px 0 !important; /* Reduced margin */
        color: black !important;
        font-size: 14px; /* Smaller font size */
    }

    .ios-app .list-group-item {
        background: rgba(0, 0, 0, 0) !important;
        border: none !important;
        color: black !important;
        padding: 10px !important; /* Reduced padding */
    }

    .ios-app .badge {
        background: rgba(3, 83, 144, 0.851) !important;
        border: 1px solid rgba(197, 195, 195, 0.807);
        color: white !important;
        font-size: 10px; /* Reduced from 12px */
    }

    .ios-app .badge:hover {
        color: white !important;
        font-size: 10px; /* Reduced from 12px */
    }

    .ios-app .h5 .a {
        color: black !important;
    }

    .ios-app .btn {
        background: rgba(110, 112, 113, 0.6) !important;
        color: black !important;
        border-radius: 15px;
        border: none !important;
        padding: 6px 12px !important; /* Reduced from 8px 16px */
        font-size: 12px; /* Reduced from 14px */
    }

    /* Make all links black in iOS apps */
    .ios-app a {
        color: black !important;
    }

    .ios-app a:hover {
        color: #333 !important;
    }

    .ios-app .card img {
        object-fit: contain; /* Changed from cover to contain */
    }

    .ios-app .card .text-muted {
        color: rgb(19, 41, 69) !important;
    }

    /* Compact headings on mobile */
    .ios-app h1, .ios-app h2, .ios-app h3, .ios-app h4, .ios-app h5 {
        margin-top: 15px !important;
        margin-bottom: 10px !important;
        font-size: 1.0em !important; /* Reduced from 1.1em */
    }

    /* Compact paragraphs */
    .ios-app p {
        margin-bottom: 10px !important;
        line-height: 1.4 !important;
        font-size: 12px !important; /* Smaller paragraph text */
    }

    /* Ensure about section text is centered */
    .ios-app.about p {
        text-align: center !important;
    }

    .ios-app .small {
        color: rgba(255, 255, 255, 0.6) !important;
    }

    .ios-app.about .about-content p {
        text-align: center !important;
    }

}