/* App-Grid und App-Management Styles */

/* Home Screen App Grid */
.home-screen {
    position: absolute;
    top: 44px;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    z-index: 1000;
}

.home-screen.active {
    display: flex;
}

.home-screen.show {
    opacity: 1;
    transform: translateY(0);
}

.home-content {
    flex: 1;
    padding: 0px 30px 220px; /* Extra Padding unten für Dock */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 Spalten für Phone */
    grid-template-rows: auto;
    gap: 10px 5px; /* Kompakte Abstände für Phone */
    max-width: 100%;
    margin: 5px auto 10px; /* Reduced top margin since we have widgets above */
    padding: 0 0px;
    justify-content: center;
    align-content: start;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%; /* Flexibel für Grid */
    height: auto;
    position: relative;
}

.app-icon:hover .app-icon-image {
    transform: scale(1.05); /* 3px Vergrößerung durch scale */
}

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

.app-icon-circle {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.app-icon-image {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 12px; /* Mehr abgerundete Ecken für Phone */
    transition: transform 0.2s ease;
}

.app-icon-label {
    color: white;
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    line-height: 1.2;
    width: 100%;
    max-width: 70px;
    min-height: 14px;
    position: relative;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
}

/* App Container */
.app-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 1300;
    display: flex;
    flex-direction: column;
}

.app-wrapper {
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    border-radius: 25px 25px 0 0;
}

/* Kamera-App: Transparenter Wrapper */
.app-wrapper.camera-mode {
    background: transparent !important;
    border-radius: 0 !important;
}

.app-wrapper.app-show {
    opacity: 1;
    transform: translateY(0);
}

/* App Home Bar - immer am unteren Rand der Apps */
.app-home-bar {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 5px;
    background: rgba(0, 0, 0, 0.562); /* Standard - wird per JS überschrieben */
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1500;
}

/* Standard Hover für Fallback */
.app-home-bar:hover {
    background: rgb(0, 0, 0);
    height: 6px;
}

.app-home-bar:active {
    transform: translateX(-50%) scale(0.95);
}

/* Home-Bar in Kamera-App - spezielle Behandlung */
.app-wrapper.camera-mode .app-home-bar {
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Home Screen Bar - zum Schließen des Phones vom Homescreen */
.home-screen-bar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 5px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1500;
}

.home-screen-bar:hover {
    background: rgb(255, 255, 255);
    height: 6px;
}

.home-screen-bar:active {
    transform: translateX(-50%) scale(0.95);
}

