/* ===================================
   iPhone Animation Fix
   Ajusta la posición del iPhone y cambia el color de pantalla
   =================================== */

/* ===== AJUSTE DE POSICIÓN DEL iPHONE ===== */

/* Contenedor del teléfono */
.phone-container,
.rotating-phone-container {
    position: relative !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    min-height: 600px !important; /* Altura mínima para evitar cortes */
    padding: 60px 20px !important; /* Padding superior e inferior */
    overflow: visible !important;
}

/* iPhone/Teléfono rotante */
.rotating-phone,
.iphone,
.phone-device {
    position: relative !important;
    width: 300px !important;
    height: 600px !important;
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a) !important;
    border-radius: 40px !important;
    padding: 10px !important;
    box-shadow:
        0 50px 100px rgba(0, 0, 0, 0.5),
        0 20px 40px rgba(0, 0, 0, 0.3),
        inset 0 0 0 2px rgba(255, 255, 255, 0.1) !important;
    transform-style: preserve-3d !important;
    margin-top: 40px !important; /* Margen superior para bajar el iPhone */
}

/* ===== PANTALLA DEL iPHONE - COLOR NARANJA ===== */

/* Pantalla principal */
.rotating-phone::before,
.iphone::before,
.phone-screen,
.iphone-screen {
    content: '' !important;
    position: absolute !important;
    top: 20px !important;
    left: 20px !important;
    right: 20px !important;
    bottom: 20px !important;
    background: linear-gradient(135deg, #ff6b35, #ff8c42, #ffa500) !important; /* Gradiente naranja */
    border-radius: 30px !important;
    overflow: hidden !important;
    box-shadow:
        inset 0 0 30px rgba(255, 107, 53, 0.3),
        inset 0 0 60px rgba(255, 140, 66, 0.2) !important;
}

/* Efecto de brillo en la pantalla */
.rotating-phone::after,
.iphone::after {
    content: '' !important;
    position: absolute !important;
    top: 20px !important;
    left: 20px !important;
    right: 20px !important;
    bottom: 20px !important;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.2) 0%,
        transparent 50%,
        transparent 100%
    ) !important;
    border-radius: 30px !important;
    pointer-events: none !important;
}

/* Notch del iPhone */
.phone-notch,
.iphone-notch {
    position: absolute !important;
    top: 10px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 150px !important;
    height: 28px !important;
    background: #1a1a1a !important;
    border-radius: 0 0 20px 20px !important;
    z-index: 10 !important;
}

/* ===== CONTENIDO DE LA PANTALLA ===== */

/* Contenedor de contenido en la pantalla */
.phone-content,
.screen-content {
    position: absolute !important;
    top: 60px !important;
    left: 30px !important;
    right: 30px !important;
    bottom: 30px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    color: white !important;
    font-family: -apple-system, 'SF Pro Display', sans-serif !important;
    z-index: 5 !important;
}

/* Texto en la pantalla */
.phone-content h3,
.screen-content h3 {
    font-size: 24px !important;
    font-weight: 600 !important;
    color: white !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
    margin-bottom: 10px !important;
}

.phone-content p,
.screen-content p {
    font-size: 14px !important;
    color: rgba(255, 255, 255, 0.9) !important;
    text-align: center !important;
    line-height: 1.5 !important;
}

/* ===== ANIMACIÓN MEJORADA ===== */

/* Animación de rotación y flotación */
@keyframes phoneRotateFloat {
    0%, 100% {
        transform: translateY(0) rotateY(0deg) rotateX(0deg);
    }
    25% {
        transform: translateY(-20px) rotateY(15deg) rotateX(5deg);
    }
    50% {
        transform: translateY(-10px) rotateY(-15deg) rotateX(-5deg);
    }
    75% {
        transform: translateY(-15px) rotateY(10deg) rotateX(3deg);
    }
}

.rotating-phone,
.iphone {
    animation: phoneRotateFloat 8s ease-in-out infinite !important;
}

/* Animación del contenido de la pantalla */
@keyframes screenPulse {
    0%, 100% {
        background: linear-gradient(135deg, #ff6b35, #ff8c42, #ffa500);
    }
    50% {
        background: linear-gradient(135deg, #ff8c42, #ffa500, #ff6b35);
    }
}

.rotating-phone::before,
.iphone::before,
.phone-screen {
    animation: screenPulse 4s ease-in-out infinite !important;
}

/* ===== DETALLES ADICIONALES ===== */

/* Botones laterales del iPhone */
.phone-button-power {
    position: absolute !important;
    right: -3px !important;
    top: 120px !important;
    width: 3px !important;
    height: 60px !important;
    background: #2a2a2a !important;
    border-radius: 0 3px 3px 0 !important;
}

.phone-button-volume-up {
    position: absolute !important;
    left: -3px !important;
    top: 100px !important;
    width: 3px !important;
    height: 30px !important;
    background: #2a2a2a !important;
    border-radius: 3px 0 0 3px !important;
}

.phone-button-volume-down {
    position: absolute !important;
    left: -3px !important;
    top: 140px !important;
    width: 3px !important;
    height: 30px !important;
    background: #2a2a2a !important;
    border-radius: 3px 0 0 3px !important;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */

@media (max-width: 968px) {
    .phone-container {
        min-height: 500px !important;
        padding: 40px 20px !important;
    }

    .rotating-phone,
    .iphone {
        width: 250px !important;
        height: 500px !important;
        margin-top: 30px !important;
    }

    /* Animación más suave en tablet */
    @keyframes phoneRotateFloat {
        0%, 100% {
            transform: translateY(0) rotateY(0deg);
        }
        50% {
            transform: translateY(-15px) rotateY(10deg);
        }
    }
}

@media (max-width: 768px) {
    .phone-container {
        min-height: 400px !important;
        padding: 30px 15px !important;
    }

    .rotating-phone,
    .iphone {
        width: 200px !important;
        height: 400px !important;
        margin-top: 20px !important;
        border-radius: 30px !important;
    }

    .rotating-phone::before,
    .iphone::before {
        border-radius: 25px !important;
    }

    .phone-notch {
        width: 100px !important;
        height: 20px !important;
    }

    /* Animación mínima en móvil */
    @keyframes phoneRotateFloat {
        0%, 100% {
            transform: translateY(0);
        }
        50% {
            transform: translateY(-10px);
        }
    }

    .rotating-phone,
    .iphone {
        animation: phoneRotateFloat 6s ease-in-out infinite !important;
    }
}

/* ===== EFECTOS ESPECIALES ===== */

/* Reflejo de luz en el iPhone */
.phone-reflection {
    position: absolute !important;
    top: -50px !important;
    left: -50px !important;
    right: -50px !important;
    height: 200px !important;
    background: radial-gradient(
        ellipse at center top,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 70%
    ) !important;
    pointer-events: none !important;
}

/* Sombra dinámica */
.phone-shadow {
    position: absolute !important;
    bottom: -30px !important;
    left: 10% !important;
    right: 10% !important;
    height: 20px !important;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 0, 0, 0.4) 0%,
        transparent 70%
    ) !important;
    filter: blur(15px) !important;
}

/* ===== LIGHT THEME ADJUSTMENTS ===== */

[data-theme="light"] .rotating-phone,
[data-theme="light"] .iphone {
    background: linear-gradient(135deg, #e0e0e0, #f0f0f0) !important;
    box-shadow:
        0 50px 100px rgba(0, 0, 0, 0.2),
        0 20px 40px rgba(0, 0, 0, 0.1),
        inset 0 0 0 2px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .phone-notch {
    background: #f0f0f0 !important;
}

/* ===== INTEGRACIÓN CON WORK SECTION ===== */

.work-showcase-section .phone-container {
    flex: 1 !important;
    max-width: 500px !important;
    margin-left: auto !important;
}

.showcase-content {
    align-items: center !important;
}

/* Asegurar que el iPhone no se salga del viewport */
.work-showcase-section {
    overflow-x: hidden !important;
    overflow-y: visible !important;
}

/* ===== FIX PARA CORTE SUPERIOR ===== */

/* Asegurar espacio suficiente arriba */
.rotating-phone {
    margin-top: 50px !important; /* Aumentado para evitar corte */
    margin-bottom: 50px !important;
}

/* Ajustar la animación para que no suba tanto */
@keyframes safePhoneFloat {
    0%, 100% {
        transform: translateY(0) rotateY(0deg) rotateX(0deg);
    }
    25% {
        transform: translateY(-10px) rotateY(15deg) rotateX(5deg); /* Reducido de -20px */
    }
    50% {
        transform: translateY(-5px) rotateY(-15deg) rotateX(-5deg); /* Reducido de -10px */
    }
    75% {
        transform: translateY(-8px) rotateY(10deg) rotateX(3deg); /* Reducido de -15px */
    }
}

/* Aplicar la animación más segura */
.work-showcase-section .rotating-phone {
    animation: safePhoneFloat 8s ease-in-out infinite !important;
}