/* Dock Area - iPad-ähnlich */
.dock-area {
    position: absolute;
    bottom: 9px;
    left: 50%;
    transform: translateX(-50%);
    height: 70px;
    width: 260px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.dock-app {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.dock-app:hover {
     transform: scale(1.05); 
}

.dock-app:active {
    transform: translateY(-8px) scale(1.1);
}

.dock-app-image {
    width: 50px;
    object-fit: contain;
}

/* Responsive Anpassungen */
@media (max-width: 1200px) {
    .app-grid {
        grid-template-columns: repeat(3, 80px);
        gap: 60px 120px;
        justify-content: center;
    }
}

@media (max-width: 900px) {
    .app-grid {
        grid-template-columns: repeat(2, 80px);
        gap: 50px 100px;
        justify-content: center;
    }
    
    .app-icon-circle {
        width: 60px;
        height: 60px;
    }
    
    .app-icon-emoji {
        font-size: 24px;
    }
    
    .app-icon-label {
        font-size: 11px;
        width: 75px;
        max-width: 75px;
    }
}

/* App Loading Animation */
@keyframes appLoadPulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.app-icon.loading .app-icon-circle {
    animation: appLoadPulse 1s infinite;
}



@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   WIDGETS CONTAINER (iPhone 16 Style)
   ======================================== */

.widgets-container {
    display: flex;
    gap: 10px;
    padding: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.widget {
    border-radius: 13px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
}

/* ========================================
   PHOTO WIDGET (Breiter, Rechts)
   ======================================== */

.widget-photo {
    flex: 2.725;
    aspect-ratio: 1;
    max-height: 85px; /* Um die Höhe zu ändern, passe diesen Wert an */
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.widget-photo:active {
    transform: scale(0.98);
}

.widget-photo-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: absolute;
    top: 0;
    left: 0;
}

.widget-photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 10px;
    position: absolute;
    top: 0;
    left: 0;
}

.widget-photo-placeholder span {
    display: none; /* Text ausblenden, nur Icon zeigen */
}

/* Hide placeholder when image is loaded */
.widget-photo.has-photo .widget-photo-placeholder {
    display: none;
}

/* ========================================
   CLOCK WIDGET (Links)
   ======================================== */

.widget-clock {
    flex: 0 0 85px; /* Feste Breite von 85px */
    height: 85px; /* Feste Höhe von 85px */
    width: 85px; /* Feste Breite von 85px */
    background: #000000;
    display: block;
    position: relative;
    padding: 0;
}

.clock-face {
    position: absolute;
    top: 6%;
    left: 6%;
    width: 88%;
    height: 88%;
    background: #ebebeb;
    background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ebebeb), color-stop(1, #eeeeee));
    background: -ms-linear-gradient(bottom, #ebebeb, #eeeeee);
    background: -moz-linear-gradient(center bottom, #ebebeb 0%, #eeeeee 100%);
    background: -o-linear-gradient(#eeeeee, #ebebeb);
    border-radius: 50%;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    aspect-ratio: 1 / 1;
}

/* Clock Numbers */
.clock-number {
    font-size: 70%;
    position: absolute;
    box-sizing: border-box;
    font-family: 'HelveticaNeue-Light', Helvetica, sans-serif;
    color: #333;
}

.clock-number.twelve {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 5%;
    text-align: center;
}

.clock-number.twelve::after {
    content: '6';
    position: absolute;
    bottom: 5%;
    left: 0;
    width: 100%;
}

.clock-number.three {
    top: 36%;
    left: 0;
    width: 100%;
    padding: 5% 5%;
    text-align: right;
}

.clock-number.three::after {
    content: '9';
    position: absolute;
    left: 5%;
    width: 100%;
    text-align: left;
}

.clock-number.six {
    /* 6 wird durch twelve::after angezeigt */
    display: none;
}

.clock-number.nine {
    /* 9 wird durch three::after angezeigt */
    display: none;
}

/* Zusätzliche Zahlen für vollständiges Zifferblatt */
.clock-number.one {
    top: 6%;
    bottom: 10%;
    left: 18%;
    width: 60%;
    padding: 5%;
    text-align: right;
}

.clock-number.one::after {
    content: '11';
    position: absolute;
    top: 6%;
    left: 11%;
    text-align: left;
}

.clock-number.two {
    top: 21%;
    bottom: 20%;
    right: 8%;
    width: 84%;
    padding: 5%;
    text-align: right;
}

.clock-number.two::after {
    content: '10';
    position: absolute;
    top: 8%;
    left: 3%;
    text-align: left;
}

.clock-number.four {
    bottom: 21%;
    right: 8%;
    width: 84%;
    padding: 5%;
    text-align: right;
}

.clock-number.four::after {
    content: '8';
    position: absolute;
    bottom: 21%;
    left: 5%;
    text-align: left;
}

.clock-number.five {
    bottom: 6%;
    left: 18%;
    width: 60%;
    padding: 5%;
    text-align: right;
}

.clock-number.five::after {
    content: '7';
    position: absolute;
    top: 25%;
    left: 14%;
    text-align: left;
}

/* Clock Center */
.clock-center {
    position: absolute;
    top: 47%;
    left: 48%;
    background: #000;
    width: 6%;
    height: 6%;
    border-radius: 50%;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
}

/* Clock Hands */
.hour-hand {
    height: 2%;
    width: 35%;
    position: absolute;
    top: 49%;
    left: 51%;
    background: #000;
    border-radius: 0 5% 5% 0;
    -webkit-transform-origin: 0 50%;
    transform-origin: 0 50%;
    z-index: 2;
}

.minute-hand {
    height: 2%;
    width: 25%;
    position: absolute;
    top: 49%;
    left: 50%;
    background: #000;
    border-radius: 0 5% 5% 0;
    -webkit-transform-origin: 0 50%;
    transform-origin: 0 50%;
    z-index: 3;
}

.second-hand {
    height: 1%;
    width: 30%;
    position: absolute;
    top: 50%;
    left: 51%;
    background: #d23540;
    z-index: 4;
    -webkit-transform-origin: 0 50%;
    transform-origin: 0 50%;
}

.sweepCover {
    position: absolute;
    display: block;
    top: 48.1%;
    left: 49.25%;
    background: #d23540;
    width: 4%;
    height: 4%;
    z-index: 5;
    border-radius: 50%;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
}